Game.Prefabs.PathwayComposition
Assembly:
Assembly-CSharp (user/game scripts assembly; the exact assembly may differ depending on project build)
Namespace:
Game.Prefabs
Type:
struct (value type)
Base:
System.ValueType, implements Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter
Summary:
PathwayComposition is a simple ECS component (IComponentData) used to store a speed limit value for pathway prefabs. It is a plain, blittable struct suitable for use with Unity's DOTS/ECS systems and can be attached to entities representing pathway prefabs so game systems or mod code can read and/or modify the movement speed limit for that pathway.
Fields
public float m_SpeedLimit
Stores the speed limit value associated with the pathway. The consuming game/system decides the unit (check the relevant game modding docs or code — it might be in km/h or m/s depending on the system). Typical use: read to determine allowed speed on that pathway or write to change the limit. No validation is performed by this struct itself; clamp or validate in systems as needed.
Properties
- None. This type exposes a public field and has no properties.
Constructors
- None explicitly declared.
The struct uses the default parameterless constructor generated by C#. Construct with an object initializer when adding to an entity (example below).
Methods
- None. This type contains only data and no behavior.
Usage Example
// Add the component to an entity (setup/conversion code)
var entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
Entity pathwayEntity = entityManager.CreateEntity();
entityManager.AddComponentData(pathwayEntity, new PathwayComposition { m_SpeedLimit = 5f });
// Read / modify inside a SystemBase
protected override void OnUpdate()
{
// Example: ensure speed limits are non-negative
Entities
.ForEach((ref PathwayComposition pathway) =>
{
if (pathway.m_SpeedLimit < 0f)
pathway.m_SpeedLimit = 0f;
})
.ScheduleParallel();
}
// Query for entities having this component
EntityQuery query = GetEntityQuery(ComponentType.ReadOnly<PathwayComposition>());
Additional notes: - Because this is an IComponentData struct, it is intended to be lightweight and blittable for efficient use in jobs and ECS systems. - Implementing IQueryTypeParameter allows usage of the type in certain query/ForEach contexts (depending on DOTS/Entities version). - Validate units and expected ranges in consuming systems—this component does not enforce units or constraints itself.