Hybrid ECS DataProxies not updating

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.

1 Like

Bump, still looking for anyone who can help me find an answer to this, as GetComponentData is VERY slow (nearly 1 ms for about 80 entities)

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

Disabling

Using:
Unity 2018.3.6f1
Packages:

  • Burst 1.0.0-preview.9
  • Collections 0.0.9-preview.12
  • Entities 0.0.12-preview.24-timestampfix
  • Hybrid Renderer 0.0.1-preview.4
  • Jobs 0.0.7-preview.6
  • Mathematics 1.0.0-preview.1
1 Like

It’s not latest. Latest it’s 0.0.12 - preview.29. Don’t believe package manager about 0.0.12-preview.24-timestampfix.

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.

Yes, any update beyond preview-24 requires Unity 2019.1.

It wasn’t deprecated (yet?) but is discouraged:

https://discussions.unity.com/t/734317

[ ]'s

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 :frowning:
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?

Oh I missed this line :slight_smile:

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.

So then how would one get Entity-Data in a Monobehaviour-Context?
Especially with GetComponentData being as slow as it is…

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.

That’s kinda why I’m here :stuck_out_tongue:

lol, I’m just here to add to the confusion. :smile:

Don’t know why I didn’t think of this sooner, you can just replicate your own GameObjectEntity.

public class GameObjectEntity : MonoBehaviour, IConvertGameObjectToEntity
{
    public Entity Entity;
  
    public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
    {
        this.Entity = entity;
    }
}

I was experiencing this earlier and 5argon’s reply sums it up
https://discussions.unity.com/t/724522/5

I would just make a ComponentSystem to communicate the data from entity to gameobject

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?

Edit: Fixed broken Quote-tag

I never tried that route personally, I just made a system to handle bridging the data

All the code for this is in ComponentDataProxy and ComponentDataProxyBase in …/Unity.Entities.Hybrid/Components folder.