unity3d

Unity – User input – Load Scene – GetButton – JS

Unity – User input – Load Scene – GetButton – JS

Level1.unity

1. MAIN TOP MENU> GameObject> Create Other> Cube
2. Hierarchy> Cude> Inspector> Add Component> New Script> JavaScript> LoadLevel2.js

LoadLevel2.js

#pragma strict

function Update() {
// press spacebar to load Level2
if(Input.GetButton("Jump")){
 Application.LoadLevel ("Level2"); 
}
}

3. Files> Save Scene as… Level1.unity

Level2.unity

1. MAIN TOP MENU> GameObject> Create Other> Sphere
2. Files> Save Scene as… Level2.unity

Building Settings

1. File> Building Settings…
2. Project> DRAG AND DROP Level1 over Building Settings> Scenes in Build
3. Project> DRAG AND DROP Level2 over Building Settings> Scenes in Build

Play

TOP Play button, Level1.unity starts -> press keyboard spacebar -> Level2.unity starts

By |Unity3D, Video Games Development|Commenti disabilitati su Unity – User input – Load Scene – GetButton – JS

Unity – Prefabs – Pre Configurated GameObjects

Unity – Prefabs – Pre Configurated GameObjects

Unity Prefabs are pre-configurated GameObjects

Essentials

– A Prefab is a type of asset (attività), a reusable GameObject stored in Project View.

– Prefabs can be inserted into any number of scenes, multiple times per scene.

– When you add a Prefab to a scene, you create an instance of it.

– All Prefab instances are linked to the original Prefab and are essentially clones of it. No matter how many instances exist in your project, when you make any changes to the Prefab you will see the change applied to all instances.

Creating Prefabs

In order to create a Prefab, simply drag a GameObject that you’ve created in the scene into the Project View.

1. Assets> Import New Asset… (Importa una nuova attività)> file.fbx (3D Model)

2. Assets> DRAG the imported Asset in the ‘Scene’ window twice
NOTICE: Hierarchy> The GameObject’s name will turn blue to show that it is a Prefab.

OR

DRAG AND DROP the Asset inside ‘Prefab’ folder

3a. Assets> select the imported Asset> Change material, ALL GameObjects in the scene will change.
OR
3b.Hierarchy> select a GameObject> Change material, ALL GameObjects in the scene will change.

After you have performed these steps, the GameObject and all its children have been copied into the Prefab data. The Prefab can now be re-used in multiple instances. The original GameObject in the Hierarchy has now become an instance of the Prefab.

Inheritance

Inheritance means that whenever the source Prefab changes, those changes are applied to all linked GameObjects. For example, if you add a new script to a Prefab, all of the linked GameObjects will instantly contain the script as well. However, it is possible to change the properties of a single instance while keeping the link intact. Simply change any property of a prefab instance, and watch as the variable name becomes bold. The variable is now overridden. All overridden properties will not be affected by changes in the source Prefab.

– If you want to update the source Prefab and all instances with the new overridden values, you can click the Apply button in the Inspector.
Note that the root’s position and rotation will not be applied, as that affects the instances absolute position and would put all instances in the same place. However position and rotation from any children or ancestors of the root will be applied as they are computed relative to the root’s transform.

– If you want to discard all overrides on a particular instance, you can click the Revert button.

By |Unity3D, Video Games Development|Commenti disabilitati su Unity – Prefabs – Pre Configurated GameObjects

Unity – Scripts – Assets

Unity – Scripts – Assets

1. MAIN TOP MENU> Assets> Import Package> Scripts

2. Projects> Standard Assets> Scripts

– Camera Scripts
Mouse Orbit
Smoot Follow
SmootlookAt

– General Scripts
Activate Trigger
Drag RigidBody

By |Unity3D, Video Games Development|Commenti disabilitati su Unity – Scripts – Assets

Projects and Packages – Import – Export – Save – Delete

New Project folder

1. File> New Project> Setup default for… 3D> setup a path and a name for this project (example D:\Unity\Space-Shooter-001), IMPORTANT: you have to choose a empty folder!

Inside the folder Unity has created the folders:
– Assets
– Library
– ProjectSettings
– Temp

You can add a folder ‘Package’ and copy your .unitypackage
This in the better way to organize your folders in my opinion.
WARNING: If you import an .unitypackage from a removable flash drive you will get an error

Import Package .unitypackage

2. Assets> RMB> Import Package> Custom Package> select the package ‘name.unitypackage’
NOTICE: .unitypackage is a sort of .zip with all resource you need inside. The contain usually is meshes, textures, materials, physic, music, scripts and so on…

3. The importing windows appears, now you need to choose what you need> ‘Import’

4. Assets> differet folders appears, for example Audio – Materials – Models – Prefabs – Textures etc…

5. Inside the folder ‘Assets’ Unity has copied all content of .unitypackage and the decompress content is organized in different folders:
– Audio
– Materials
– Models
– Prefabs
– Texture
– etc…

– Library
– ProjectSettings
– Temp

Export Package .unitypackage

1. Open a Project

2. Assets> Export Package…> check ‘Include Dependency’, ‘Export’

Save Projects

WARNING: Packages aren’t really intended for entire projects. To save a project you should just zip the project folder !!!

Delete Projects

Delete the Project Folder.

By |Unity3D, Video Games Development|Commenti disabilitati su Projects and Packages – Import – Export – Save – Delete

Unity3D – Projectors

Unity3D – Projectors

Projector allows you to project a Material onto all objects that intersect its frustum.

You can:

– Create shadows.
– Make a real world projector on a tripod with another Camera that films some other part of the world using a Render Texture.
– Create bullet marks.
– Funky lighting effects.

1. MAIN TOP MENU> Assets> Import Package> Projectors

2. Project> Standard Assets> Projectors> select Blob Light Projector> DRAG AND DROP over Sceve viewport

3. Hierarchy> Blob Light Projector> Inspector

By |Unity3D, Video Games Development|Commenti disabilitati su Unity3D – Projectors