Showing posts with label Unity Tutorials. Show all posts
Showing posts with label Unity Tutorials. Show all posts

Wednesday, 4 March 2020

Unity Tutorial 06

We are now starting a new Unity Tutorial. This time the outcome of the game is that the player will be able to press spacebar and make the character jump, as obstacles spawn at the edge of the screen and block the player’s path. Then we will make the background move flawlessly at the same time as the obstacles, and the obstacles will de-spawn when they exit game boundaries. Then we will make it that the background and spawn manager will halt when the player collides with an obstacle. Colliding with an obstacle will also trigger a game over message in the console log, halting the background and the spawn manager. Lastly, we will code so that the character will have 3 new animations that occur in 3 different game states. These states include running, jumping, and death, all of which transition smoothly and are timed to suit the game.

Lesson 3.1 Jump Force:

This tutorial was simple, or so I thought. Although I was writing in my C# code correctly, in my gameplay the game itself was very glitchy and not working as it should be. My player did not jump in my game. I had checked the code and followed the video tutorials exactly, yet why is my player not doing what he is suppose to do? This was really frustrating but I kept going with the tutorial in hopes that something would change and it would make the character jump. My obstacle did move as suppose to (even though it was extremely glitchy). The spawning of the obstacles worked well and later on I found my mistake in why my character did not jump when space was pressed - "Is Kinematic" box in the RigidBody was ticked when it should not have been. So now, my character jumps and the obstacles spawn as shown in the tutorials.

Unity Tutorial 3.1

Lesson 3.2 Make the World Whiz By:

In this second tutorial, we made the background repeat itself while the character jumps over the obstacles, we added a 'Game Over' bool as well as making the objects stop spawning once the game is over. And then lastly, we coded so that any obstacle that exits bounds is destroyed. This tutorial worked a lot better for me as everything went smoothly and I got everything to work.

Unity Tutorial 3.2

Lesson 3.3 Don't Just Stand There:

Moving onto the last tutorial. This is where we adjusted the characters movements and make them look like they're moving. Before even starting the tutorials, I received a red error stating something in my C# script was incorrect. This I fixed as the )) brackets were not correctly written in (according to Visual Studio anyway) even though it was the same code - the orange colouring was different and it triggered the error. We used the animator component located in the player inspector to make the character run in time with the background, then used the player controller script to code so that the character would not run while jumping over the obstacles. Lastly, we edited the code so that the player isn't able to jump while the character is "dead" at Game Over.

Unity Tutorial 3.3

Wednesday, 26 February 2020

Unity Tutorial 05

In this continuation Unity Tutorial we learnt how to create a random spawn of animals in our game but this time we used code in order to help spawn the animals at random times without the player having to click the 'S' key on their keyboard as the game will do that automatically for us.

Next - the animals spawn perfectly and the player can fire projectiles at them, but nothing happens when the two collide, so this is where we learnt how to add colliders so that the projectiles and animals get destroyed on collision. Moving aside from using C#, we move onto Unity to add these colliders to the game. A problem I encountered while applying the box colliders was - when overriding the animals my moose did not have a button for 'Apply All' - yet the other two animals did.

Adding colliders to Animals and Game Object.

After adding the box colliders to the animals and the object (in my case - steak), the tutorial then went on to show us the code for this collision to work and when made contact the animal and steak would disappear from the gameplay.

Wednesday, 19 February 2020

Unity Tutorial 04

We have now gone onto starting a new game tutorial. I have stuck with coding versus the VR tutorials and I must say that the coding is going well so far and I am somewhat enjoying it! Aside from my problems earlier on with the coding, now I don't mind it. We are now moving onto Unit 2 - Basic Gameplay.

Lesson 2.1 Player Positioning:

Starting this tutorial proved difficult as at the very beginning my game begun glitching. It wouldn't be the first time I've experienced problems with Unity on my Mac (if only my Mac could handle Unity...), but I went ahead and tried to complete the tutorial nonetheless. The tutorial worked fine aside from the problem of having my character go left then appear on the right - rather than keep in the bounds of the left!

Unity Tutorial 2.1

Lesson 2.2 Food fight:

In this tutorial, I made the Spacebar that launches a projectile prefab into the scene, which destroys itself when it leaves the game’s boundaries. I then coded so that when the animals leave the game boundaries they are removed from the scene. Because some of the script is Windows and some is Mac, this causes some minor errors in my game (hence the glitching).

Unity Tutorial 2.2

Lesson 2.3 Random Animal Stampede:
In this last tutorial, we added random spawning of animals in different directions when the player presses the S button. In an earlier tutorial we made the piece of steak launch when pressed. So now in the game the player is able to spawn animals and launch steak. We also learnt about camera perspective and the different types of view. In the second image we can see the orthographic perspective of the game. Depending on the game you are creating you can add this perspective. 

Unity Tutorial 2.3

Orthographic Perspective.

Saturday, 15 February 2020

Unity Tutorial 03

In this weeks Unity tutorial we learnt how to control the moving vehicle so that it will hit the road but then we gain control of the vehicle. We will program the vehicle so that when the player presses the up/down arrows, the vehicle will move forward and backward and when the player presses the left/right arrows, the vehicle will turn.

Because my code was unsuccessful the last tutorial it made it difficult to continue the coding in this tutorial as the vehicle was already meant to be moving forward, but in my game, that is a problem. Although I have my code as needed be, my game correctly set up as shown in the tutorials - there is still error but I am hoping to fix this.


Unwanted errors to be fixed.

After many attempts at trying to fix this code it did not work. I will, however, try to make a new project and hope to restart this tutorial in hopes that it will fix. But for now, my coding is not working as errors are there and my script is not working with my game. I then went and uninstalled Unity and installed the newest version.

By installing the new version I was able to start the tutorials again. This time my coding worked perfectly! I followed the previous tutorials and ended the tutorials with the exact game. I am very happy with my finished tutorial game and look forward to trying the next tutorials.

Game fixed and working perfectly!

Finished game.

Wednesday, 12 February 2020

Unity Tutorial 02

Before beginning our first Unity tutorial for the new semester we were told to choose between two options to explore this semester.

  1. Unity Design, Develop and Deploy for VR.
  2. Unity Create with Code.
At first I thought of trying out Unity Design, Develop and Deploy for VR - however, for some unknown reason I was unable to get any of the tutorials working. I tried setting my Unity ready for VR but nothing worked. So I moved onto Unity Create with Code instead.

Lesson 1.1 Start your 3D Engines:

This was the first tutorial was to import a vehicle, obstacle and moving the main camera to the back of the vehicle. This was a simple tutorial and I had no problems with it (besides adjusting the camera properly).

Unity Tutorial 1.1

Lesson 1.2 Pedal to the Metal:

Midway during the tutorial my Unity decided to stop working. Not only did this happen once, but it happened three times. Yes, three times. Whilst working on the second tutorial (when my Unity was not crashing and allowed me to work that is), I came across quite a few problems whilst working with C# script. One problem I was able to fix however there is still a problem in the script which I am hoping to fix with the next tutorial.

Unity Tutorial 1.2

Lesson 1.3 High Speed Chase:

In this last tutorial, upon starting the tutorial I was already faced with issues once again with the C# script. I received quite a number of coding errors and my vehicle did not move (nor could I play a preview of my game because these issues needed to be fixed before I could play). This tutorial overall seemed far more difficult than I had expected. A part of me still wants to try do VR rather than coding. I hope I am able to figure out the issue with Unity so that I am able to try VR next Unity Tutorials.

Unity Tutorial 1.3