Hello, I need to run some code when only one instance of an ISharedComponent is present.
I could use queries and/or jobs to calculate how many instances of a particular component there are, but it would be wasteful for such a simple operation. Is there some currently undocumented api to do this or am I just out of luck?
No, you are out of luck. It’s not in the interface, so it’s up to the implementer of IRefCounted to keep track of the count however they like.
Thanks for the reply. I guess for now I’ll just store the count in a NativeHashMap and update it every frame using WithChangeFilter. It’s not ideal but until I come up with something better, it works