↧
Answer by Dave-Carlile
One of the [AddComponent][1] overloads takes a class name instead of a type. So just call it with the name of the class from your list. [1]:...
View ArticleAnswer by _Gkxd
Instead of storing the names of the classes, you can just store the list of components: Include this line at the top of your script using System.Collections.Generic; Somewhere inside the class List...
View ArticleAnswer by cjdev
You can do it but it's not pretty, you need to use the types and reflection like this: List componentList = new List(); componentList.Add(typeof(Rigidbody)); componentList.Add(typeof(Animator));...
View Article