#[Entities 1.0.0-pre.15] Error when calling EntityManager api at MonoBehaviour when exit playmode

1 messages · Page 1 of 1 (latest)

haughty flax
#

@small sleet When exit playmode, it will call at OnDisable() method at MonoBehaviour and if u use EntityManager api to do add/remove component then u will get error. I suspect it's caused by the entire Entities stuffs has been released and I just access the null. Any plan to make Entities stuffs release later than MonoBehaviour callback?

#

NullReferenceException: Object reference not set to an instance of an object
Unity.Entities.EntityQueryImpl.GetSingletonEntity () (at ./Library/PackageCache/com.unity.entities@1.0.0-pre.15/Unity.Entities/Iterators/EntityQuery.cs:1274)
Unity.Entities.EntityQuery.GetSingletonEntity () (at ./Library/PackageCache/com.unity.entities@1.0.0-pre.15/Unity.Entities/Iterators/EntityQuery.cs:2583)
xxx.OnDisable () (at Assets/xxxcs:63)

small sleet
#

no such plans i'm aware of. it makes sense that that would happen. what overall problem would it solve to change it?

haughty flax
#

😂 Actually i's just annoying that I see there's a lot of error spamming every time I exit playmode

cunning spindle
#

Just a heads up, crashing on quit is a TCR failure on some platforms so you'll need to manage this - it's not just an editor problem

#

(this is one of the reasons I constantly harp on that I believe accessing entity world from gameobjects is a poor idea)