Skip to main content

Attributes

The framework uses several attributes to achieve type safe and user friendly experience.

SteeringEntityTagAttribute

Marks a tag component to show up in the editor window for SteeringSystemAsset and inspector of SteeringEntityAuthoring.

SampleEntityTag.cs
[SteeringEntityTag] // Lets the editor find this tag. 
public struct SampleEntityTagComponent : IComponentData {}

JobWrapperAttribute

Declares that a job wrapper requires an entity to have a specific component. Used when implementing a behavior, query or a merger. In case of INeighborBehaviorJobWrapper, the second parameter declares which component the neighbor should have. There are also overloads to handle arrays of components. The component dependencies can then be displayed and resolved in the editor.

MultiHomingJobWrapper.cs
// Lets the editor know that main entities need MultiHomingComponent and neighbors need HomeComponent
[JobWrapper(typeof(MultiHomingComponent), typeof(HomeComponent))]
public class MultiHomingJobWrapper : INeighborBehaviorJobWrapper { }

OutDataAttribute

This attribute should mark all behavior job wrappers and the merger. For behaviors, it declares type of data structure the behavior allocates and writes results to. In case of the merger, it declares which type(s) of data structure(s) returned from the behavior job wrappers it can accept. After selecting a merger in the editor, all dropdowns are refreshed to only offer behaviors whose output result type is compatible with the merger.

MultiHomingJobWrapper.cs
// Lets the editor know that this behavior outputs VelocityResults
[OutData(typeof(VelocityResults))]
public class MultiHomingJobWrapper : INeighborBehaviorJobWrapper { }
CombineVelocitiesJobWrapper.cs
// Lets the editor know that this merger accepts VelocityResults
[OutData(typeof(VelocityResults))]
public class CombineVelocitiesJobWrapper : IMergeJobWrapper { }

ComponentAuthoringAttribute

Declares that a MonoBehaviour authoring X authors a specific IComponentData component T. When the editor shows that there is a missing component of type T on the entity, it can find the authoring X which declares authoring T. When the plus or minus is clicked on the component T, the editor knows it should add or remove X from the entity.

DebugSimpleAuthoring.cs
// Lets the editor match `DebugSimpleAuthoring` with `DebugSimpleComponent`
[ComponentAuthoring(typeof(DebugSimpleComponent))]
public class DebugSimpleAuthoring : MonoBehaviour
{
public DebugSimpleComponent DebugSimpleComponent;
}