主题
SimpleLineLight
概览
| 字段 | 值 |
|---|---|
| Kind | Unit · 单位 Unit |
| Realm | common |
继承关系
- Unit(5 属性 / 28 函数 / 6 事件)
- SimpleLight(7 属性)
- [SimpleLineLight](5 属性)
- SimpleLight(7 属性)
继承成员
2 个来源 / 12 属性 / 28 函数 / 6 事件
- 来自 SimpleLight(7 属性)
- 来自 Unit(5 属性 / 28 函数 / 6 事件)
- 属性:
AssetId、Name、Desc、Parent、Tags - 函数:
ClearAllChildren、GetChildren、GetDescendants、IsAncestorOf、IsDescendantOf、FindFirstAncestor、FindFirstAncestorWhichIsA、FindFirstAncestorOfClass、FindFirstChild、FindFirstChildWhichIsA、FindFirstChildOfClass、HasChildren、GetChildCount、GetChildAtIndex、SetAttribute、GetAttribute、GetAllProps、Clone、IsA、Destroy、GetPropertyChangedSignal、GetAttributeChangedSignal、FindFromPath、GetFullPath、GetDebugId、HasTag、AddTag、RemoveTag - 事件:
ChildAdded、ChildRemoved、DescendantAdded、DescendantRemoving、AncestryChanged、Destroying
- 属性:
SimpleLineLight 是支持两端颜色渐变的线状装饰性自发光体;它呈现发光外观,但不会照亮周围物体。
适用场景
用于霓虹灯管、光剑、灯带或建筑轮廓等线状自发光装饰。
使用要点
通过 World:CreateUnit("SimpleLineLight", config) 创建实例,用 Color/Color2 设置两端颜色,并用 Pivot、Radius 和 Brightness 调整外观。
注意事项
当前运行包实测 SimpleLineLight 即使创建后挂到 WorldUnit 也没有视觉表现,且公开 API 未说明可用的光照挂载结构。以下代码只展示属性形态,不能作为可见效果验收;在引擎补齐挂载契约或可用预设前,不建议用于正式内容。
代码示例
创建双色线光源
lua
-- @runtime server
local world = game:GetService("World")
local light = world:CreateUnit("SimpleLineLight", {
Position = Vector3.New(-5, 3, 0),
Brightness = 3.0,
Color = Color.New(0, 255, 0, 255),
Color2 = Color3.New(0, 0, 255),
Radius = 8.0,
Pivot = 0.5,
})
light.Pivot = 1.0
print("SimpleLineLight:", light)属性 (5)
| Name | 类型 | 默认值 | 说明 |
|---|---|---|---|
Brightness | Float | 1.0 | 线状自发光体自身的亮度。 |
Color | Color3 | Color3.New(255, 255, 255) | Color 是 SimpleLineLight 的颜色属性,类型为 Color3,可读取也可写入,用于表示该线光源实例当前使用的颜色值。 |
Color2 | Color3 | Color3.New(255, 255, 255) | Color2 是 SimpleLineLight 的第二个颜色属性,类型为 Color3,可读取也可写入,与 Color 并列作为该实例的两个颜色字段。 |
Radius | Float | 5.0 | 控制线状自发光外观半径的参数,不表示真实照明影响范围。 |
Pivot | Float | 0.5 | 线性光源的中间点位置,取值范围 0 到 1,表示光源从起点到终点的比例位置。 |
