Join Dan Violet Sagmiller for an in-depth discussion in this video Map and viewport, part of Build a Real-Time Strategy Game with Unity 5.
- [Voiceover] We have the map displayed.…Now we need to see where on the map we are.…That's what the viewport is for.…To generate a script that tells us what we're looking at,…we could do complex math calculations with a frustum…or since the camera is a top-down perspective,…we could simply transform the cameras…to the xz-plane into the map's 2D xy-plane,…and adjust for the size difference.…I'm going with that option.…To create the script, in my scripts folder,…I'm gonna create a new folder called Hud.…
In the Hud folder, I'll create a script called Map.…Now let's edit it.…I need a couple public variables.…To start out with, I need to know the…positioning and size of the viewport.…So I'm gonna say public RectTransform ViewPort…followed by public Transform…Corner1 and Corner2.…Corner1 and Corner2 are going to be positions,…game objects that we'll place that are empty…that show one corner of the terrain and the other.…
We could just get the size and dimensions of the terrain,…however, we might not be using the entire terrain.…
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
Unity 5: 2D Essential Training (2015)with Jesse Freeman3h 22m 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.