What is the difference between:
I thought they should return the same thing, but the latter return null instead…
And what about
Always use get when possible (especially when networking).
GetComponent wil query the actual value as it is right Now.
Get takes a fixed state (critical for Multiplayer) of an EntitySet (which is how you should use it) or an Entity.
Note that an Entity is always just one vision/state of the actual Entity and you Control what components it contains (which is Why it Returns null)
You mean that getComponent returns the most updated value, while get return a value that might be obsolete?
Or better, get return the value as it was the last time “applyChange” was called on this entitySet? And instead getComponent makes an “ad hoc” query?
Your second conclusion is correct.
And ad hoc in Networking means requesting the value instead of just taking what the update tick brought.
Also getComponent might return null for entities in the getRemovedEntities
Entity.get() will also return null if the component is not in the set of components you asked for on the entity set.
Entity is a view of the entity at the last time applyChanges() was called. It’s the whole point of its existence, really.