所有渲染器的通用功能。
渲染器是使对象显示在屏幕上的组件。使用此类访问任何对象、网格或粒子系统的渲染器。可以禁用渲染器以使对象不可见(请参阅 enabled),并且可以通过它们访问和修改材质(请参阅 material)。
其他资源:网格、粒子、线条和轨迹的渲染器组件。
allowOcclusionWhenDynamic | 控制是否应为此渲染器执行动态遮挡剔除。 |
bounds | 渲染器在世界空间中的边界框。 |
enabled | 如果启用,则使渲染的 3D 对象可见。 |
forceRenderingOff | 允许关闭特定组件的渲染。 |
isLOD0 | 渲染器是否为其组中的第一个 LOD 级别。 |
isPartOfStaticBatch | 指示渲染器是否与其他渲染器一起属于静态批处理的一部分。 |
isVisible | 此渲染器在任何摄像机中是否可见?(只读) |
lightmapIndex | 应用于此渲染器的烘焙光照贴图的索引。 |
lightmapScaleOffset | 用于光照贴图的 UV 比例和偏移。 |
lightProbeProxyVolumeOverride | 如果设置,Renderer 将使用附加到源 GameObject 的光探针代理体积组件。 |
lightProbeUsage | 光探针插值类型。 |
localBounds | 渲染器在局部空间中的边界框。 |
localToWorldMatrix | 将点从局部空间转换到世界空间的矩阵 (只读)。 |
LODGroup | 此渲染器的 LODGroup。 |
material | 返回分配给渲染器的第一个实例化材质。 |
materials | 返回此对象的所有实例化材质。 |
motionVectorGenerationMode | 指定运动矢量渲染模式。 |
probeAnchor | 如果设置,Renderer 将使用此 Transform 的位置查找光探针或反射探针。 |
rayTracingAccelerationStructureBuildFlags | Unity 在构建与渲染器使用的几何体关联的加速结构时使用的标志。 |
rayTracingAccelerationStructureBuildFlagsOverride | 是否覆盖创建 RayTracingAccelerationStructure 时指定的默认构建标志。 |
rayTracingMode | 描述此渲染器如何更新以进行光线追踪。 |
realtimeLightmapIndex | 应用于此渲染器的实时光照贴图的索引。 |
realtimeLightmapScaleOffset | 用于实时光照贴图的 UV 比例和偏移。 |
receiveShadows | 此对象是否接收阴影? |
reflectionProbeUsage | 是否应为此渲染器使用反射探针? |
rendererPriority | 此值按优先级对渲染器进行排序。较低的值先渲染,较高的值后渲染。 |
renderingLayerMask | 如果使用可脚本化的渲染管道,则确定此渲染器所在的渲染层。 |
shadowCastingMode | 此对象是否投射阴影? |
sharedMaterial | 此对象的共享材质。 |
sharedMaterials | 此对象的所有共享材质。 |
sortingLayerID | 渲染器排序层的唯一 ID。 |
sortingLayerName | 渲染器排序层的名称。 |
sortingOrder | 渲染器在排序层中的顺序。 |
staticShadowCaster | 此渲染器是否为静态阴影投射器? |
worldToLocalMatrix | 将点从世界空间转换到局部空间的矩阵 (只读)。 |
GetClosestReflectionProbes | 返回具有权重的最近反射探针数组,权重显示探针对渲染器的影响程度,此值也用于发生反射探针混合时。 |
GetMaterials | 返回此对象的所有实例化材质。 |
GetPropertyBlock | 获取每个渲染器或每个材质的属性块。 |
GetSharedMaterials | 返回此对象的所有共享材质。 |
HasPropertyBlock | 如果 Renderer 通过 SetPropertyBlock 附加了材质属性块,则返回 true。 |
ResetBounds | 重置自定义世界空间边界。 |
ResetLocalBounds | 重置自定义局部空间边界。 |
SetMaterials | 使用提供的材质列表分配此对象的共享材质。 |
SetPropertyBlock | 允许您设置或清除每个渲染器或每个材质的参数覆盖。 |
SetSharedMaterials | 使用提供的材质列表分配此对象的共享材质。 |
OnBecameInvisible | 当对象不再被任何摄像机看到时调用 OnBecameInvisible。 |
OnBecameVisible | 当对象被任何摄像机看到时调用 OnBecameVisible。 |
gameObject | 此组件所附加到的游戏对象。组件始终附加到游戏对象。 |
tag | 此游戏对象的标签。 |
transform | 附加到此 GameObject 的 Transform。 |
hideFlags | 对象是否应隐藏、与场景一起保存或用户可修改? |
name | 对象的名称。 |
BroadcastMessage | 在此游戏对象或其任何子对象中的每个 MonoBehaviour 上调用名为 methodName 的方法。 |
CompareTag | 将 GameObject 的标签与定义的标签进行比较。 |
GetComponent | 获取与指定组件相同的 GameObject 上类型为 T 的组件的引用。 |
GetComponentInChildren | 获取与指定组件相同的 GameObject 上类型为 T 的组件的引用,或 GameObject 的任何子对象。 |
GetComponentIndex | 获取组件在其父 GameObject 上的索引。 |
GetComponentInParent | 获取与指定组件相同的 GameObject 上类型为 T 的组件的引用,或 GameObject 的任何父对象。 |
GetComponents | 获取与指定组件相同的 GameObject 上所有类型为 T 的组件的引用。 |
GetComponentsInChildren | 获取与指定组件相同的 GameObject 上所有类型为 T 的组件的引用,以及 GameObject 的任何子对象。 |
GetComponentsInParent | 获取与指定组件相同的 GameObject 上所有类型为 T 的组件的引用,以及 GameObject 的任何父对象。 |
SendMessage | 在此游戏对象中的每个 MonoBehaviour 上调用名为 methodName 的方法。 |
SendMessageUpwards | 在此游戏对象中的每个 MonoBehaviour 以及行为的每个祖先上调用名为 methodName 的方法。 |
TryGetComponent | 获取指定类型的组件(如果存在)。 |
GetInstanceID | 获取对象的实例 ID。 |
ToString | 返回对象的名称。 |
Destroy | 移除 GameObject、组件或资源。 |
DestroyImmediate | 立即销毁对象 obj。强烈建议使用 Destroy 代替。 |
DontDestroyOnLoad | 加载新场景时不要销毁目标对象。 |
FindAnyObjectByType | 检索类型为 type 的任何活动的加载对象。 |
FindFirstObjectByType | 检索类型为 type 的第一个活动的加载对象。 |
FindObjectsByType | 检索类型为 type 的所有加载对象的列表。 |
Instantiate | 克隆对象 original 并返回克隆。 |
InstantiateAsync | 捕获原始对象(必须与某些 GameObject 相关)的快照,并返回 AsyncInstantiateOperation。 |
bool | 对象是否存在? |
operator != | 比较两个对象是否引用不同的对象。 |
operator == | 比较两个对象引用以查看它们是否引用同一对象。 |
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.