Use an AssetUtility to create instances of player and monster actor classes in your RPG. You’ll learn how to create an instance of a ScriptableObject at run time and clone it so you don’t accidentally change values while working on your game in Unity’s IDE.
- [Voiceover] So, now that we're able to create…our actor class, let's go in and take a look…at how we can use it inside of our engine.…Let's go to the battle system scripts folder,…and open up the actor class.…Now, whenever we work with scriptable objects,…we don't wanna use the actual object…that's inside of our asset folder.…When we're inside of the Unity editor,…sometimes you can corrupt the data by making changes…to the scriptable object instance,…and that will actually get saved back to the project.…So, inside of our game, we're gonna wanna create a clone…of the actor and use that inside of our battle system.…
Let's scroll to the bottom of our actor class…and create a new public method with a return type of T.…And we're gonna call this method Clone,…and pass in T, as the generic.…And after our parentheses, we'll write:…where T : Actor.…And then close our method.…Now, we'll be able to create a clone of our actor,…and if we ever extended the actor class,…we can still call the same clone method,…and return a base actor scriptable object.…
- Preparing the user interface
- Creating game and message windows
- Building a battle window
- Adding a monster and action buttons
- Creating an actor class
- Adding player and monster attack actions
- Triggering battles from the map
- Ending a battle
- Cleaning up the battle and attack systems
- Rewarding the player
Skill Level Intermediate
1. Preparing the UI
2. Message Window
3. The Battle Window
4. Actor Classes
5. Battle Actions
6. Cleaning Up Combat
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
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.