Game.Prefabs.ObjectSubObjectInfo
Assembly: Assembly-CSharp
Namespace: Game.Prefabs
Type: Class
Base: System.Object
Summary:
Serializable container used by object prefabs to describe a "sub-object" that is part of a parent object prefab. Each entry references another ObjectPrefab and contains transform and metadata used by the prefab system (position, rotation, which parent mesh it attaches to, grouping index, and placement probability). The class uses Unity.Mathematics types (float3, quaternion) and editor attributes (InputField, RangeN, Range) to control how values are edited in the game's prefab UI.
Fields
-
public ObjectPrefab m_Object
Reference to the nested/child object prefab to be placed as a sub-object. This is the prefab that will be instantiated/used by the parent object. -
[InputField] [RangeN(-10000f, 10000f, true)] public float3 m_Position
Local position of the sub-object relative to the parent object. Uses Unity.Mathematics.float3. The RangeN attribute indicates each component (x, y, z) is clamped to the provided bounds (here -10000..10000) and is exposed in the prefab editor as an input field. -
public quaternion m_Rotation
Local rotation of the sub-object, using Unity.Mathematics.quaternion. -
public int m_ParentMesh
Index of the parent mesh or attachment point on the parent object to which this sub-object is associated. Typically used by the prefab loader/placement logic to choose where to attach the sub-object. -
public int m_GroupIndex
Group index that can be used to group multiple sub-objects together (for selection, enabling/disabling, or mutual exclusivity as defined by the prefab system). -
[Range(0f, 100f)] public int m_Probability = 100
Placement probability (0–100) used when the prefab system decides whether to place this sub-object. Default value is 100 (always place).
Properties
This type does not declare any properties.
Constructors
public ObjectSubObjectInfo()
No explicit constructors are declared in the source; the class is serializable and uses the default parameterless constructor provided by the runtime. Fields will initialize to their default values (m_Probability defaults to 100 as set in the declaration).
Methods
This type does not declare any methods.
Usage Example
using Game.Prefabs;
using Unity.Mathematics;
// Create a sub-object entry for a prefab
var sub = new ObjectSubObjectInfo();
sub.m_Object = someOtherObjectPrefab; // reference to an ObjectPrefab
sub.m_Position = new float3(0f, 1.25f, 0f);
sub.m_Rotation = quaternion.EulerXYZ(new float3(0f, math.radians(45f), 0f));
sub.m_ParentMesh = 0; // attach to first mesh/attachment point
sub.m_GroupIndex = 1; // group id for grouping logic
sub.m_Probability = 80; // 80% chance to place this sub-object
Notes: - The class is marked [Serializable], so instances are serialized into prefab assets and edited via the prefab editor UI. - float3 and quaternion are from Unity.Mathematics (not UnityEngine.Vector3/Quaternion). - [InputField], [RangeN], and [Range] are editor attributes used by the game's UI/widget framework to present editable fields and enforce ranges in the editor.