private void OnComponentDestroyed(SpriteGizmo gizmo) { gizmo.ComponentDestroyed -= OnComponentDestroyed; Destroy(gizmo); m_meshesCache.Remove(gizmo.Mesh, gizmo.transform); m_meshesCache.Refresh(); }
protected virtual void DestroyGizmo(GameObject go) { SpriteGizmo gizmo = go.GetComponent <SpriteGizmo>(); if (gizmo) { Destroy(gizmo); } }
protected virtual void DestroyGizmo(GameObject go) { SpriteGizmo gizmo = go.GetComponent <SpriteGizmo>(); if (gizmo) { Destroy(gizmo); m_meshesCache.Remove(gizmo.Mesh, gizmo.transform); } }
private void UnsubscribeAndDestroy() { Unsubscribe(); SpriteGizmo[] objs = Resources.FindObjectsOfTypeAll <SpriteGizmo>(); for (int j = 0; j < objs.Length; ++j) { SpriteGizmo obj = objs[j]; if (!obj.gameObject.IsPrefab()) { DestroyGizmo(obj.gameObject); } } }
protected virtual void GreateGizmo(GameObject go, Type type) { Material material; if (m_typeToMaterial.TryGetValue(type, out material)) { SpriteGizmo gizmo = go.GetComponent <SpriteGizmo>(); if (!gizmo) { gizmo = go.AddComponent <SpriteGizmo>(); } gizmo.Material = material; } }
protected virtual void GreateGizmo(GameObject go, Type type) { Tuple <Mesh, Material> tuple; if (m_typeToMeshAndMaterial.TryGetValue(type, out tuple)) { SpriteGizmo gizmo = go.GetComponent <SpriteGizmo>(); if (!gizmo) { gizmo = go.AddComponent <SpriteGizmo>(); } gizmo.Mesh = tuple.Item1; m_meshesCache.Add(gizmo.Mesh, gizmo.transform); m_meshesCache.SetMaterial(tuple.Item1, tuple.Item2); } }