Adding the Image menu
We also want the user to select from a menu of images to fill the frame. The Image
menu will be very similar to the Frame
menu, but we will make it a scrolling list so there can be more options than are visible in the menu.
SetImage in PictureController
The PictureController
will expose a method, SetImage()
, that takes a game object as a parameter using a texture that should be in the picture. And while you're at it, also add the IMAGE
command to activate the menu from the toolbar, and handle saving the initial texture to Cancel
, as we just did for Frames
.
Make the following additions to the PictureController.cs
script:
File: PictureController.cs
At the top of the class, add a public variable for the imageMenu
and a private variable for the image renderer:
public GameObject imageMenu; private Texture startTexture; private Renderer imageRenderer;
In the Start()
function, initialize the imageRenderer
:
Transform image = framedImage.Find("Image"); ...