What I am looking for is a way to find a script/MonoBehaviour during runtime that can attach to a GameObject as a component dynamically. There could be thousands of these scripts (that is the extreme case), and is noted by an underscore followed by a number (depending on the GameObject used, called “serialNumber” for now). Here is what I have:
//someObject.AddComponent<"_" + serialNummber>();
//someObject.AddComponent(typeof("_" + serialNummber));
I get an error saying that this does not work, but is there another way to do this (and I hope I don’t have to hard code this by typing in every single serial number through a switch statement, that would be the worst case scenario). Any help is appreciated.