Skip to Content
Learning C# by Developing Games with Unity 3D Beginner's Guide
book

Learning C# by Developing Games with Unity 3D Beginner's Guide

by Terry Norton
September 2013
Beginner content levelBeginner
292 pages
6h 19m
English
Packt Publishing
Content preview from Learning C# by Developing Games with Unity 3D Beginner's Guide

Switching to the first play State and playable scene

Chapter 9, Start Building a Game and Get the Basic Structure Running, finished with SetupState. Now we need to switch to the next State, PlayStateScene1_1. At the bottom of the SetupState screen is a button Click Here or Press 'P' to Play.

In SetupState, here's the code for that button:

Switching to the first play State and playable scene

An analysis of the code shown in the preceding screenshot is as follows:

Line 69: player.transform.position = new Vector3(50, .5f, 40);

  • Places Player near the center of the Terrain

Loading Scene1 using code

In Scene1, Player will use physics to hover and move. Here is the relevant code in PlayStateScene1_1:

An analysis ...

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

Learning C# by Developing Games with Unity 2019 - Fourth Edition

Learning C# by Developing Games with Unity 2019 - Fourth Edition

Harrison Ferrone
Unity 3D Game Development

Unity 3D Game Development

Anthony Davis, Travis Baptiste, Russell Craig, Ryan Stunkel

Publisher Resources

ISBN: 9781849696586Other