- Home /
3D Menu Help
I'm trying to make a 3D menu for a game I'm working on, I followed that tutorial 3D Menu Tutorial , But when I get to the part where I have to link my buttons to the MenuManager (drag the buttons to the array slots, it doesn't work) the array I created on my script doesn't show up on the Unity interface. Here are the codes im using:
function OnSelected(on:boolean) { if(on) { iTween.moveTo(gameObject, {"z": -4, "time":0.5, "transition": "bounce"}); iTween.rotateTo(gameObject, { "y": -90, "time":0.5}); } else { iTween.moveTo(gameObject, {"z":0, "time": 0.5, "transition":"bounce"}); iTween.rotateTo(gameObject, {"y": 0, "time":0.5}); } }
And that is my Menu Manager:
 var menuItems:MenuItem[];
var currentMenuItem:int = 0;
var keyDelay:float = 0.25;
function Start() { menuItems[currentMenuItem].OnSelected(true);
     var lastMenuItem:int = currentMenuItem;
     
     while(true)
     {
         if(Input.GetAxisRaw("Vertical") > 0.9)
         {
             lastMenuItem = currentMenuItem;
             
             currentMenuItem--;
             if(currentMenuItem < 0) currentMenuItem = 0;
             
             if(lastMenuItem != currentMenuItem)
             {
                 menuItems[lastMenuItem].OnSelected(false);
                 
                 menuItems[currentMenuItem].OnSelected(true);
             }
             
             yield new WaitForSeconds(keyDelay);
         
         }
         else if(Input.GetAxisRaw("Vertical") < -0.9)
         {
             lastMenuItem = currentMenuItem;
             
             currentMenuItem++;
             if(currentMenuItem >= menuItems.length) currentMenuItem = menuItems.length -1;
             
             if(lastMenuItem != currentMenuItem)
             {
                 menuItems[lastMenuItem].OnSelected(false);
                 
                 menuItems[currentMenuItem].OnSelected(true);
             }
             
             yield new WaitForSeconds(keyDelay);
         }
         yield;
     
     if(Input.GetButtonDown("Jump"))
     {
         Debug.Log("voce ativou o botao" + currentMenuItem);
         menuItems[currentMenuItem].Activate();
     }
 }
}
Answer by caiodmk · Nov 29, 2011 at 02:01 PM
Solved, my script was looking for the OnSelected property on my MenuItem prefab instead of on the MenuItem script
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                