/// <summary> /// this is called by the surface manager to auto-create a decal manager /// in case there is none in the scene /// </summary> public static void AutoAddTo(GameObject target) { if (Instance != null) { Debug.LogError("Error (vp_DecalManager) Can't auto-add because there is already a vp_DecalManager in the scene."); return; } vp_DecalManager instance = target.AddComponent <vp_DecalManager>(); Instance = instance; instance.m_WasAutoAdded = true; m_HaveInstance = true; }
protected virtual void OnLevelWasLoaded() #endif { m_RenderersToQuickFade.Clear(); m_DecalsToRemoveWhenOffscreen.Clear(); m_DecalRenderers.Clear(); m_DecalMeshFilters.Clear(); m_Queue[0].Clear(); m_Queue[1].Clear(); m_Queue[2].Clear(); m_Queue[3].Clear(); Instance = null; m_HaveInstance = false; m_Inited = false; }
/// <summary> /// /// </summary> void Update() { // since this monobehaviour seems to be alive, make it the instance in case Instance // was cleared (e.g. by recent level loading) if (Instance == null) { Instance = this; m_HaveInstance = true; } UpdateQuadTest(); UpdateVertexTest(); UpdateRemoval(); UpdateQuickFading(); }
/// <summary> /// /// </summary> void Awake() { // create the vertex test queue lists m_Queue[0] = new List <DecalToCheckLater>(); m_Queue[1] = new List <DecalToCheckLater>(); m_Queue[2] = new List <DecalToCheckLater>(); m_Queue[3] = new List <DecalToCheckLater>(); if (Instance != null) { if (!Instance.m_WasAutoAdded) { Debug.LogWarning("Warning (" + this + ") There can only be one vp_DecalManager in the scene! (destroying self)"); } enabled = false; Destroy(this); return; } Instance = this; m_HaveInstance = true; }
/// <summary> /// hooks up the component object as the inspector target /// </summary> public virtual void OnEnable() { m_Component = (vp_DecalManager)target; }