System.ArgumentException : Unknown Type:CommonEcs.EcsHashMap2[System.UInt16,CommonEcs.ByteBool]` All ComponentType must be known at compile time. For generic components, each concrete type must be registered with [RegisterGenericComponentType].
I’ve encountered this error before and fixed it by creating an AssemblyInfo.cs file and add [assembly: RegisterGenericComponentType()] calls in it. I applied the same fix here and it no longer works. Now I’m confused how to fix this.
It’s maybe because I’m using it in another environment that the fix didn’t work. I’m trying to make my unit tests work so the code is running in test environment. There shouldn’t be any difference, but maybe there is.
Or it could be that AssemblyInfo is placed in the wrong folder. But I’ve tried everything. Tried it in the testing folder, then in the folder where EcsHashMap resides. Both cases don’t work.
Every time you use a generic struct or component like EcsHashMap<K, V>, the editor will throw out that error. The fix is to create a file named AssemblyInfo.cs in the same project/folder where such struct is used with the following content:
using Unity.Entities;
[assembly: RegisterGenericComponentType(typeof(EcsHashMap<ushort, ByteBool>))]
// You can specify more concrete types here
@davenirline Thank you for the tip! While I’m no longer getting errors, the inspector is now no longer showing any input fields where I can edit the contents (I am using ComponentDataProxy for this).
The EntityDebugger shows the data correctly though (even if the naming is a bit wierd):
Is that something you had to fix as well? Any hints would be appreciated
Here’s the full source Code that I have and is not working as expected:
using Unity.Entities;
public interface ILight {}
[System.Serializable]
public struct ElementData<T> : IComponentData {
public int units;
}
public class LightComponent : ComponentDataProxy<ElementData<ILight>> { }