Supporting Cancel
What if you move or scale or otherwise change the picture and don't like it? The toolbar has a Done
button; we should add a Cancel
button. Cancel
will reset the picture parameters to the values it had before this editing session started. This will be handed in the PictureController
component.
Presently, the attributes of the picture we've been editing are FramedImage Transform
. In Unity, you need to save them as three separate values for position, rotation, and scale. We will save the starting transform values when we begin editing, and restore them if we cancel editing.
At the top of the class, add the following to PictureController
:
File: PictureController.cs private Vector3 startPosition; private Vector3 startScale; private Quaternion startRotation;
Then add these helper functions:
private void SavePictureProperties() { startPosition = transform.localPosition; startScale = transform.localScale; startRotation = transform.localRotation...