Deleting a picture
Deleting the picture that is being edited is straightforward. We just need to destroy the currentPicture
GameObject and go back to Main-mode. Perform the following steps:
- Open the
EditPictureMode
script and add the following function:public void DeletePicture() { GameObject.Destroy(currentPicture.gameObject); InteractionController.EnableMode("Main"); }
- Save the script.
- In Unity, in the Hierarchy window, select Remove Button (located under UI Canvas | EditPicture UI | Edit Menu).
- In the Inspector, click the + button at the bottom right of the Button | OnClick area.
- Drag the EditPicture Mode object from the Hierarchy window onto the OnClick Object slot.
- From the function selection, choose EditPictureMode | DeletePicture.
When you play the scene, create a...