using UnityEngine; using UnityEngine.Serialization; namespace UnityEngine.ProBuilder { /// /// Provides some additional functionality to GameObjects, like managing visiblity and colliders. /// [DisallowMultipleComponent] [AddComponentMenu("")] sealed class Entity : MonoBehaviour { public EntityType entityType { get { return m_EntityType; } } [SerializeField] [HideInInspector] [FormerlySerializedAs("_entityType")] EntityType m_EntityType; /// /// Performs Entity specific initialization tasks (turn off renderer for nodraw faces, hide colliders, etc) /// public void Awake() { MeshRenderer mr = GetComponent(); if (!mr) return; switch (entityType) { case EntityType.Occluder: break; case EntityType.Detail: break; case EntityType.Trigger: mr.enabled = false; break; case EntityType.Collider: mr.enabled = false; break; } } /// /// Set the entity type. /// /// public void SetEntity(EntityType t) { m_EntityType = t; } } }