Game.ActivityLocationElement
Assembly:
Assembly-CSharp (typical Unity game assembly; actual assembly may vary)
Namespace:
Game.Prefabs
Type:
struct (IBufferElementData)
Base:
Unity.Entities.IBufferElementData
Summary:
Represents a buffer element describing a single activity location for a prefab in the ECS world. Contains a reference to the prefab entity, which activities are possible at that location (mask/flags), the local/world transform (position and rotation), and an optional prop identifier. This struct is intended to be stored in a DynamicBuffer on an entity that aggregates multiple activity locations (for example, on a building or prop that offers multiple interaction points).
Fields
-
public Unity.Entities.Entity m_Prefab
Entity reference to the prefab associated with this activity location. Typically points to the prefab entity that should be instantiated or referenced for this location. -
public ActivityMask m_ActivityMask
Bitmask or similar structure indicating which activities are valid at this location. The exact semantics depend on the game's ActivityMask implementation (likely defined in Game.Rendering or related game code). -
public ActivityFlags m_ActivityFlags
Additional flags modifying behavior for the activity location (e.g., one-way, exclusive, orientation-dependent). See the ActivityFlags definition for concrete flag values. -
public Unity.Mathematics.float3 m_Position
Position of the activity location. Usually local-space or world-space depending on how the owning system interprets it (check the surrounding usage). Uses Unity.Mathematics.float3. -
public Unity.Mathematics.quaternion m_Rotation
Rotation of the activity location. Typically the orientation at which the prefab or agent should be placed or face. -
public AnimatedPropID m_PropID
Identifier for an animated prop (if any) associated with this location. Implementation details depend on AnimatedPropID type in the project.
Properties
- This type has no properties. It is a plain public struct used as a buffer element (fields are accessed directly).
Constructors
public ActivityLocationElement()
Structs in C# have an implicit parameterless constructor that zero-initializes all fields. There is no explicit constructor defined in the source. Initialize fields manually after creating an instance or when adding to a DynamicBuffer.
Methods
- This type defines no methods. It is a plain data container used with Unity's ECS buffer API.
Usage Example
// Example: adding an activity location to an entity's buffer in a SystemBase or ISystem
Entity owner = /* some entity that holds the buffer */;
var buffer = EntityManager.GetBuffer<ActivityLocationElement>(owner);
ActivityLocationElement element = new ActivityLocationElement
{
m_Prefab = prefabEntity,
m_ActivityMask = new ActivityMask(/* ... */),
m_ActivityFlags = ActivityFlags.None,
m_Position = new float3(1.0f, 0.0f, 2.0f),
m_Rotation = quaternion.EulerXYZ(new float3(0, math.radians(90f), 0)),
m_PropID = new AnimatedPropID(/* id data */)
};
buffer.Add(element);
// Reading through buffer
foreach (var loc in buffer)
{
// Use loc.m_Prefab, loc.m_Position, loc.m_Rotation, etc.
}
Additional notes: - The struct is annotated with [InternalBufferCapacity(0)] in source, meaning no internal stack storage is reserved — elements are stored on the heap/backing buffer. This is suitable when number of elements can vary or be large. - ActivityMask, ActivityFlags and AnimatedPropID are project-specific types (likely defined under Game.Rendering or related namespaces); consult their definitions to understand valid values and semantics.