LinkedObj.GetComponent("Int_" + LinkedObj.name).ButtonAction(); //Calls Int_Object's ButtonAction function
As you see… I MUST use the string parameter of GetComponent but I need to make it work on Android. All the loop-holes were using the Type parameter instead of String. I need a way to get it work as a string or convert (“Int_” + LinkedObj.name) into a component type.
Unity doesn’t support dynamic typing when porting to Android. If you’re planning to go mobile, you should always include #pragma strict at the top of your JS files. I’d personally recommend doing this, anyway.
If you’re interested in object-oriented programming, it offers a simple and performant solution: create an abstract “button” class with a virtual ButtonAction() method, so that you can create a variety of buttons which each do different things but can all be activated in the same way: