Invisible Planes Still Clickable?


#1

I have created a project with multiple 2D planes that can each be toggled visible or invisible by a nearby button, creating “pop-up” windows. Each of these pop-ups can be tapped to launch a full screen video. However, even when these pop-ups are invisible, if they overlap a button, they launch their video when the user thinks they are tapping on the button behind it.

Is there a way to completely disable a plane when it is invisible, so that it can only be tapped when it is visible?


#2

Nevermind - I just figured it out: toggling on or off accordingly in the “behavior” panel for a given panel’s state.


#3

Hi There,

While it looks like you’ve managed to figure out the issue allow me to elaborate for the sake of anyone else with this question :slight_smile:

The ‘visible’ property of the plane node sets it to be either visible or invisible but does not affect the touch events that can be fired from it, you need to uncheck the ‘enabled’ checkbox if you want to disable that functionality.

image

Cheers,
Mark


#4

Hello,

What do you do if you want to enable that functionality once the plane becomes visible again?

Thank you
Tom


#5

Hello @tom,

This depends the way u’ve build your project. I think the most common and easy way is by using any variable with a logic check like “if/else”. Like:

let checkVisible: boolean = false;

button1.on("pointerup", ()=>{
     plane.visible(false)
     checkVisible = true
     click.enabled(true)
}) 

button2.on("pointerup", ()=>{
     if(checkVisible){
         plane.visible(true)
         checkVisible = false
         click.enabled(true)
     }
})

You can also try to do this by switch, controllers, Z.after and etc. How I said, this depends of how you’ve build your project. Has several ways of doin’ this!

This site has JS references for scripting: https://www.w3schools.com/js/js_if_else.asp

att, Higão.


#6

Thank you so much. It’s the plane.enabled(true) that I was looking for. I added this to the condition that makes sthat same plane visible and now when my plane appears it’s URL link hotspot also becomes active.

Thank you!!
Tom


#7

@tom Hello!

That’s cool, I feel happy helping you out!

att, Higor.