Join Jesse Freeman for an in-depth discussion in this video Customizing the Button component, part of Unity 5: UI.
- Now let's take a look at how to connect our Button…to another script.…Inside of our Scripts folder, let's Create a new C# Script…called ButtonTest.…Then let's open this up in MonoDevelop.…Inside of this script, we're going to delete…the Start and Update methods.…In its place, we're going to create a public method…for OnClick.…Inside of this method, we'll log to the Console…that this Button has been clicked.…
Let's save our script and go back into Unity.…Next, let's Create an Empty GameObject.…And we're going to call this GameLogic.…For this example, we'll just pretend…that this GameLogic is our Master Class…that runs our entire game or it could just be…another GameObject somewhere else in your scene…that contains logic that your button needs to connect to.…Next, we're going to Add…our ButtonTest Component to it.…
And now let's take a look at our Button.…At the bottom of the Button component…in our Inspector, there's an On Click handler…which we can link to other scripts.…Right now, the List is Empty.…Let's click on the +.…
- Adding new components to the Canvas
- Working with RectTransforms
- Nesting UI elements
- Adding rich text and effects to the UI
- Creating images
- Styling UI buttons
- Handling input
- Creating sliders
- Controlling the layout of the screen
- Adding toggles and dropdowns
Skill Level Intermediate
1. The Canvas
2. Working with the RectTransform
3. Working with Text
4. Working with Images
5. Working with Buttons
6. Handling UI Input
7. Working with a Slider
8. Controlling Layout
9. Toggles, Dropdowns, and the Input Field
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.