hi guys, im a new in unity and im a little bit confused… i just want to do some coding can any one help??
i wanna show a fullscreen picture when i click an object in the scene with an exit button, so how can i do that ?? there is more than 10 objects , so do i have to make an array ?? is there a visible invisible property for a photo?? or load from the hard drive when i want to show it??? and more it there a mirror material to make the floor reflective??
thanks guys in advance , i really appreciate your help
An easy way to do this is to put the clickable objects inside an empty parent object and attach the following script to the parent:-
var showing: boolean;
var currPic: Texture2D;
var exitButtonRect: Rect;
function OnGUI () {
if (!showing) return;
GUI.DrawTexture(Rect(0, 0, Screen.width, Screen.height), currPic);
if (GUI.Button(exitButtonRect, "Exit")) {
showing = false;
}
}
function ChangePicture(newPic: Texture2D) {
showing = true;
currPic = newPic;
}
This simply waits for a message from another object specifying which picture to show. Attach the following script to each child object:-
var myPic: Texture2D;
function OnMouseDown() {
SendMessageUpwards("ChangePicture", myPic);
}
…and on each child object, drag a different texture to the myPic property. This script will send a message to the parent object to show the myPic image when the a click occurs on the child.
oh! finally an answer! that’s very kind of you i will try that…
Hi andee,
I have a one question regarding pic frame in unity scene view. I have created a scene view using 3d model and now I want to put pic frame on the wall in scene view. Any idea how to dot that? any help would be appreciated.
Sumit
Hi ,
I have one question regarding clicking an object to show picture. I have one photo frame in 3d. I want to keep changing frame picture when I click on frame. Any idea how to do that? In your previous reply I can see its only works for 2d . My frame is in 3d. Any help would be appreciated.
Thanks,
Sumit