Skip to content

[BUG] Playing while prefab selection with serializerefence is giving errors #89

@D4rWiNSS

Description

@D4rWiNSS

What happened?

If you have an array like this:

[SerializeReference, SubclassSelector] ISkillEffect[] effects = Array.Empty<ISkillEffect>();

and you select a prefab that contains that line before clicking to play. When you click play you get the following errors:

UnityException: GetName can only be called from the main thread. Constructors and field initializers will be executed from the loading thread when loading a scene. Don't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.

ArgumentException: An item with the same key has already been added. Key: 35651587

NullReferenceException: Object reference not set to an instance of an object UnityEngine.UIElements.UIR.MeshGenerator.DrawText (System.Collections.Generic.List1[T] vertices, System.Collections.Generic.List1[T] indices, System.Collections.Generic.List1[T] materials, System.Collections.Generic.List1[T] renderModes) (at <b2858548e25c4db4bad82249a9cb7b34>:0) UnityEngine.UIElements.UITKTextJobSystem.AddDrawEntries (UnityEngine.UIElements.MeshGenerationContext mgc, System.Object _) (at <b2858548e25c4db4bad82249a9cb7b34>:0) UnityEngine.UIElements.UIR.MeshGenerationDeferrer.Invoke (UnityEngine.UIElements.UIR.MeshGenerationDeferrer+CallbackInfo ci, UnityEngine.UIElements.MeshGenerationContext mgc) (at <b2858548e25c4db4bad82249a9cb7b34>:0) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

Package Version

1.6.1

Unity Version

Unity 6.0.58f2

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions