// Ensures that the sprite is updated in the scene view // while editing: public override void DoMirror() { // Only run if we're not playing: if (Application.isPlaying) { return; } // This means Awake() was recently called, meaning // we couldn't reliably get valid camera viewport // sizes, so we zeroed them out so we'd know to // get good values later on (when OnDrawGizmos() // is called): if (screenSize.x == 0 || screenSize.y == 0) { base.Start(); } if (mirror == null) { mirror = new SimpleSpriteMirror(); mirror.Mirror(this); } mirror.Validate(this); // Compare our mirrored settings to the current settings // to see if something was changed: if (mirror.DidChange(this)) { Init(); mirror.Mirror(this); // Update the mirror } }
// Ensures that the sprite is updated in the scene view // while editing: public override void DoMirror() { // Only run if we're not playing: if (Application.isPlaying) return; // This means Awake() was recently called, meaning // we couldn't reliably get valid camera viewport // sizes, so we zeroed them out so we'd know to // get good values later on (when OnDrawGizmos() // is called): if (screenSize.x == 0 || screenSize.y == 0) base.Start(); if (mirror == null) { mirror = new SimpleSpriteMirror(); mirror.Mirror(this); } mirror.Validate(this); // Compare our mirrored settings to the current settings // to see if something was changed: if (mirror.DidChange(this)) { Init(); mirror.Mirror(this); // Update the mirror } }