Limiting object tracking

I’d like to limit tracked objects to just those in the layer mask of the volume camera. Based on the debug output, error messages and statistics, it looks like this isn’t currently the case – is this something likely to be fixed, or should I be looking for other ways to filter the tracking?


Hello! You should indeed be able to filter tracked objects using the volume camera’s Culling Mask property. For example, if I create two cubes within the bounds of a volume camera–one in layer “Default” and one in layer “Water”–and set the Culling Mask property of the volume camera to only include “Default” (as opposed to the starting value, “Everything”), I only see the “Default” cube when I enter play mode with PolySpatial Runtime enabled or build to visionOS simulator. If that isn’t the case for you, I would encourage you to submit a bug report.

Yes, the culling mask is working in the sense that I cannot see the objects that are not in the mask, but they are still tracked (evidenced by the statistics window and many many errors being logged about them using unsupported features every frame). I would like them to not be tracked, in order to avoid excessive log spam and performance hit.

Ah, I see. Yeah, at the moment we track objects even if their layer doesn’t match the culling mask because the layer can change at run time–and if we weren’t tracking them, then we wouldn’t find out about the layer change. There is an exception to this for objects that belong to “Ignored Scenes,” as defined in the PolySpatial project settings, so you might be able to use additive loading to load objects in an ignored scene to avoid tracking.

However, I’ll bring the issue up with the team. In a future version we might be able to, for example, expose something like a callback that would allow you to filter tracked objects yourself.

Thank you – I found that the Ignored Scenes property isn’t exposed for serialization outside of POLYSPATIAL_INTERNAL, but I could set it up during a RuntimeInitializeOnLoad and that works perfectly for my particular use case.

Re: layer filtering in general – can I suggest tracking the gameobjects (for layer change) but not their components until the culling layer matches? Otherwise, a callback like you suggested would also work OK.

Actually I do still have an issue even using Ignored Scenes – I can’t use this to filter objects that are DontDestroyOnLoad.

Perhaps a global layer mask setting that can be used to exclude objects by layer? (In addition to the culling mask)

Is “Ignored Scenes” still an option in the latest version? I can’t seem to find where this Setting is.

We have a use case where we would benefit from being able to exclude most gameobjects from PolySpatial, and being able to ignore a base scene but have an additive Polyspatial scene would be very useful!

As @Alex_StudioDrydock mentioned, it is hidden behind the POLYSPATIAL_INTERNAL compiler flag, which I didn’t realize when I suggested it. If you add POLYSPATIAL_INTERNAL to “Scripting Define Symbols” in the player settings, you’ll see the “Ignored Scenes” configuration option, but keep in mind that this and anything else you see when POLYSPATIAL_INTERNAL is defined are totally unsupported in-progress development features and not at all guaranteed to work. I wouldn’t have mentioned it, but the code that checks the #define is included as source in the package, so it can’t be too secret. :wink:

Our current plan is to support ignoring trackers based on the presence of a custom component (that is, having that component on a GameObject will entirely prevent it from being tracked). We expect to add that feature fairly soon in an upcoming release.

1 Like

Without defining POLYSPATIAL_INTERNAL you can set up the ignore list at startup:


@kapolka I hope you don’t remove this scene filter when you add the “don’t track” component, as this component will not really help with our use-case (there is no reasonable way to attach this component to every game object in every scene).

1 Like

Thanks; I’ll add a note to that effect to the task. Would it help if you only had to add a component to a top-level node that would then prevent tracking on all its children? Or, I guess, what would your ideal solution be? So far, the options are:

  • Custom component to disable tracking.
  • The ability to set a callback to filter GameObjects for tracking (probably the most general solution)
  • Filtering GameObjects by layer (with a mask in the settings) (our concern here being that layers may be in short supply).
  • Filtering GameObjects by scene (currently hidden, but we could expose it).

That’s excluding the possibility of our automatically disabling the trackers for GameObjects that don’t match the volume camera mask, but that would take more work because of the way we currently track object changes. Still, definitely a possibility for future work.

I had assumed the custom component would also apply to children; that doesn’t help in the general case, as there are many top-level objects in every scene that the component would need to be applied to.

My preferred option is to filter GameObjects by a layer mask in the settings. This can easily be configured to be the inverse of the volume camera layer mask, so I think would make sense for a lot of games, and doesn’t impact games that do want to track everything.

The callback would be fine too but IMO is an unnecessary complication and runtime expense.

1 Like