Join Jesse Freeman for an in-depth discussion in this video Pick GameObjects using selection fields, part of Building Custom Tools to Extend the Unity IDE.
- [Voiceover] Now, let's talk about creating object fields…that allow us to select either things…within the Asset folder or other Game Objects in the Scene.…We'll need to open up our HelloWorldEditor script…inside of MonoDevelop.…Below where we set our speed, let's reference…the scripts target field and set it…to an EditorGUILayout.ObjectField.…We'll give it the label Target.…We'll pass in the default value, which'll be script.target.…
Next, we'll need to give it a type.…Here, we'll use typeof and we'll use the type GameObject,…and finally, we'll pass in the value true.…This bouillon allows us to choose options from the Scene.…If we set this to false, we'd only…be able to pick objects from the Asset folder.…Now, let's close this method, and at the end of it,…we're gonna cast it as a GameObject.…Since we know that we're filtering…for types of Game Objects, it's safe for us…to recast the return value as a GameObject…so that we can save it inside of our Target field.…
The ObjectField by default will return a generic object.…
- Exposing variables to the Inspector
- Providing attributes to Inspector fields
- Extending the base editor
- Creating custom UI elements
- Modifying the layout of a custom editor
- Building a custom window
- Saving and loading data
- Creating a reorderable list
- Skinning custom inspectors
- Exporting assets as Unity packages
Skill Level Intermediate
Unity 5: 2D Essential Training (2015)with Jesse Freeman3h 22m Intermediate
Unity 5: 2D Generate Procedural Terrainwith Dan Violet Sagmiller4h 4m Intermediate
Game Design Careers with Brenda Romerowith Brenda Romero54m 41s Beginner
1. Introduction to the Inspector
2. Build Custom Editors in Unity
3. Create Custom UI Elements in Unity
4. Build a Custom Window in Unity
5. Saving and Loading Data in Unity
6. Advanced UI
7. Skinning Custom Inspectors
8. Export Custom Code
Code organization4m 35s
- 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.