Open franklin-ross opened 6 years ago
In fact this seems true for pretty much any collection like IDictionary<T,TV>
, or even IEnumerable<T>
. Is this by design?
I've been creating ScriptableObjects
that implement these so I can share the data via the editor, but it's nice to have them implement the interface they represent.
I tried using SharedInstance
, as that seems to be the FullInspector way to do what I'm trying, but I get compile errors in the generated shared instance file:
[SerializeField]
public SharedInstance<Dictionary<BlockKind, GameObject>> BlockPrefabs;
Where the generated code is:
// This is an automatically generated script that is used to remove the generic
// parameter from SharedInstance<T, TSerializer> so that Unity can properly serialize it.
using System;
namespace FullInspector.Generated.SharedInstance {
public class SharedInstance_SystemCollectionsGenericSystem_Collections_Generic_Dictionary_BlockKind,UnityEngine_GameObject_ : SharedInstance<System.Collections.Generic.Dictionary<BlockKind,GameObject>> {}
}
I have discovered how to fix the generated code, so I've got a workaround for now.
I haven't dug too deeply, but it seems like having a class that implements both
BaseScriptableObject
andIList<T>
uses theBaseCollectionPropertyEditor
which throws aNullReferenceException
. I guess the order of some code somewhere needs to be updated so it decides to render as aScriptableObject
instead.The error looks like this: