Unity – Physics 2D – Basics

Videogames Development – Unity – How to add Physics 2D

ADD PHYSICS

Setup the Physics 2D engine

MAIN TOP MENU> Edit> Project Settings> Physics 2D> Inspector> Gravity

Create a Sphere over a Box, the Sphere will fall and will collide overe the box

1. Hierarchy> select Sphere
2. MAIN TOP MENU> Component> Physics 2D> Rigidbody 2D
3. Hierarchy> select Sphere> Inspector> Rigidbody 2D> setup parameters
4. Hierarchy> select Sphere> Inspector> ‘Add Component Button’> Physics 2D> Polygon Collider
5. Hierarchy> select Sphere> Inspector> Polygon Collider 2D> setup parameters

6. TOP CENTER> click over ‘Play’ button, the Sphere will fall
7. TOP CENTER> click over ‘Play’ button, to stop simulation

8. Hierarchy> select Box
9. MAIN TOP MENU> Component> Physics 2D> Polygon Collider 2D
10. Hierarchy> select Sphere> Inspector> Polygon Collider 2D> setup parameters
11. Viewport> MAIUSC+LMB click over the wireframe of the Polygon Collider to change it

12. MAIN TOP MENu> Assets> Create> Physics 2D Material
13. ‘Assets’ window> select New Physics2D Material> Inspector> setup Friction / Bounciness
> Bounciness >

14. Hierarchy> select Sphere> Polygon Collider 2D> Material> New Physics2D Material
15. Hierarchy> select Box> Polygon Collider 2D> Material> New Physics2D Material

16. TOP CENTER> click over ‘Play’ button, now there is collision
17. TOP CENTER> click over ‘Play’ button, to stop simulation

By |Unity3D|Commenti disabilitati su Unity – Physics 2D – Basics

Unity – Particle System

Videogames Development – Unity – How to add a particle system

ADD PARTICLE SYSTEM

1. MAIN TOP MENU> GameObject> Create Other> Particle System

MODIFY PARTICLE SYSTEM

1. Hierarchy> select Particle System> Inspector> setup parameters

By |Unity3D|Commenti disabilitati su Unity – Particle System

Unity – Build a Game – Basics

Videogames Development – Unity – How to build a videogame

A videogame project can be built for:

– Web Player
– Flash Player

– Google Native Client

– PC Standalone
– Mac Standalone
– Linux Standalone

– Windows Store Apps

– IOS
– Android
– Black Berry
– Windows 8 Phone

– XBox 360
– PS3
– Wii

BUILD A GAME

Load a Project

1. MAIN TOP MENU> File> Build Settings…> Choose your platform

2. MAIN TOP MENU> File> Build Settings…> ‘Player Setting’ button> Inspector setup ‘PlayerSetting’, the most important are:

– Company Name
– Product Name
– Default Icon> ‘Select Button’> choose a Asset in the list
– Default Cursor

– Resolution and Presentation> Supported Aspect Ratios
– Icon
– Spalsh Image
– Other Settings

3. MAIN TOP MENU> File> Build Settings…> ‘Buid’ or ‘Build and Run’> Choose a folder to save the game.

4. Close the ‘Build Settings’ window using the red cross on top right.

Open the folder where the games has benn saved and… great! Now you can play your own game!

By |Unity3D|Commenti disabilitati su Unity – Build a Game – Basics

Unity – BG Music

Videogames Development – Unity – How to add a background music

LOAD A BG MUSIC

1. MAIN TOP MENU> Edit> Assets> Import New Asset…> your-bgmusic.mp3
2. DRAG AND DROP ‘your-bgmusic.mp3’ from ‘Project’ window to ‘Scene’ viewport

MODIFY A BG MUSIC

1. Hierarchy> select your-bgmusic.mp3
2. InspectorA setup parameters

SETUP CAMER TO LISTEN MUSIC

1. Hierarchy> select Main Camera
2. Inspector> check Audio Listener

NOTICE:
The Audio Listener acts as a microphone-like device. It receives input from any given Audio Source in the scene and plays sounds through the computer speakers.

By |Unity3D|Commenti disabilitati su Unity – BG Music

Unity – Scripting – If Statements

Videogames Development – Unity – If Statements (dichiarazioni If)

IF – ELSE

if (1 == a)
{
             // Do a set of actions
}
else
{
             // Do another set of actions
}

IF – ELSE IF

if (1 == a)
{
             // Do a set of actions
}
else if (2 -- b)
{
             // Do another set of actions
}
else
{
             // Do YET another set of actions
}

IF – NESTED (annidato)

if (1 == a)
 {
     if (2 ==b)
      {
             // Do a set of actions
      }
}
By |Unity3D|Commenti disabilitati su Unity – Scripting – If Statements