The FrameMenu object and component

The FrameMenu object is an empty game object container that will have its selected option objects as children.

  1. In Hierarchy, under DefaultPicture, click Create Empty game object and name it FrameMenu.
  2. Set its Position (0, -0.5, -0.1) so it's at the bottom of the picture and a little in the front.
  3. Now we write the FrameMenu script component. In your Scripts folder, create a C# script named FrameMenu and open it for editing:
    File: FrameMenu.cs
    using UnityEngine; public class FrameMenu : PictureMenu { public override void InitMenu() { } public override void BeginEdit() { } public override void ObjectClicked(GameObject clickedGameObject) { GameObject frame = clickedGameObject.transform.GetChild(0).gameObject; picture.SetFrame(frame); DoneEdit(); // close menu when one pic is picked } }

    The FrameMenu class is derived from PictureMenu, which we wrote earlier. It doesn't do much. The InitMenu and BeginEdit functions do nothing. The ObjectClicked gets the frame game object and passes it to the controller SetFrame. Then the menu is closed by calling DoneEdit.

    ..................Content has been hidden....................

    You can't read the all page of ebook, please click here login for view all page.
    Reset