Transforming the Camera

This code will make users to be able to start the floating again from the beginning. The camera (the view of the user) transforms to its original/starting position.

To do this with Unity3d, I created an empty object, named SpawnPoint, arrange its position the same with the camera’s original position so that after pressing the button it goes back to its original position.

var SpawnPoint : Transform;

function Update () {

if(Input.GetButton(“Jump”)) // Jump is the name of the button
transform.position = SpawnPoint.position;


This is the code that I found on the Internet. It also works the same way, but my guess, this code is for games. I did not research GUI enough yet. After I did that, I will decide which one works best for my project.

function OnGUI () {

if (Event.current.Equals (Event.KeyboardEvent (“positivebuttonname“))) Application.LoadLevel(Application.loadedLevel);


Leave a Reply