- Home /
Is it possible to suspend GUIs after running fade-in scripts?
Hi! I'm new in using unity.
First of all I was looking for some answers here that would also answer my question. but so far i found none. (well i found some but it's still kinda far from what i'm looking for).
here's what i want to happen:
i used a 3D terrain for my main menu. my main menu uses iTweens to navigate the whole 3D terrain (it's like when you click a button the iTween will move the camera and it will bring you to another location of my 3D terrain where another menu is waiting). i saw that kind of menu in youtube but i can't find it anymore (the one that all of his GUIs like the options, name of the character, etc. are all in a 3D Gun since its a FPS game i guess).
i already watched video tutorials about making 3D navigational main menus and it was helpful. but the problem is, a part of my 3D menu needs some GUI textboxes. and as far as i know, GUIs always stick in front of the camera which means it will be all over my menu when i just want it to be in a specific part of my 3D menu.
so i came up with an idea that if i can attach a collider to my camera and another collider(which serves as a trigger) in the place i want the GUI to fade-in and will fade-out if you triggered the collider again so that it won't make any mess. i tried to use some collider scripts and fade-in scripts and tried tweaking those but somehow it didn't work. and now i'm back to zero.
i'm sorry if i can't show you any scripts for now because it's on my groupmates pc and he's on a vacation as of now.. but i want to know if my idea is somehow possible. and if it is.. can someone help me to construct the right concept to make this things work? (i'm having trouble understanding colliders :|)
hope you understand my problem. thanks! :)
ins$$anonymous$$d of colliders, you could just use distance. like :
if(Vector3.Distance(cameraPosition, guiPosition1) < some$$anonymous$$inDist) //turn on gui text 1
seems like the trigger idea should work, hard to say what went wrong due to lack of details, but if each object has a collider, with one set to "isTrigger", then using the function OnTriggerEnter should do it..
i placed a collider on the camera then a collider(trigger) on the place i want the GUIs to show. but it seems i'm having a hard time understanding collider works. (and i don't know why LOL).
can i ask about the guiPosition1? is it the one you place in the Rect()?
Answer by T27M · May 02, 2012 at 09:41 PM
This ? You could just use a bool to show/hide the textbox when you need it.
yes! i was about to edit my post and place that link..
anyways i also tried using bool to show/hide the GUIs but it didn't work.. maybe because i'm kinda new to game scripting but i'll try to do it again. i'll update again in case i'll have any troubles
correct me if i'm wrong, here's what i'm trying to do:
in the function OnTriggerEnter(), if my collider is triggered then it will set myBool to True.
Then the "if statement" is under the function OnGui() like the one on your comment above.
am i right?
Your answer
Follow this Question
Related Questions
Using 2D GUIs in a 3D Terrain for a Main Menu 0 Answers
box collider and mesh collider not working 5 Answers
GUI Popup problem…! 1 Answer
Wheel Colliders not colliding with Mesh Collider 0 Answers
Problem with variables 1 Answer