//private static void HackWalkTransforms(Transform transform, int p) //{ // StringBuilder sb = new StringBuilder(p + 3); // for (int i = 0; i < p; ++i) // { // sb.Append(" "); // } // sb.Append("+"); // sb.Append(transform.name); // Utility.LogMessage(transform, "{0} @ ({1:0.0}, {2:0.0}, {3:0.000}) face ({4:0.0}, {5:0.0}, {6:0.0})", sb.ToString(), transform.position.x, transform.position.y, transform.position.z, transform.eulerAngles.x, transform.eulerAngles.y, transform.eulerAngles.z); // for (int i = 0; i < transform.childCount; ++i) // { // HackWalkTransforms(transform.GetChild(i), p + 1); // } //} /// <summary> /// Tear things down /// </summary> public void OnDestroy() { Camera.onPreCull -= EnablePage; Camera.onPostRender -= DisablePage; if (screenCamera != null) { screenCamera.targetTexture = null; } if (screen != null) { screen.Release(); screen = null; } if (initialized) { variableRegistrar.ReleaseResources(); MASFlightComputer comp = MASFlightComputer.Instance(internalProp.part); foreach (var value in page.Values) { value.ReleaseResources(comp, internalProp); } page.Clear(); comp.UnregisterMonitor(monitorID, internalProp, this); GameObject.DestroyObject(screenSpace); screenSpace = null; screenCamera = null; } }
/// <summary> /// Unregister the variable callback. /// </summary> public void OnDestroy() { try { // I've seen this get destroyed when the game was exiting, so // there was an instance floating around somewhere for some // reason. So try/catch to suppress exceptions. variableRegistrar.ReleaseResources(); } catch { } }
/// <summary> /// Notify children to release resources prior to being freed. /// </summary> /// <param name="comp"></param> internal void ReleaseResources(MASFlightComputer comp, InternalProp internalProp) { variableRegistrar.ReleaseResources(); int numComponents = component.Count; for (int i = 0; i < numComponents; ++i) { component[i].ReleaseResources(comp, internalProp); } component.Clear(); }
/// <summary> /// Unsubscribe from the property callbacks for this shader mode. /// </summary> public void UnregisterShaderProperties() { variableRegistrar.ReleaseResources(); }