Création du Menu principal en 3D





1 - Créer un cube et l'élargir avec l'inspecteur, après dupliquer 2 fois avec la touche (Ctrl + D)



2 - Créer un texte en 3d "3d text" et attribuer les mêmes valeurs de l'échelle et de rotation et de translation


  




3-Créer "Script Menu" Script pour contrôler la scène en C # (CSharpe) ou js (JavaScript) et nommez-le "Script Menu"

 
4 - Ouvrir le script et écrire ce code

Pour c# :

 using UnityEngine;  
 using System.Collections;  
 public class MenuScript : MonoBehaviour {  
         public Color ColorBack = Color.black;  
         public Color ColorForward = Color.red;  
         void Start()  
                 {  
                 renderer.material.color = Color.black;  
                 }  
         void OnMouseEnter()  
     {  
         renderer.material.color = Color.red;  
     }  
   void OnMouseExit()  
     {  
         renderer.material.color = Color.black;  
     }  
   public int index=0;  
   void OnMouseDown()  
     {  
         switch (index){  
         case 1: Application.LoadLevel(1);  
                         break;  
         case 2: Screen.fullScreen =!Screen.fullScreen ;  
             break;  
         case 3: Application.Quit();  
                         break;  
         }  
     }  
 }  
Pour js :

 #pragma strict  
         public var ColorBack:Color = Color.black;  
         public var ColorForward:Color = Color.red;  
         function Start()  
                 {  
                         renderer.material.color = ColorBack;  
                 }  
         function OnMouseEnter()  
     {  
         renderer.material.color = ColorForward;  
     }  
   function OnMouseExit()  
     {  
         renderer.material.color = ColorBack;  
     }  
   public var index:int=0;  
   function OnMouseDown()  
     {  
         switch (index){  
         case 1: Application.LoadLevel(1);  
                         break;  
         case 2: Screen.fullScreen =!Screen.fullScreen ;  
             break;  
         case 3: Application.Quit();  
                         break;  
         }  
     }  
5 - Maintenant affectez le script aux 3 cubes et changer l'indice du script selon le numéro du cube
5- Enregistrez la scène sous le nom “level0”

6 - Créer une nouvelle scène et enregistrez sous le nom “level1”

7 - Maintenant, ajoutez les 2 scènes à "build Settings" (menu File -> build Settings)
8 - Maintenant, cliquez sur play pour tester le menu

Change arrow mouse to texture


Create Script “MouseCursor” to change the texture of the mouse in C# (CSharpe) or js (JavaScript)
For c# :
using UnityEngine;  
 using System.Collections;  
 public class MouseCursor : MonoBehaviour {  
         public Texture2D crosshairTexture;  
         public Rect position;  
         void Start()  
                 {  
                 Screen.showCursor = false;         
                 position = Rect( ( Screen.width - crosshairTexture.width ) * 0.5f, ( Screen.height - crosshairTexture.height ) * 0.5f, crosshairTexture.width, crosshairTexture.height );  
                 }  
         void OnGUI()  
                 {  
                   GUI.DrawTexture(position, crosshairTexture);   
                 }  
 }  
For c# :

var crosshairTexture : Texture2D;  
 var position : Rect;  
 function Start()  
                 {  
                 Screen.showCursor = false;         
                 position = Rect( ( Screen.width - crosshairTexture.width ) * 0.5, ( Screen.height - crosshairTexture.height ) * 0.5, crosshairTexture.width, crosshairTexture.height );  
                 }  
 function OnGUI()  
                 {  
         GUI.DrawTexture(position, crosshairTexture);  
                 }  

Scene View Navigation



To Create new project in unity 3D and move around with mouse


1-            File -> New Project -> Project Location ->\”name of the projet” ->Create



2-            Now you have to create something in the scene like cube
                GameObject -> Create Other -> Cube



3-            Now to work with the scene view
                                To rotate the scene: ALT + Button Left (mouse)
                               To Move the scene: Button middle (mouse)
                               To Scale (zoom) the scene: Scroll Up/Down (mouse)
                And move the mouse to translate


4-            To work with the Cube (GameObject)
                               To rotate the Cube: E
                               To Move the Cube: W
                               To Scale the Cube:  R
                And scale it with the axis in the center of cube