ConnectedEntity component
Query
Objects with the ConnectedEntity component on them are treated in a special way by the query system. If the entity they are connected to is present in a query, then they are also included automatically. They are also excluded/removed automatically when the entity they are connected to goes out of the query.
Usage
You need to add the ConnectedEntity component to entity. The entity will disappear from all queries that don't have the entity this is connected to. The entity has to be converted to its SerializeEntityID before it can be used in the ConnectedEntity component. This can be done using the CoherenceMonoBridge.UnityObjectToEntityId static function.
var entity = coherenceSync.LinkedEntity;
if(entity != Entity.Null)
{
var serializeId = CoherenceMonoBridge.UnityObjectToEntityId(other)
EntityManager.AddComponentData(entity,
new ConnectedEntity
{
Value = serializeId
}
);
} Please note that the ConnectedEntity component is only available in from code in ECS at the moment. It will be fully integrated with the editor flow in the next release.
Last updated
Was this helpful?

