Skip to Content
Unity 2017 Mobile Game Development
book

Unity 2017 Mobile Game Development

by John P. Doran
November 2017
Beginner to intermediate content levelBeginner to intermediate
360 pages
6h 40m
English
Packt Publishing
Content preview from Unity 2017 Mobile Game Development

Having the camera following our player

 

Currently, our camera stays in the same spot while the game is going on. This does not work very well for this game, as the player will be moving more the longer the game is going on. There are two main ways that we can move our camera. We can just move the camera and make it a child of the player, but that will not work due to the ball's rotation. Due to that, we will likely want to use a script instead. Thankfully, we can modify how our camera looks at things fairly easily, so let's go ahead and fix that next:

  1. Go to the Project window and create a new C# script called CameraBehaviour. From there, use the following code:
using UnityEngine;  /// <summary> /// Will adjust the camera to follow and ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Holistic Mobile Game Development with Unity

Holistic Mobile Game Development with Unity

Penny de Byl
Hands-On Unity 2020 Game Development

Hands-On Unity 2020 Game Development

Nicolas Alejandro Borromeo

Publisher Resources

ISBN: 9781787288713Supplemental Content