Thursday 20 February 2020

Unity tutorial 04


Week 04 Unity
For this weeks Unity Tutorial it consisted of the following things  ,which were mainly script based and used a lot of what we learned from previous tutorials .

Tutorial 2.1 Player Positioning
For this tutorial I was tasked with played positioning which consisted of the following things
  • create a project for prototype 2 using unity hub and creating new project, importing prototype 2 starter files into unity and making sure my layout was set to default.
  • Adding the player, animal and food by dragging one human, three animals and one food into the hierarchy, renaming the character player and adjusting the XYZ scale of the food to be able to see above it.
  • Getting the user horizontal input  by creating a scripts folder and adding a player controller script inside it, Attach script to player before opening it , declare a new player flat horizontal input and then test that it works in the inspector tool.
  • Test moving player left to right and declare a new public float speed of 10.0f
  • Keeping the player inbound by writing an if statement indicating the players left x position,but fixed X
  • Cleaned up my code and variables by repeating this process to the right side of my screen
From following the method from the official unity learning site I found this one quite easy to follow overall

Tutorial 2.2 food flight
For this part of the assignment I was tasked with creating prefabs that would get destroyed when the player went out of bounds . I personally found this one to be quite difficult ,as I was having issues understanding the code ,particularly in launching the projectile  as I was having problems finding where to put the the initiate code, until I found the code on Unity.com
A photo of the code I was looking for take on my phone camera

But in the end by following the 9 steps from learn Unity.com  I figured out the issue quite quick and corrected my code issue with the right code.

Tutorial 2.3 Random Animal Stampede

For this final piece of work I had issues with the random spawn code , as I had to redo the code 3 times for it to finally work .what was strange about this issue was that the code was not identifying any issues even though it clearly was not working visually for me but in the end I feel I may have just gotten lucky or I somehow managed to fix it without realizing how.

Image Taken from my desktop



No comments:

Post a Comment