c# - Instantiating an array of inaccessible class through reflection -
this first question here first of - hello everyone.
now question.
i helping in development of game using unity3d engine. need use curve editor
describing scale of damage of given spell. there curve editor class desired functionality in c# assembly of unity3d engine, inaccessible. tried instantiate object of type via reflection. encountered problem. constructor of class requires few arguments 1 of happens array of inaccessible class. , here problem. able construct object via reflection not array of objects of type. here constructor:
public curveeditor(rect rect, curvewrapper[] curves, bool minimalgui){...}
i able construct curvewrapper
object reflection
, not whole array. tried create object[]
array , put few curvewrapper
objects inside when pass array constructor through reflection invalid argument exception.
can assist me on one?
thank you.
i suspect you're looking array.createinstance
.
type type = ...; // curvewrapper ilist array = array.createinstance(type, 2); array[0] = activator.createinstance(type); array[1] = activator.createinstance(type);
i have though, if curveeditor
inaccessible, wouldn't try @ reflection. if works now, view entirely reasonable unity3d folks make incompatible changes later. messing non-public apis leads brittle code.
Comments
Post a Comment