public void Start() { if (get != null && get != this) { StackTraceLogType saveType = Application.GetStackTraceLogType(LogType.Warning); Application.SetStackTraceLogType(LogType.Warning, StackTraceLogType.None); Debug.LogWarning("LowPoly_PlanarReflection script is already asigned to '" + get.gameObject.name + "'", get.gameObject); Application.SetStackTraceLogType(LogType.Warning, saveType); enabled = false; return; } else { get = this; } if (targetMaterial == null) { Renderer r = GetComponent <Renderer>(); if (r != null) { targetMaterial = r.sharedMaterial; } } if (targetMaterial == null) { enabled = false; Debug.LogWarning("LowPoly_PlanarReflection: Target material is not defined."); } }
void OnDisable() { get = null; if (m_ReflectionCamera != null) { DestroyImmediate(m_ReflectionCamera.gameObject); } }
void OnEnable() { if (get != null && get != this) { StackTraceLogType saveType = Application.GetStackTraceLogType(LogType.Warning); Application.SetStackTraceLogType(LogType.Warning, StackTraceLogType.None); Debug.LogWarning("LowPoly_PlanarReflection script is already asigned to '" + get.gameObject.name + "'", get.gameObject); Application.SetStackTraceLogType(LogType.Warning, saveType); enabled = false; return; } else { get = this; } }