Game.Prefabs.SpawnLocationData
Assembly: Assembly-CSharp.dll
Namespace: Game.Prefabs
Type: struct
Base: System.ValueType
Implements: Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter
Summary:
SpawnLocationData is an ECS component used on prefab spawn-location entities to describe how and where units/vehicles/agents can spawn or wait. It encodes the allowed connection type, which activities are permitted at this location, compatible track and road types, and simple behavioral flags such as whether authorization is required or whether spawned units should hang around on the lane. Modders use this component to control spawn rules for transport/stopping points and similar prefab features.
Fields
-
public RouteConnectionType m_ConnectionType
Defines the connection type expected at the spawn location (for example road, rail, pedestrian link, etc.). Used to match spawn points to appropriate network lanes/connections. Set to the RouteConnectionType value that corresponds to the network the prefab should connect to. -
public ActivityMask m_ActivityMask
A bitmask describing which activities (services or behaviors) are allowed at this spawn location (for example boarding, alighting, waiting, transferring). Combine flags in ActivityMask to restrict or permit specific activity types at this spawn point. -
public TrackTypes m_TrackTypes
Specifies which track types (if any) are acceptable for this spawn location (e.g., tram, metro, elevated). Used when the spawn location is intended to interact with rail/track networks. -
public RoadTypes m_RoadTypes
Specifies acceptable road types for this spawn location (e.g., highway, city street). Controls compatibility with different road networks when matching lanes or connections. -
public bool m_RequireAuthorization
If true, spawn at this location requires authorization (for example, a permit, station access control or other authorization check). If false, spawns are allowed without additional checks. -
public bool m_HangaroundOnLane
If true, spawned entities that cannot immediately enter their destination may "hang around" (idle) on the lane rather than despawn or teleport away. Useful for modeling waiting behavior at stops or staging lanes.
Properties
- This type declares no properties. It is a plain IComponentData struct with public fields.
Constructors
public SpawnLocationData()
Default parameterless struct constructor. All enum fields default to their zero value; booleans default to false. Typically you create and set fields explicitly when assigning the component.
Methods
- This type defines no methods. It is a data-only component used by systems that query IComponentData of this type.
Usage Example
// Example: add spawn location data to an entity (EntityManager context)
var spawnData = new Game.Prefabs.SpawnLocationData
{
m_ConnectionType = RouteConnectionType.Road, // choose an appropriate enum value
m_ActivityMask = ActivityMask.Boarding | ActivityMask.Waiting,
m_TrackTypes = TrackTypes.None, // no track required
m_RoadTypes = RoadTypes.CityStreet,
m_RequireAuthorization = false,
m_HangaroundOnLane = true
};
entityManager.AddComponentData(spawnEntity, spawnData);
// Alternatively, in a conversion system you might create this component on the converted entity:
public class SpawnLocationAuthoring : MonoBehaviour, IConvertGameObjectToEntity
{
public RouteConnectionType connectionType;
public ActivityMask activityMask;
public TrackTypes trackTypes;
public RoadTypes roadTypes;
public bool requireAuthorization;
public bool hangaroundOnLane;
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
{
var data = new Game.Prefabs.SpawnLocationData
{
m_ConnectionType = connectionType,
m_ActivityMask = activityMask,
m_TrackTypes = trackTypes,
m_RoadTypes = roadTypes,
m_RequireAuthorization = requireAuthorization,
m_HangaroundOnLane = hangaroundOnLane
};
dstManager.AddComponentData(entity, data);
}
}
Notes: - The enumerations RouteConnectionType, ActivityMask, TrackTypes, and RoadTypes are defined elsewhere in the game code; consult their definitions to choose appropriate flags/values. - Because this is an IComponentData struct, systems operate on its raw fields; changing values at runtime should be done via EntityManager/System methods respecting ECS/job safety.