/// <summary> /// Add component that already exists /// </summary> /// <param name="component">Component to add</param> /// <returns></returns> internal object AddComponent(object component) { CoreComponent instance = (CoreComponent)component; Components.Add(instance); instance.Parent = this; instance.Awake(); instance.Start(); return(instance); }
/// <summary> /// Add component by string /// </summary> /// <param name="classname">Component name</param> public object AddComponent(string classname) { System.Type type = System.Type.GetType(classname); CoreComponent instance = (CoreComponent)System.Activator.CreateInstance(type); Components.Add(instance); instance.Parent = this; instance.Awake(); instance.Start(); return(instance); }