private void OnDestroy() { try { this.OnBecameInvisible(); } finally { this.contextRequestable = null; this.requestable = null; this.requestableVisibility = null; this.requestableIsVisibility = false; this.requestableStatus = null; this.requestableHasStatus = false; } }
private void Awake() { this.contextRequestable = this._contextRequestable; if (this.contextRequestable) { this._contextRequestable = null; } else { if (!this.SearchForContextRequestable(out this.contextRequestable)) { UnityEngine.Debug.LogError("Could not locate a IContextRequestable! -- destroying self.(component)", base.gameObject); UnityEngine.Object.Destroy(this); return; } UnityEngine.Debug.LogWarning("Please set the interface in inspector! had to search for it!", this.contextRequestable); } IContextRequestable contextRequestable = this.contextRequestable as IContextRequestable; IContextRequestable contextRequestable1 = contextRequestable; this.requestable = contextRequestable; if (contextRequestable1 == null) { UnityEngine.Debug.LogError("Context Requestable is not a IContextRequestable", base.gameObject); UnityEngine.Object.Destroy(this); return; } if (!base.transform.IsChildOf(this.contextRequestable.transform)) { UnityEngine.Debug.LogWarning(string.Format("Sprite for {0} is not a child of {0}.", this.contextRequestable), this); } this.requestableVisibility = this.contextRequestable as IContextRequestableVisibility; this.requestableIsVisibility = this.requestableVisibility != null; this.requestableStatus = this.contextRequestable as IContextRequestableStatus; this.requestableHasStatus = this.requestableStatus != null; MeshRenderer meshRenderer = this.renderer; MaterialPropertyBlock materialPropertyBlock = new MaterialPropertyBlock(); MaterialPropertyBlock materialPropertyBlock1 = materialPropertyBlock; this.materialProperties = materialPropertyBlock; meshRenderer.SetPropertyBlock(materialPropertyBlock1); }