- Home /
Click on two objects to render third
I have 3 objects in a scene, one of them is not rendered. I need to click on the two visible ones (one after the other) so that the third will appear. I'm starting with the below code to detect the first object. How would I detect them both. Like... If this is clicked and this is clicked then this becomes visible.
function OnMouseOver ()
{
if(Input.GetMouseButtonDown(0))
Debug.Log("One object clicked");
}
Answer by TranceDreams · Oct 01, 2013 at 01:16 AM
gameObject.renderer.enabled = true/false to toggle visibility you can make two boolean vars to check against, ie:
var foo1 : boolean; var foo2 : boolean;
if(foo1 && foo2) invisibleObject.render.enabled = true else invisibleObject.render.enabled = false
Answer by superventure · Oct 01, 2013 at 12:40 AM
gameObject.renderer.enabled = true/false to toggle visibility and you can make two boolean vars to check against, ie:
var foo1 : boolean;
var foo2 : boolean;
if(foo1 && foo2)
invisibleObject.render.enabled = true
else
invisibleObject.render.enabled = false