Log in or register to post comments

Add UI elements over ARCamera

May 11, 2013 - 2:12am #1

Hi,

I'm new to Unity and I'm implementing an Android application using Vuforia. I downloaded the ImageTargets example for Unity and made it work. Now I wanted to add a ComboBox over the ARCamera.

I found some code to create the ComboBox:

 

void OnGUI()
    {       
    if(GUI.Button(new Rect(0, 0, 200, 30), selectedItem))
    {
        editing = true;
    }
 
    if(editing){
        for(int i=0; i<items.Length; i++){
            if(GUI.Button(new Rect(0, 30*i + 30, 200, 30), items[i]))
            {
                selectedItem = items[i];
                editing = false; 
            }
       }
   }
}
 
I added this code to the LoadingManager.cs script I found in the ImageTargets example and then I added this script to the ARCamera, but the ComboBox isn't seen in screen. Anybody knows why is that? What am I missing?
 
Thanks!
 
 

Add UI elements over ARCamera

May 13, 2013 - 3:11am #2

I added this code to the LoadingManager.cs script I found in the ImageTargets

This code is primarily used for loading, so it's not the best example to use when applying to the ARCamera.

Have a look at how the overlay menus are done in Image Targets when you tap on the screen, as this will show you how to integrate basic gui components in an overlay on top of the AR Camera.  If you need something more sophiscticated i.e. always on, then check out the UDT sample.

HTH

N

 

Log in or register to post comments