I have a system set up which checks if objects are in view of the camera.
This writes data to a IsVisible-Component (IComponentData with a ComponentDataWrapper-class for Hybrid).
However, my ComponentDataWrapper-class (yes, I’m on a somewhat older version of ECS) does not get updated until I actually select the GameObject in the hierarchy.
Do I need another system to update my DataWrapper-Instances?
If so, how would I go about doing that?
Edit:
World.Active.GetOrCreateManager().GetComponentData(GetComponent().Entity).Value does actually seem to give the proper value…
So it’s just the proxy.
Having just updated all of my packages to the latest versions, I can confirm this still happens on the latest versions…
For some reason the “IsVisibleComponent”-Value (the actual IComponentData) does not Update (as far as the dataproxy is concerned) unless I select the GameObject in the Hierarchy.
Visual:
(Green Line is forward of Camera, Spheres are the Objects that are supposed to turn on (switch state, not enable/disable) when viewed)
Enabling
I remember this issue from months ago but very old now.
There’s no point using old packages as stuff changes constantly and things get fixed/deprecated.
I think wrapper and GameObjectEntity are going.
Preview.24 is the highest version that shows up on Unity 2018.3 (I think the higher ones depend on Unity 2019)
Wrapper is already gone (renamed to ComponentDataProxy).
GameObjectEntity is the basis for the Hybrid system, so I don’t think that’ll be getting removed anytime soon.
Yeah sorry, I meant proxy which is the same thing. It was just a rename of wrapper.
I think even GameObjectEntity is going too because it conflicts with new ‘Convert To Entity’ component.
There’s new IConvertGameObjectToEntity but I’m still a bit confused on it all as there doesn’t seem to be any new hybrid components using it like ‘Copy Transform To Game Object’.
yeah that just converts gameobjects to entities… Basically ripping out any form of Hybrid, and moving to Pure…
Still doesn’t help me with the proxy not updating
For some reason it does update if it’s selected in the hierarchy (and showing values in the inspector), so it is able to update it, but doesn’t do it by default?
I’m not sure this is true. I can still access my SpriteRenderer on a ‘Convert To Entity’ GameObject from a ComponentSystem.
That’s why I’m not sure what’s happening with GameObjectEntity. It’s only there to work with ComponentDataProxy and as Joachim himself has said, quoted above by elcionap, they want people to stop using that completely.
That’s a good question and I don’t know.
How do you get Translation/Rotation/LocalToWorld components on a GOE when their proxy’s are deprecated?
Hopefully someone smarter can clarify.
Creating an extra ComponentSystem to get the data out seems a bit overkill to me; I’m only using the entities here to check if my GameObject is in view of a camera (Camera.WorldToViewPortPoint is quite heavy, so I parallelize it for the roughly 80 ‘chambers’ around the player), and thus running a job without any entities would probably perform better…
Looking at the thread you linked, and @5argon 's reply, could you tell me where I could find OnBeforeSerialize() so I can try calling it manually?