Search Unity

Bug ArgumentException: 'type' parameter is abstract and can't be used in the ObjectFactory

Discussion in 'Editor & General Support' started by MasonWheeler, Feb 6, 2021.

  1. MasonWheeler

    MasonWheeler

    Joined:
    Apr 2, 2016
    Posts:
    219
    I've got a class whose parent is UnityEngine.Object. (Yes, I really do want it to be a UE Object. No, I don't want it to be a ScriptableObject.)

    I'm trying to instantiate a member of this class. I call ObjectFactory.CreateInstance<MyObject>() and I get a bizarre error:

    ArgumentException: 'type' parameter is abstract and can't be used in the ObjectFactory: MyObject

    The error is clear, straightforward, well-worded... and completely wrong, as this is not an abstract class. I checked in the reference source, and that error message isn't found anywhere. There is a check to see if the class is abstract, but it gives a different error message which I'm not seeing, which means that this is coming from the black box C++ code somewhere.

    Does anyone know what can cause ObjectFactory to give a false positive here, and how I can work around it?
     
    Bodix_ and Bogdan_Nikolayev like this.
  2. Bodix_

    Bodix_

    Joined:
    May 6, 2018
    Posts:
    15
    The same... Have the bug in the fundamental feature (object creation).
     
  3. Malbers

    Malbers

    Joined:
    Aug 7, 2015
    Posts:
    2,558
    I still get that error... same case here :(
    Same bug
    A year later...