Now to implement player health that interacts with the UI to do this create a C# script in the script folder then drag the script onto the player in the hierarchy, in the components section of the player in the player health section you will see Health slider and damage image with None in the boxes next to them you need to click on the health slider in the hierarchy and drag it onto the box with none which will link the health slider component with the player health script do the same with the damage image box below by dragging the damage image from the hierarchy into the damage image none box to link it.
Posts
Showing posts from December, 2017
- Get link
- X
- Other Apps
Next will be creating the HUD so to start there’s a 2D button located at the top of the scene view which if you click on will change the view to that of 2D which is helpful for setting up the HUD. So, what we want to do is create a canvas which can be done by going the game object tab mouse over UI and clicking on canvas which will then place a canvas in the hierarchy after which rename it from canvas to HUDCanvas (heads up display). Then add a component called Canvas group which allows UI elements to have an alpha and whether their interactable, then uncheck the Block raycasts box. Then right click on HUDCanvas in the hierarchy tab and click create empty which will create a child and rename the gameobject to HealthUI, the benefits to doing it this way instead of creating an empty then linking it to the HUDCanvas is that if you create the child directly unity knows that your trying to add a new HUD element and gives it the rect transform instead of the normal transform. Now to m...
- Get link
- X
- Other Apps
I setup the main camera in an isometric way and to do that we want to use orthographic instead of perspective in the main camera inspector tab. So, in the transform section I set the position x=1, y=15 and z=-22. Then in the row below that, the rotation x=30, y=0 and z=0 after which we change the projection from perspective to orthographic and the size to 4.5 which should now be displayed in the game view tab. After that to make sure the background or the areas outside of the environment aren’t visible click on the colour block next to the background label in the inspector tab which should bring up a colour palette in which you can choose whatever colour you wish I chose black for mine. Next in the projects tab if you haven’t already make a scripts folder in the assets folder then make a camera folder if you want to keep things nice and tidy, then click on the create button and select C# script which will create something named NewBehaviourScript and is important to name the scripts ...