Hi, How can I use some variable in gameComponent function argument?
string mystr;
mystr="myComponent";
gameObject.GetComponent<mystr>();
Hi, How can I use some variable in gameComponent function argument?
string mystr;
mystr="myComponent";
gameObject.GetComponent<mystr>();
GetComponent<“string”>() is obsolete, but you can still pass a dynamic type to the GetComponent function:
GetComponent(typeof(MyComponent));
However, it’s of fairly limited use. What exactly are you trying to achieve?