How to query a singleton entity with more than one component data?

I am new to Singleton entities and am confused about how they work.

I can get a singleton entity with the following code, as long as there is just one in existence, and this works great.

var playerEntity = GetSingleton<PlayerData>();

What I don’t understand it how to get access to other component data that this entity may also have… like transform, rotation, etc.

Thanks in Advance.

You can use GetSingletonEntity to get the entity, then GetComponent on that entity for the rest. The same API is also on EntityQuery.

2 Likes

Thanks that makes perfect senses.