using System; using System.Collections.Generic; using Unity.Entities; using UnityEngine; using UnityEngine.Serialization; namespace UnityEngine.Perception.GroundTruth { /// /// Defines a set of labels associated with the object and its descendants. A Labeling component will override any Labeling components on the object's ancestors. /// public class Labeling : MonoBehaviour { /// /// The label names to associate with the GameObject. /// [FormerlySerializedAs("classes")] public List labels = new List(); Entity m_Entity; void Awake() { m_Entity = World.DefaultGameObjectInjectionWorld.EntityManager.CreateEntity(); World.DefaultGameObjectInjectionWorld.EntityManager.AddComponentObject(m_Entity, this); } void OnDestroy() { if (World.DefaultGameObjectInjectionWorld != null) World.DefaultGameObjectInjectionWorld.EntityManager.DestroyEntity(m_Entity); } } }