Skip to content

Game.Rendering.ObjectProperty

Assembly: (not specified — likely the game's runtime assembly, e.g., Assembly-CSharp or Game)
Namespace: Game.Rendering

Type: enum

Base: System.Enum (underlying type: System.Int32)

Summary:
ObjectProperty is an enum used by the rendering system to identify per-instance shader properties. Each enum member is annotated with an InstanceProperty attribute that maps the enum value to a GPU/shader property name, the CLR type used for that property (Unity.Mathematics float, float2, float3, float4), the BatchFlags category used for batching, an index (for repeated property names used as arrays), and a boolean indicating if the property is used by the outline pass. These mappings are typically read by the renderer or by tooling to build per-instance buffers and bind correct shader properties.


Fields

  • AnimationCoordinate
    Maps to shader property "_TextureCoordinate" (type: float3). BatchFlags: Animated. Index: 0. Not used for outline.

  • BoneParameters
    Maps to shader property "colossal_BoneParameters" (type: float2). BatchFlags: Bones. Index: 0. Not used for outline.

  • LightParameters
    Maps to shader property "colossal_LightParameters" (type: float2). BatchFlags: Emissive. Index: 0. Not used for outline.

  • ColorMask1
    Maps to shader property "colossal_ColorMask0" (type: float4). BatchFlags: ColorMask. Index: 0. Not used for outline.

  • ColorMask2
    Maps to shader property "colossal_ColorMask1" (type: float4). BatchFlags: ColorMask. Index: 0. Not used for outline.

  • ColorMask3
    Maps to shader property "colossal_ColorMask2" (type: float4). BatchFlags: ColorMask. Index: 0. Not used for outline.

  • InfoviewColor
    Maps to shader property "colossal_InfoviewColor" (type: float2). BatchFlags: InfoviewColor. Index: 0. Not used for outline.

  • BuildingState
    Maps to shader property "colossal_BuildingState" (type: float4). BatchFlags: none (0). Index: 0. Not used for outline.

  • OutlineColors
    Maps to shader property "_Outlines_Color" (type: float4). BatchFlags: Outline. Index: 0. Marked as used for outline (true).

  • LodFade0
    Maps to shader property "colossal_LodFade" (type: float). BatchFlags: LodFade. Index: 0. Not used for outline.

  • LodFade1
    Maps to shader property "colossal_LodFade" (type: float). BatchFlags: LodFade. Index: 1. Not used for outline.

  • MetaParameters
    Maps to shader property "colossal_MetaParameters" (type: float). BatchFlags: BlendWeights. Index: 0. Not used for outline.

  • SurfaceWetness
    Maps to shader property "colossal_Wetness" (type: float4). BatchFlags: SurfaceState. Index: 0. Not used for outline.

  • SurfaceDamage
    Maps to shader property "colossal_Damage" (type: float4). BatchFlags: SurfaceState. Index: 0. Not used for outline.

  • BaseState
    Maps to shader property "colossal_BaseState" (type: float). BatchFlags: Base. Index: 0. Not used for outline.

  • Count
    Represents the number of defined entries in the enum (useful for sizing arrays or iterating).

Properties

  • None. This enum contains only named constants (no instance properties).

Constructors

  • None (enums do not expose public constructors). Values are compile-time constants.

Methods

  • None (no custom methods are defined on this enum).

Usage Example

Below is a robust example that reads the InstanceProperty attribute data via reflection (uses CustomAttributeData to avoid relying on specific attribute property names):

using System;
using System.Linq;
using System.Reflection;

public static void PrintInstancePropertyData(ObjectProperty prop)
{
    var member = typeof(ObjectProperty).GetMember(prop.ToString())[0];
    var cad = member.GetCustomAttributesData()
                    .FirstOrDefault(a => a.AttributeType.Name == "InstancePropertyAttribute");
    if (cad == null)
    {
        Console.WriteLine($"{prop}: no InstanceProperty attribute found.");
        return;
    }

    var name = cad.ConstructorArguments[0].Value as string;
    var type = cad.ConstructorArguments[1].Value as Type;
    var flags = cad.ConstructorArguments[2].Value; // BatchFlags value (boxed)
    var index = cad.ConstructorArguments[3].Value;
    var forOutline = cad.ConstructorArguments[4].Value;

    Console.WriteLine($"{prop}: shaderName={name}, type={type}, flags={flags}, index={index}, outline={forOutline}");
}

// Example usage:
PrintInstancePropertyData(ObjectProperty.AnimationCoordinate);

Notes: - Unity.Mathematics types used in the attribute are float, float2, float3, float4. - BatchFlags is a separate enum used for grouping instance properties into GPU-friendly batches (Animated, Bones, Emissive, ColorMask, InfoviewColor, Outline, LodFade, BlendWeights, SurfaceState, Base, etc.). - The enum-to-shader mapping is intended for the renderer to prepare per-instance data and bind the correct shader property names and types.