Android Game Development Tutorial — Sample Scene Unity 3DIn this Android Game Development — Sample Scene Unity 3D tutorial we are going to see how to create a scene in Unity 3D game engine.
File-New Project then click Create button.
The packages you need for import Your game.
- Character Controller.unityPackage
- Light Flares.unityPackage
- Terrain Assets.unityPackage
Now we are going to create the Land of our world.
Terrain –> Create Terrain
Lets light our scene
Paint the Terrain
- Paint the Terrain by selection the paint brush icon in the inspector window.
- Then click EditTextures-Add Texture.
- In the Add Terrain Texture – Splat – you need select the Texture by clicking the circle button.
- By double clicking the desire texture you can Add the Texture to your Terrain.
The default Terrain is very Large for this sample scene.
However we can set the resolution by perform Terrain-setResolution by setting the following things.
Terrain Height= 200
- Then click set Resolution to fix the terrain size.
Adding Trees to our Scene
Lets add some Trees to our world.
- Click the Tree Icon and press the Edit Trees to add a Tree Instance.
- Then select the Palm to our Inspector.
- Brush Size
- Tree Density
- Color Variation
- Tree Height
- Tree Width
Create some mountains and hills by click the Raise/Lower Terrain Icon.
- By clicking on the Terrain you can raise the terrain.
- By Holding down Shift+Click you can lower the terrain.
Changing Opacity to a lower value, you can make som small changes to the terrain.
Now we have set up our world by Trees surrounded by hills and mountains.
Creating First Person Controller
Before Playing our scene,we need to create a Controller.
There are two types of controller.
- First Person Controller.
- Third Person Controller.
- Drag and drop the First Person Controller from Standard Assets-Character Controllers-First Person Controller.
- You can drop it directly to our scene or to the hierarchy.
- From Hierarchy select the First Person Contoller and move your mouse to the scene view.
- Then press F to focus the FirstPerson Controller.
- Make sure the controller is above the ground level other wise it will fall through our level.
- The First Person Controller uses its own main camera, so if you have any other camera in your hierarchy simply delete that (Not the camera in the controller).
Lets press the play button to test our simple game level.
- By moving the mouse you can turn the camera.
- By using the W,A,S,D or Arrow Key from keyboard you can move the camera.
- By holding the Shift key, you can speed up the above process.
- By taping Space bar you can make your controller to jump.
Add SkyBox to our Scene
Currently the sky in our level has only a blue color.
To make realism to our world, lets add a skybox by performing the following changes.
- Select the Main Camera from the FirstPerson Controller.
- Then go to component-Rendering-skybox. This will add skybox compinent to our MainCamera Inspector.
- In the custom skybox field currently you have None.
- Now go to Standard Assets- Skyboxes from that you drag and drop the desire skybox to the skybox component in the Inspector window.
Adding Light Flare to our Scene
Lets add a light flare to our scene, for that we need to import package-light flare.
There are two ways to add a light flare to our scene
- Select the Direction light.
- In the inspector under the light option select the Flare.
- Now Select sun or 50mm zoom.
- Finally hit play you can see the lense flare.
- Create a empty game object by GameObject-Create Empty.
- It will create a game object in the hierarchy.
- While selecting the game object goto Component Effect-Lense Flare.
- It will add LenseFlare component to the GameObject, you can apply property to this LenseFlare from the Inspector window.
- You can easily re-position the game object wherever you want.
Add Water to our Level
Lets add some water to our world by creating a lake in our scene.
- After importing the water package, you can find water inside the standard Assets.
- Find Daylight simple Water then just drag and drop the water to our scene you need to place the water in a way that fill the lake height.
- Place your First Person Controller to the higher surface then hit play now you can see the water.