You need to look up reflection. [Convert.ChangeType()][1] in specific.
The problem with using reflection in Unity is it isn't supported by all platforms (to the best of my knowledge).
If it's just a case of proper subtyping and you don't have many types, you could cheat and use a switch statement (switch on the string and in each case do a normal cast).
Dave has a good point. What you are trying to do may not be necessary. Why do you think you need to cast? It might not be the best solution for the problem you are trying to solve.
[1]: https://msdn.microsoft.com/en-us/library/system.convert.changetype(v=vs.110).aspx
↧