Scripting - Object clicks work with invisible objects

Here's a useful observation for designing interactivity. If you add an object-click script (e.g., Reflex's) to an object, it becomes clickable by mouse or by VR hand controller trigger. Before you click, though, you see a green highlight of the object and prompt text hovering over it. It's worth noting that the highlight and valid click surface is defined by the object's visible mesh, not its collision volume.

I wanted to point out that the object does not need to be actually visible. I tried two critical tests. In one test I took an object that did not have a back side. In the other case I used an object with a "Standard + Alpha Mask" material sporting a transparent albedo map. In both cases I found that the hovering text prompt shows up where the object exists. There was no green highlight, thankfully. And I could click on it.

So this feature works with front and back sides of a single-sided face and it works with completely alpha-surfaced meshes. One practical use of this is that you can create a simple square (or circle or whatever) plane mesh and add a pure alpha texture to it and use it as a sort of standard button container for your object-click script. You could plant these over the beautiful, sometimes large meshes you design and not need to chop them up into separate objects just for the object-click tool.

One other benefit of this trick is that you could hide the potentially ugly green highlight. Be careful, though, as this is a handy prompt. I would only recommend doing this if you think it will be very obvious to your visitors that they can and should click on things.


Please sign in to leave a comment.