# Scene Navigation/Manuvering
- Zooming to a game object: Select the game object in scene/hierarchy +
F
- To move the camera around the scene:
- Activate Hand Tool (shortcut
Q
) - Left click and drag for moving the camera view
- Right click and drag around to rotate/orbit the camera view
- Activate Hand Tool (shortcut
- To rotate camera around a given object
- Double-click on the object in hierarchy.
- Make sure Hand Tool (shortcut
Q
) is activated - Now press
Option
and then useleft click
to rotate around the object to view it from different perspectives.
- To move an object
- Activate Move Tool (shortcut
W
): - use the axis lines to drag around
- Activate Move Tool (shortcut
- To rotate an object
- Activate Rotate Tool (shortcut
E
) - Rotate the object by moving the sphere
- Activate Rotate Tool (shortcut
- To scale an object
- Activate Scale Tool (shortcut
R
) - Now drag the axis lines to scale
- Activate Scale Tool (shortcut
# Unity Shortcuts
- To change icon sizes in Project Window:
Cmd + Scroll
- To duplicate an element in hierarchy/project:
Cmd+D
- Pressing
Shift + Option
while changing the anchor point of the text moves the text itself to the anchor point
# Unity Tips
- The primitive objects are usually 1x1x1 units. That's why, if you make Y = 0.5 for a sphere, it will perfectly sit on the plane.
- If we want to add textures to materials, Materials need to be created separately and then dragged onto game objects to be applied. If we download materials/textures from asset store, then we should be able to drag and apply it to game objects.
- To apply physics to an object, a rigidBody component must be attached to it
- Update is called before rendering a frame where most of our code will go.FixedUpdate is called before performing any physics calculations, so this is where physics code will go.
- To make things frame-rate independent, multiply changes (like transfomations) by
Time.deltaTime
# Camera Tips
Y position of +10 and X rotation of 45 is a good position for camera.
For the camera to follow the player, we can make the camera object a child of the player game object. But the problem with this is that the camera will not only inherit position but also rotation in all axes of the player.
So we attach a script to the camera, and set its transformation with respect to the position of the player object and not the rotation.
Since the order in which Update()s are executed is not set, for follow cameras and tasks that need to operate on the state after other mods are done (like physics engine and such), it is best to use LateUpdate()
Cube objects come with a box collider component which stops any gameobjects with rigidbody. If you have "Is Trigger" in box collider component enabled, then upon collision, it will act as a trigger using a script instead of a blocker.
# M1 Tips
- Using rigidbody's
MovePosition
is the most efficient and safest way to control position in Unity's physics engine - Rigidbody controls the physics, and Capsule Collider controls the geometry of collisions.
# Nice Assets
# Terrain Creation Tips
- sculpt the terrain
- First select
set height
in terrain inspector and set height to 100m andtile
- Then select
Raise or Lower Terrain
and select a brush and start brushing Ctrl+click
lowers the height in the terrain while brushing- Brush shortcuts
A
and left drag increases/decreases the strength of brushS
and left drag increases/decreases the size of the brushD
and left sdrag can rotate the brush
# Updating to URP / Fixing shader issues
- Select the model, and then change the Shader to
Univeral Render Pipeline
>Lit
- Also select the material of the model, and then go to
Edit > Render Pipeline > Universal Render Pipeline > Update to URP