Join Dan Violet Sagmiller for an in-depth discussion in this video Unit tracking, part of Build a Real-Time Strategy Game with Unity 5.
- [Voiceover] We need to start keeping track…of player units.…So it'll be less costly to do checks for things,…such as visibility.…To do this, I'm first going to go…into the PlayerSetupDefinition.…So in the PlayerSetupDefinition…we find we have a list of starting points.…Well, we'll also want to keep track…of all the active units.…So I'm going to say private List…lower-case activeUnits = new.…
Now why private?…Because I don't want the designer…to be able to edit these in game.…However we do want other code…to be able to have access to this.…So I'm going to create a getter…since the inspector can't see that.…public List…capital ActiveUnits.…And it's getter…will return lower-case activeUnits.…Now that we have that in place,…we need some way for the player…to automatically know that a new unit has been added.…
We don't want to have to check for that…every single time something wants to know…what units belong to a player.…So to keep track of that…I'm going to the Player.cs model behavior.…This gets added to every single unit in the game.…
AuthorDan Violet Sagmiller
- Adding player positions and start info
- Loading prebuilt levels
- Adding camera moves
- Adding a unit
- Supporting navigation
- Adding unit owners and player objects
- Importing and setting up a HUD map
- Adding unit info and credits
- Creating HUD actions
- Building a command base
- Adding artificial intelligence
- Adding battle actions
Skill Level Intermediate
1. Initial Setup
2. Adding a Unit
3. Navigation Mesh
4. Unit Owner
5. HUD Map
6. Unit Info & Credits
7. HUD Actions
8. Command Base
9. Base AI
- 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.