Linking up the UI elements in Unity

Now back to Unity; we can assign the UI element components we just created to the elements in our hierarchy.

  1. In Hierarchy, select the Main Canvas/Content/Title Text.
  2. Drag the TitleText script onto its Inspector.
  3. In Hierarchy, select the Main Canvas/Content/Body Text.
  4. Drag the InstructionText script onto its Inspector.
  5. In Hierarchy, select the Main Canvas/Nav Panel/Step Text.
  6. Drag the StepText script onto its Inspector.

Save the scene and the project. Press Play in Unity. When you press Next and Previous, it should behave exactly as it did before. Only now we know that under the hood the code is so much cooler, and extendable.

Now, not only is our code much cleaner and more modular, it's also easier to add new content elements. Let's go ahead, and add images and videos.

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

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