private void OnSceneGUI() { Decal decal = target as Decal; if (decal != null && decal.transform.hasChanged) { if (decal.GetInstanceID() != lastInstanceID) { decal.GetComponent <MeshFilter>().sharedMesh = null; lastInstanceID = decal.GetInstanceID(); } UnityEngine.Profiling.Profiler.BeginSample("Decal"); decal.BuildDecal(); UnityEngine.Profiling.Profiler.EndSample(); decal.transform.hasChanged = false; } }