🔣 Blueprint
蓝图类允许在 nanos world 中生成任何虚幻引擎蓝图 Actor。

👪Inheritance
提示
如果你的 Actor 蓝图是在服务端生成的,它将使用 nanos world 网络主控系统自动与其他玩家同步!它遵循与其他所有实体相同的规则!
🎒 示例
从 Lua 调用蓝图事件
Client/Index.lua
-- 生成蓝图
local blueprint = Blueprint(Vector(), Rotator(), "my-asset-pack::BP_MyBlueprint")
local param1 = 123
local param2 = "hello there!"
-- 调用事件并传递任意参数
blueprint:CallBlueprintEvent("MyBlueprintCustomEvent", param1, param2)
绑定蓝图事件分发器
Client/Index.lua
-- 生成蓝图
local blueprint = Blueprint(Vector(), Rotator(), "my-asset-pack::BP_MyBlueprint")
-- 订阅蓝图事件分发器
blueprint:BindBlueprintEventDispatcher("MyBlueprintDispatcher", function(self, arg1, arg2)
Console.Log("Called from Blueprint!", arg1, arg2)
end)
🛠 构造函数
Default Constructor
No description provided
local my_blueprint = Blueprint(location, rotation, blueprint_asset, collision_type?)
Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| Vector | location | Required parameter | 生成的世界坐标位置 |
| Rotator | rotation | Required parameter | 生成的世界坐标旋转 |
| Blueprint Reference | blueprint_asset | Required parameter | 要生成的蓝图资产 |
| CollisionType | collision_type | CollisionType.Auto | 此 Actor 的碰撞配置文件 |
🗿 静态函数
Inherited Entity Static Functions
Blueprint inherits from Base Entity Class, sharing it's methods and functions:
Base Entityscripting-reference/classes/base-classes/entity
Base Entityscripting-reference/classes/base-classes/entity
| Returns | Name | Description | |
|---|---|---|---|
| table of Base Entity | GetAll | 返回一个包含调用此方法的类中所有实体的表 | |
| Base Entity | GetByIndex | 返回该类中指定索引处的特定实体 | |
| integer | GetCount | 返回该类当前存在的实体数量 | |
| table of table | GetInheritedClasses | 获取使用 继承系统 创建的、直接继承自该类的所有子类列表 | |
| iterator | GetPairs | 返回一个包含该类所有实体的迭代器,用于 pairs() 循环 | |
| table or nil | GetParentClass | 如果该类是使用 继承系统 创建的,则获取其父类 | |
| table | Inherit | 使用 继承系统 继承此类 | |
| boolean | IsChildOf | 如果该类是使用 继承系统 创建的,检查此类是否为另一个类的子类 | |
| function | Subscribe | 为该类的所有实体订阅一个 事件 | |
| function | SubscribeRemote | 订阅从服务器调用的自定义远程事件 | |
Unsubscribe | 退订此包内该类中此 事件 的所有回调,或者仅取消传入的特定回调 |
This class doesn't have own static functions.
🦠 函数
Inherited Entity Functions
Blueprint inherits from Base Entity Class, sharing it's methods and functions:
Base Entityscripting-reference/classes/base-classes/entity
Base Entityscripting-reference/classes/base-classes/entity
| Returns | Name | Description | |
|---|---|---|---|
BroadcastRemoteEvent | 直接在此实体上向所有玩家调用自定义远程事件 | ||
BroadcastRemoteInRadiusEvent | 直接针对此实体调用自定义远程事件,并将该事件传递给半径范围内的所有玩家 | ||
CallRemoteEvent | 直接在此实体上向特定玩家调用自定义远程事件 | ||
CallRemoteEvent | 直接在此实体上调用自定义远程事件 | ||
CallRemotePlayersEvent | 直接在此实体上调用自定义远程事件,并将事件传递给玩家列表 | ||
Destroy | 销毁该实体 | ||
FinishSpawn | 如果此实体是以延迟 spawn_mode 生成的,则完成生成过程并将该实体发送至客户端 | ||
| table of string | GetAllValuesKeys | 获取所有存储值的键名列表 | |
| table | GetClass | 获取该实体的类 | |
| integer | GetID | 获取该实体的全网通用网络 ID(在客户端和服务器上相同) | |
| any | GetValue | 获取此实体上存储在给定键处的 值 | |
| boolean | HasAuthority | 获取本地上下文是否对此实体拥有主控(如果由客户端生成则为 true,由服务器生成则为 false) | |
| boolean | IsA | 递归检查此实体是否继承自某个类 | |
| boolean | IsBeingDestroyed | 如果该实体正在被销毁,则返回 true | |
| boolean | IsSpawned | 获取此实体是否已完成生成 | |
| boolean | IsValid | 如果该实体有效(即未被销毁且指向一个有效的实体),则返回 true | |
SetSpawnMode | 从继承类的构造函数中覆盖此实体完成生成的时间点 | ||
SetValue | 在此实体中设置一个值 | ||
| function | Subscribe | 在这个特定实体上订阅一个事件 | |
| function | SubscribeRemote | 在这个特定实体上订阅一个从服务器调用的自定义远程事件 | |
Unsubscribe | 退订此包内该实体中此 事件 的所有回调,或者仅取消传入的特定回调 |
Inherited Actor Functions
Blueprint inherits from Base Actor Class, sharing it's methods and functions:
Base Actorscripting-reference/classes/base-classes/actor
Base Actorscripting-reference/classes/base-classes/actor
| Returns | Name | Description | |
|---|---|---|---|
AddActorTag | 向该 Actor 添加一个虚幻 Actor 标签 | ||
AddAngularImpulse | 向该 Actor 添加角冲量。适用于单次瞬间爆发 | ||
AddImpulse | 向该 Actor 添加冲量。适用于单次瞬间爆发 | ||
| boolean | AttachTo | 将该 Actor 附加到任何其他 Actor 上,可选择附加在特定骨骼处 | |
Detach | 将该 Actor 从其附加的 Actor 上分离 | ||
| table of string | GetActorTags | 获取该 Actor 上的所有虚幻 Actor 标签 | |
| Vector | GetAngularForce | 获取该 Actor 的角外力(由 SetAngularForce() 设置) | |
| float | GetAngularVelocity | 返回此 Actor 的角速度 | |
| table of Base Actor | GetAttachedEntities | 获取附加到该 Actor 的所有 Actor | |
| Base Actor or nil | GetAttachedTo | 获取该 Actor 所附加到的父级 Actor | |
| string | GetAttachedToSocket | 获取此 Actor 所附加到的骨骼或插槽名称 | |
| table | GetBounds | 获取此 Actor 的包围盒,便于计算其在世界中的尺寸 | |
| CollisionType | GetCollision | 获取该 Actor 的碰撞类型 | |
| integer | GetDimension | 获取该 Actor 的维度 | |
| float | GetDistanceFromCamera | 获取该 Actor 距离相机的距离 | |
| Vector | GetForce | 获取该 Actor 的持续外力(由 SetForce() 设置) | |
| float | GetLifeSpan | 获取此 Actor 被销毁前剩余的时间(秒) | |
| Vector | GetLocation | 获取该 Actor 在游戏世界中的位置 | |
| float | GetMass | 返回此 Actor 的质量 | |
| Player or nil | GetNetworkAuthority | 获取该 Actor 的网络主控玩家 | |
| Vector | GetRelativeLocation | 如果该 Actor 已附加,获取其相对位置 | |
| Rotator | GetRelativeRotation | 如果该 Actor 已附加,获取其相对旋转 | |
| Rotator | GetRotation | 获取该 Actor 在游戏世界中的角度值 | |
| Vector | GetScale | 获取该 Actor 的缩放比例 | |
| float | GetScreenPercentage | 获取该 Actor 在屏幕中所占尺寸的百分比 | |
| table | GetSocketTransform | 在给定骨骼或插槽名称的情况下,获取世界空间中的插槽变换 | |
| Vector | GetVelocity | 获取该 Actor 当前的速度 | |
| boolean | HasNetworkAuthority | 如果本地玩家当前是该 Actor 的网络主控(Network Authority),则返回 true | |
| boolean | IsGravityEnabled | 如果该 Actor 启用了重力,则返回 true | |
| boolean | IsInWater | 如果该 Actor 处于水中,则返回 true | |
| boolean | IsNetworkDistributed | 如果该 Actor 当前处于网络分配状态,则返回 true | |
| boolean | IsVisible | 如果该 Actor 可见,则返回 true | |
RemoveActorTag | 从该 Actor 中移除一个虚幻 Actor 标签 | ||
RotateTo | 在一定时间内平滑旋转该 Actor 到指定角度 | ||
SetAngularForce | 向该 Actor 添加一个永久的角外力,设为 Vector(0, 0, 0) 可以取消 | ||
SetCastShadow | 设置该 Actor 是否投射阴影 | ||
SetCollision | 设置该 Actor 的碰撞类型 | ||
SetDimension | 设置此 Actor 的维度。Actor 仅能看见并与处于同一维度中的实体进行交互 | ||
SetDistanceOptimizationMultiplier | 设置此 Actor 的距离优化系数 | ||
SetForce | 向该 Actor 添加一个永久的外力,设为 Vector(0, 0, 0) 可以取消 | ||
SetGravityEnabled | 设置该 Actor 是否启用重力 | ||
SetHighlightEnabled | 设置该 Actor 是否启用高亮显示,以及使用哪个高亮索引值 | ||
SetLifeSpan | 设置该 Actor 被销毁前的生存时间(秒)。经过这段时间后,Actor 将被自动销毁。 | ||
SetLocation | 设置该 Actor 在游戏世界中的位置 | ||
SetNetworkAuthority | 设置某个玩家拥有此 Actor 的网络主控 | ||
SetNetworkAuthorityAutoDistributed | 设置该 Actor 是否在玩家之间自动分配网络主控 | ||
SetOutlineEnabled | 设置该 Actor 是否启用描边,以及使用哪个描边索引值 | ||
SetRelativeLocation | 在局部空间中设置该 Actor 的相对位置(仅在此 Actor 已附加时生效) | ||
SetRelativeRotation | 在局部空间中设置该 Actor 的相对旋转(仅在此 Actor 已附加时生效) | ||
SetRenderCullDistance | 设置该 Actor 的渲染剔除距离 | ||
SetRotation | 设置该 Actor 在游戏世界中的旋转 | ||
SetScale | 设置该 Actor 的缩放比例 | ||
SetVisibility | 设置该 Actor 是否可见 | ||
TranslateTo | 在一定时间内平滑地将该 Actor 移动到某个位置 | ||
| boolean | WasRecentlyRendered | 获取该 Actor 最近是否在屏幕上被渲染过 |
Inherited Paintable Functions
Blueprint inherits from Base Paintable Class, sharing it's methods and functions:
Base Paintablescripting-reference/classes/base-classes/paintable
Base Paintablescripting-reference/classes/base-classes/paintable
| Returns | Name | Description | |
|---|---|---|---|
| Color | GetMaterialColorParameter | 从该 Actor 的材质中获取 Color 参数 | |
| float | GetMaterialScalarParameter | 从该 Actor 的材质中获取 Scalar 参数 | |
| string | GetMaterialTextureParameter | 从该 Actor 的材质中获取 Texture 参数 | |
| Vector | GetMaterialVectorParameter | 从该 Actor 的材质中获取 Vector 参数 | |
ResetMaterial | 将指定索引处的材质重置为原始材质 | ||
SetMaterial | 设置该 Actor 指定索引处的材质 | ||
SetMaterialColorParameter | 设置该 Actor 材质中的 Color 参数 | ||
SetMaterialFromCanvas | 将该 Actor 指定索引处的材质设为 Canvas 对象 | ||
SetMaterialFromSceneCapture | 将该 Actor 指定索引处的材质设为 SceneCapture 对象 | ||
SetMaterialFromWebUI | 将该 Actor 指定索引处的材质设为 WebUI 对象 | ||
SetMaterialScalarParameter | 设置该 Actor 材质中的 Scalar 参数 | ||
SetMaterialTextureParameter | 将该 Actor 材质中的纹理参数设为一张图像 | ||
SetMaterialVectorParameter | 设置该 Actor 材质中的 Vector 参数 | ||
SetPhysicalMaterial | 使用新的物理材质覆盖该 Actor 的物理材质 |
| Returns | Name | Description | |
|---|---|---|---|
| function | BindBlueprintEventDispatcher | 分配并绑定一个蓝图事件分发器 | |
| varargs of any | CallBlueprintEvent | 调用一个蓝图事件或函数 | |
| any | GetBlueprintPropertyValue | 获取蓝图属性/变量的值 | |
SetBlueprintPropertyValue | 直接设置蓝图属性/变量的值 | ||
UnbindBlueprintEventDispatcher | 解绑一个蓝图事件分发器 |
Slow

BindBlueprintEventDispatcher
分配并绑定一个蓝图事件分发器
local ret = my_blueprint:BindBlueprintEventDispatcher(dispatcher_name, callback)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| string | dispatcher_name | Required parameter | 事件分发器名称 |
| function | callback | Required parameter | 要调用的回调函数 with this format |
Returns
| Type | Description |
|---|---|
| function | 回调函数本身 |
Slow

CallBlueprintEvent
调用一个蓝图事件或函数
在客户端返回所有函数返回值
local ret_01, ret_02, ... = my_blueprint:CallBlueprintEvent(event_name, arguments...?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| string | event_name | Required parameter | 事件或函数名称 |
| any | arguments...? | nil | 要传递给该事件的参数序列 |
Slow

GetBlueprintPropertyValue
获取蓝图属性/变量的值
local value = my_blueprint:GetBlueprintPropertyValue(property_name)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| string | property_name | Required parameter | 蓝图变量的名称 |
Returns
| Type | Description |
|---|---|
| any | 值 |
See also SetBlueprintPropertyValue.
Slow

SetBlueprintPropertyValue
直接设置蓝图属性/变量的值
my_blueprint:SetBlueprintPropertyValue(property_name, value)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| string | property_name | Required parameter | 蓝图变量的名称 |
| any | value | Required parameter | 要设置的值 |
See also GetBlueprintPropertyValue.
Moderate

UnbindBlueprintEventDispatcher
解绑一个蓝图事件分发器
my_blueprint:UnbindBlueprintEventDispatcher(dispatcher_name, callback?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| string | dispatcher_name | Required parameter | 事件分发器名称 |
| function | callback? | nil | 可选的要解绑的回调函数 |
🚀 事件
Inherited Entity Events
Blueprint inherits from Base Entity Class, sharing it's events:
Base Entityscripting-reference/classes/base-classes/entity
Base Entityscripting-reference/classes/base-classes/entity
| Name | Description | |
|---|---|---|
ClassRegister | 当使用 继承系统 注册一个新类时触发 | |
Destroy | 当实体被销毁时触发 | |
Spawn | 当实体被生成/创建时触发 | |
ValueChange | 当实体通过 :SetValue() 改变了值时触发 |
Inherited Actor Events
Blueprint inherits from Base Actor Class, sharing it's events:
Base Actorscripting-reference/classes/base-classes/actor
Base Actorscripting-reference/classes/base-classes/actor
| Name | Description | |
|---|---|---|
DimensionChange | 当 Actor 改变其维度时触发 | |
EnterWater | 当 Actor 进入水体时触发 | |
LeaveWater | 当 Actor 离开水体时触发 | |
NetworkAuthorityChange | 当 Actor 更改其网络主控玩家时触发 | |
NetworkAuthorityChange | 当本地玩家获得或失去对此 Actor 的网络主控时触发 |
This class doesn't have own events.
✅ 支持的参数类型列表
可以在 Lua ↔ 蓝图之间传递的所有支持参数的列表:
| Lua 类型 | 蓝图类型 | Lua → 蓝图 | 蓝图 → Lua |
|---|---|---|---|
| boolean | Boolean | ✅ | ✅ |
| number | Byte | ✅ | ✅ |
| number | Integer | ✅ | ✅ |
| number | Integer64 | ✅ | ✅ |
| number | Float | ✅ | ✅ |
| number | Enum | ✅ | ✅ |
| string | String | ✅ | ✅ |
| string | Name | ✅ | ✅ |
| string | Text | ✅ | ✅ |
| Vector2D | Vector2D | ✅ | ✅ |
| Vector | Vector | ✅ | ✅ |
| Rotator | Rotator | ✅ | ✅ |
| Color | Color | ✅ | ✅ |
| Color | LinearColor | ✅ | ✅ |
| StaticMesh | StaticMeshActor | ✅ | ✅ |
| Prop | StaticMeshActor | ✅ | ✅ |
| Weapon | SkeletalMeshActor | ✅ | ✅ |
| Base Vehicle | WheeledVehiclePawn | ✅ | ✅ |
| Grenade | StaticMeshActor | ✅ | ✅ |
| Melee | StaticMeshActor | ✅ | ✅ |
| Light | PointLight、SpotLight 或 RectLight | ✅ | ✅ |
| Decal | DecalActor | ✅ | ✅ |
| TextRender | TextRenderActor | ✅ | ✅ |
| Text3D | Text3DActor | ✅ | ✅ |
| Sound | AmbientSound | ✅ | ✅ |
| Canvas | MaterialInstanceDynamic | ✅ | ❌ |
| WebUI | MaterialInstanceDynamic | ✅ | ❌ |
| SceneCapture | MaterialInstanceDynamic | ✅ | ❌ |
| Blueprint | Actor | ✅ | ✅ |
| Widget | Widget | ✅ | ❌ |
| Base Actor | Actor | ✅ | ✅ |
| Player | PlayerController | ✅ | ❌ |
| Image Path | Texture2D | ✅ | ❌ |
| string | Class | ✅ | ❌ |
steam-avatar:// | MaterialInstanceDynamic | ✅ | ❌ |
| table | CurveFloat | ✅ | ❌ |
| table | Transform | ✅ | ✅ |
| table | SlateBrush | ✅ | ✅ |
| table | SlateFontInfo | ✅ | ✅ |
| table | Any Struct | ✅ | ✅ |
备注
只有当 Actor 是已被生成的实体时,才能将 Actor 从蓝图 → Lua 传递。无法将蓝图中新生成的 Actor 传递给 Lua。
提示
也支持传递 Maps、Arrays 和 Sets!只要它们的键/值包含在上述列表中。
任意结构体
自定义结构体也可以传递和接收,只需传递一个与虚幻结构体属性相同的对象即可,示例:
FTransform
{
["Translation"] = Vector(),
["Rotation"] = Rotator(),
["Scale"] = Vector()
}
FSlateBrush
{
["DrawAs"] = 0, -- ESlateBrushDrawType
["Tiling"] = 0, -- ESlateBrushTileType
["Mirroring"] = 0, -- ESlateBrushMirrorType
["ImageSize"] = Vector2D(),
["Tint"] = Color(),
["Image"] = "package://sandbox/Client/my_image.jpg", -- 特殊路径,或 Canvas、WebUI、SceneCapture
["Margin"] = {}, -- FMargin
["OutlineSettings"] = {} -- FSlateBrushOutlineSettings
}
FSlateFontInfo
{
["FontFamily"] = "package://my-package/Client/my_font.ttf", -- Special Path
["FontMaterial"] = "my-asset-pack::M_MyMaterial", -- Material Path
["OutlineSettings"] = {}, -- FSlateBrushOutlineSettings
["Typeface"] = "", -- string
["Size"] = 24,
["LetterSpacing"] = 0,
["SkewAmount"] = 0.0,
["Monospacing"] = false,
["MonospacedWidth"] = 1.0
}
FMargin
{
["Bottom"] = 0.0,
["Left"] = 0.0,
["Right"] = 0.0,
["Top"] = 0.0
}
FVector4
{
["W"] = 0.0,
["X"] = 0.0,
["Y"] = 0.0,
["Z"] = 0.0
}
UCurveFloat
{
[0.0] = 0.0,
[0.25] = 0.8,
[0.5] = 1.0,
[0.75] = 0.3,
[1.0] = 0.0,
}

