-
-
Notifications
You must be signed in to change notification settings - Fork 221
Open
Description
I was writing an editor test where my sut calls Dispose on a LifetimeScope, which throws because it uses Destroy instead of DestroyImmediate.
This small override seems to fix it:
public class EditorSafeLifetimeScope : LifetimeScope
{
public new void Dispose()
{
DisposeCore();
if (this != null)
{
#if UNITY_EDITOR
if (!Application.isPlaying)
{
DestroyImmediate(gameObject);
return;
}
#endif
Destroy(gameObject);
}
}
}russelljahn
Metadata
Metadata
Assignees
Labels
No labels