I simply just want to detect when a player enters a new area and display a UI “You discovered x”
Hmm seems like I’ll have to use a loop to constantly check the region though? Wouldn’t a on touch event be more efficient?
.Touched
will not tell when someone leaves this region if you’re doing anything after they leave the region. Also sometimes .Touched
may not react with the character.
You can also use the spacial query apis instead.
I like using “touch boxes”, have a transparent 3D anchored box that you can touch (no collision), hit it with a touch event and that’s it. Easy to use, non-complex, just need to set some precautions for it not to overdo/spam when not needed.
On games with maps, I use a table with IDs of each area and a value/attribute related to the player indicating their current location so it does not trigger if current location == touch box location.
Your go for this situation is a .Touched event. There is no point to have a region check or using unnecessary modules for this. Simply listen for .Touched and make sure the player has not already discovered the area (if that is what you want it for).