#GetComponentData<T> from a Monobehaviour for re-access by reference

1 messages · Page 1 of 1 (latest)

delicate thicket
#

When I try and do this, it only stores a copy of the component, I was hoping to get a reference and be able to read data from it. Specifically I have a UI I'm wanting to update information from when it's open. Is the only way to accomplish this literally re-fetching the component each update?

dreamy heart
#

Not safe to hold a reference to entity data

#

The memory could move

#

If you want a reference temporarily there's a getcomponentRW

#

Again you shouldn't hold this outside of current scope

delicate thicket
#

I'll perform safety checks to ensure, It's mostly wanting to avoid the extra querying again to try and speed up reading the information. Don't need to write to it, just read

dreamy heart
#

I'm not sure how you intend to safety check it?

delicate thicket
#

GetComponentDataRW also requires a systemBase too, I mean if it's not possible it's not possible

#

I'm storing it as an interface, so checking if it's not != null is fine