Topic: Deactivate the markers outside the field of view ?

Imagine a map with for instance 400 markers all around the camera, each marker with a "look at camera" script, so it is  always facing the camera.

If the camera FOV is 90°, only 1/4 of the markers (about one hundred) are displayed in the game view, but the 300 others, not in the field of view, continue to follow the camera position. Would it be interesting, in terms of performance, to deactivate the "look at camera" for the markers that are not displayed, and even the markers themselves ?

Is there a way to know the number of markers which are in the camera field, to make an action (for instance recenter the camera) if no marker is visible.

Best regards, Phil

Re: Deactivate the markers outside the field of view ?

Hello.

You can try. Unity has an example of this.
https://docs.unity3d.com/ScriptReferenc … sible.html

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

3 (edited by philzmz 2021-05-22 08:23:26)

Re: Deactivate the markers outside the field of view ?

Alex Vertax wrote:

Hello.

You can try. Unity has an example of this.
https://docs.unity3d.com/ScriptReferenc … sible.html

Thanks for the asnwer, but there was another question in my previous post :

Is there a way to know the number of markers which are in the camera field, to make an action (for instance recenter the camera) if no marker is visible ?
Best regards
Phil

Re: Deactivate the markers outside the field of view ?

You need to iterate over all markers, and using Renderer.isVisible, check if it is visible and do the action that you need.
https://docs.unity3d.com/ScriptReferenc … sible.html

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.