- Home /
Any way to show a picture on the screen when a model is clicked?
I would like in the scene to be abel to use the mouse to click on objects, which I can do and my scene works interactively when you move the object with the mouse, but first of all I would like a picture to come up that can be closed with an 'X' on click and a different picture for each model in the scene. Is this possible
Answer by runevision · Mar 25, 2010 at 04:14 PM
Yes, it is possible. Make a script with an OnMouseDown function and an OnGUI function and attach the script to your model.
Use OnMouseDown to detect the click on the model. In the OnMouseDown function you can set some boolean:
showPicture = true;
Use OnGUI to make some GUI that is only shown when
showPicture
istrue
. You can use DrawTexture to draw your image. Also make a button that will setshowPicture = false;
and make the button look like an 'X'.
Answer by ALex · Mar 25, 2010 at 10:45 PM
Thank you very much for your help, I will be giving that a go tonight and tommorrow.
Cheers!
No problem! If an answer was helpful to you, don't forget to mark it as the accepted answer (click the check-mark next to the answer).
And also these kind of posts consider adding a comment ins$$anonymous$$d of posting a new answer. $$anonymous$$ore info on how this works: http://answers.unity3d.com/faq
Your answer
Follow this Question
Related Questions
load .png/.jpg from .txt-file 2 Answers
EncodeToJPG is too slow. Blocking main thread.Is there new way alternative? 0 Answers
Image Sequence in unity without using .gifs for a crowd 2 Answers
How to save a picture (take screenshot) from a camera in game? 10 Answers
Can I take a Picture with my Device 0 Answers