Simple way to implement blacklight (invisible objects visible under flashlight)?

I’m attempting to build an equivalent to Home - HandwashingForLife® , where specific objects are only visible when the player is shining a special light on them. I assume that decals are the easiest way to actually create the text and attach it to meshes, I know I can toggle its visibility by either disabling the decal, or messing with its alpha channel, and attach a script to the decal to toggle its visibility. What I’m stuck on is the light itself: how would I go about projecting a cone-shaped area of effect that could return a reference to any decals inside of it?

If you google, you’ll find a cone shaped primitive object available. I would think you could simply use this. If object in cone bounds, or on trigger stay has tag glow, glow.

Oh hey, perfect! Thanks muchly, I had no idea that unity could make cone primitives- I’d assumed I would end up with a square or spherical bounding object and do some kind of arcane math to check for a cone inside of that.

1 Like

While that would probably work you can get a better effect by rendering the cone by itself to a RenderTexture and using it as a mask. This would allow the player to only reveal/illuminate whatever part of the decal was in the light and wouldn’t require colliders. Provided you have a Pro license obviously.

I’m still cludging along on free, but I know I’ll need to update to pro eventually, so that seems like an excellent solution to write down for when I’m not quite as hobbled, thank you! ^^

I need some Examples,Who can help me?Thanks much!!