Tutorial – Unity Basics : Graphics
These notes are noted from the training videos on Unity’s Website.
– Scripts are components just like textures and meshes that can be added to objects using the ‘Add Component’ buttons and tabs.
– The Cog icon can be used to copy and paste components into other objeccts.
– Tags: Groups of objects can be tagged. For example ‘Orc’ and ‘Tank’ can both be given the tag ‘Enemy’. Tags can then be referenced in scripts etc.
I.e : Gameobject.FindWithTag(“Player”);
Self contained objects created in the scene can be dragged into Assets> Prefabs so more instances can be placed later as needed.
Every object imported into the scene gets a Filterer and a Renderer.
Mesh Filter has only one property- a reference to the actual mesh object.
Mesh Renderer contains all property data for materials, shadows and lights.
-Inspector > Texture Type. Can change between options such as GUI or Mesh textures.
-Arizo Levels – Affects the quality of textures when viewed at steep angles.
– Max Size can be set for each platform to export to. Each platform can have custom settings that will overide the default settings, without ever altering the original file. Compression levels can also be set.
– To include Normal maps, Bump maps etc change the ‘Shader’ type in the inspector menu.
-New Shaders can also be created from the Create Panel.
– A new main camera will automatically be created when a new scene is created.
– For 3rd or 1st person games the player object is parent to the camera. For 1st, position the camera in front of player objects face. For Top down games, set the camera above the scene facing straight down.
– In the projection tab in the inspector you can choose between ‘Perspective’ and ‘Orthographic’ view modes.
– Orthographic is commonly used for top down strategy and puzzle games, but also for HUDs and User interfaces.
– More than one camera can be used per scene. i.e you can have one for static objects (levels) one for dynamic (players and enemies) and one for HUDs and UIs.
– Cameras emit a pyramid called a frustum. Everything insdide this frustum is rendered.
– The top and bottom of the pyramid are the near and far ‘Clipping Planes’ and can be adjusted in the inspector.
– ‘Clear Flags’ Determine the background if no other objects are displayed i.e. if there is no object blocking the far clipping plane such as a wall. This is where you place your sky boxes. You can also set solid colours, or set ‘Depth Only’ for multiple cams.
-You can also create a trippy ghosting effect by checking the ‘Dont Clear’ option which stops the previous frame from clearing.
– Cameras only display what is in their culling mask. This is a check box list of all layers. For example – Main camera would contain environment, enemies, lights layers etc., whilst a UI cam would only show elements saved in the UI layer.
– For a UI camera, it would have the highest ‘Depth’ value to appear in front of other elements, and its clear flag would be set to ‘Depth Only’
– Created in Hierarchy tab.
– Emissiveness (Self illumination)works only with Baked Lights.
– Cookies are alpha stencils which give lights a patterned effect.
– Shadows Soft Shadows are more expensive to render.
– ‘Halo’ creates a visible glow at the origin point of a light.
– Render Mode Settings: Vertex and Pixel lighting.
– Pixel lighting is more expensive but required for some shaders such as Normal maps.
– Important lights should be pixel rendered. Non important lights should be Vertex rendered.
Audio Listener component
-Is like ears. Hears the sound sources.
-Only one per scene.
– Defaults to be attached to Main Camera, but can be attached to others such as the player character.
Audio Source component.
– Placed around scenes. Where sounds are generated.
– 2D sounds for music, HUD sounds etc
– 3D sounds for in game objects and effects.
– Sounds are given a priority from 0 to 255, with 0 having highest priority. Music should be set to 0 so it never cuts out when many sources are present.