Log in or register to post comments

how to change to another 3d model after button is pressed

January 16, 2013 - 8:26am #1

 

if (GUILayout.Button("Red")) { i do not know what to write here }

I imported 3D object called abc1 from Maya, by default is using lambert3 (blue color).

if i want to replace it with another 3D object called abc2, which is using lambert1 (red).

or is it possible to replace abc1 directly with lambert1? since already imported into unity3d as well even without import abc2.

i am doing for android + Augmented reality (vuforia) + unity3d.

thanks!

Glad to help.

January 18, 2013 - 8:53am #8

Glad to help.

ahah~ i see. yes,

January 18, 2013 - 8:46am #7

ahah~ i see. yes, successfully ^^ thank u so much for your help and being so kindly to explain to me 

Yes, I understood that, but

January 18, 2013 - 6:06am #6

Yes, I understood that, but what I mean is that you could create some code and have a boolean flag (e.g. call it "showText") when the virtual buttons get triggered, and then use GUI.Label() to show some text on the screen when such flag is true;

you could also write the code so that the boolean flag gets back to false after some time, i.e.:

- virtual button triggered ==> set the boolean flag "showText = true"

- have a timer logic (e.g. checking time elapsed since when it was set to true) so that after some time you reset the "showText = false"

- render the text using GUI.Label if the "showText" flag is true

i.e. :

void OnGUI()

{

     if (showText)  GUI.Label( .... );

}

That is what I meant in my previous message

However, if you want to use GUIText and put the text in 3D space, that is also possible (but please check the Unity doc or the link that I posted before).

 

erm. i mean I want to

January 18, 2013 - 5:56am #5

erm. i mean I want to use Virtual Button to display text out?

i do not want it to show all the time, just when i press a virtual button, instead of changing material, i want it shows some text besides the object.. hehe

thank you

Hi, have you tried just using

January 18, 2013 - 5:34am #4

Hi, have you tried just using GUI.Label() function, this is usually one of the simplest way to display text;

for instance, suppose you create a script and you attach it to your ARCamera (or to one of your ImageTargets), your script could include some code like the following:

 

void Start () {
 
}
 
// Update is called once per frame
void Update () {
 
}
 
void OnGUI()
{
GUI.Label(new Rect(0,0,100,50), "Hello there");
}
 
For the GUIText not working (if you want to go that path), you can check here:
 

thank you so much for your

January 18, 2013 - 5:05am #3

thank you so much for your help =)

by the way, is it possible to display text when a virtual button is pressed??

i tried guiText but it is not working.

Hi, you can replace your 3D

January 16, 2013 - 9:32am #2

Hi, you can replace your 3D model quite easily at runtime in Unity;

this is discussed for instance in this thread:

https://developer.vuforia.com/forum/unity-3-extension-technical-discussion/replace-3d-model-runtime

 

Log in or register to post comments