Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Generic IComponentData exception on p30

Discussion in 'Entity Component System' started by GilCat, Apr 7, 2019.

  1. GilCat

    GilCat

    Joined:
    Sep 21, 2013
    Posts:
    676
    I have posted about it here, but decided to create a new thread for visibility.
    After updating to Entities 0.0.12 preview30 i start getting an exception every time i stop the player.
    InvalidOperationException: Late bound operations cannot be performed on fields with types for which Type.ContainsGenericParameters is true.
    System.Reflection.MonoField.CheckGeneric () (at <23c160f925be47d7a4fd083a3a62c920>:0)
    System.Reflection.MonoField.SetValue (System.Object obj, System.Object val, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Globalization.CultureInfo culture) (at <23c160f925be47d7a4fd083a3a62c920>:0)
    System.Reflection.FieldInfo.SetValue (System.Object obj, System.Object value) (at <23c160f925be47d7a4fd083a3a62c920>:0)
    Unity.Entities.TypeManager.ClearStaticTypeLookup ()

    Here is a simple code snipped that will make this exception come to life:
    Code (CSharp):
    1. public struct GenericComponent<T> : IComponentData where T : struct {
    2.   public T Value;
    3. }
    Everything works fine but for this error being spammed when the World is shutdown is just annoying.

    What is Unity plan on this? Will IComponentData with generics be forbidden in the future?
     
  2. Xerioz

    Xerioz

    Joined:
    Aug 13, 2013
    Posts:
    104
  3. GilCat

    GilCat

    Joined:
    Sep 21, 2013
    Posts:
    676
    Kinda...