Selecting an object from Edit mode
When in Edit-mode for one picture, to let the user choose a different picture without exiting Edit-mode, we can use the same SelectObject input action we used in Main-mode. In fact, the code is mostly the same. Open the EditPictureMode
script for editing and make the following changes:
- We're going to listen for Input System events, so to begin, we need to add a
using
statement for that namespace. Ensure the following line is at the top of the file:using UnityEngine.InputSystem;
- Add a private
camera
variable at the top of the class and initialize it inStart
:Camera camera; void Start() { camera = Camera.main; }
- The
OnSelectObject
action listener will callFindObjectToEdit
. Like inGalleryMainMode
, it does a Raycast on thePlacedObjects
layer. But now, we must check whether it has hit an...