Unity-Technologies / EntityComponentSystemSamples

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[user error] ECS Tutorial has type error?

tkgalk opened this issue · comments

Specifically this line: var config = SystemAPI.GetSingleton<Config>(); in https://github.com/Unity-Technologies/EntityComponentSystemSamples/tree/master/DOTS_Guide/ecs_tutorial.

The issue is that config.TankCount nor config.TankPrefab are not valid because config is of type Entity (that's what SystemAPI.GetSingleton<Config>() seem to be returning) instead of type Config. Casting it to Config didn't help either.

var config = SystemAPI.GetSingleton<Config>();

Never mind, I'm dumb. I was using GetSingletonEntity instead of GetSingleton. That method does what has to be done, and that's the one that should be used. The tutorial is right, I can't read.