So basically I want to end with several ingame objects, each having few .cs scripts with monobehaviour. (different set of scripts on each object)
party of characters with their skills
Those scripts on each character can vary over time
characters learning new skills/abandoning old
So when the game starts, I want to attach the scripts to objects dynamically at runtime
based on player decision in skill tree
Is there any way how can I do this without using reflection?
EDIT: It seems I found solution how to make it work without reflection
public class TestSkill : MonoBehaviour {}
public class TestFireball : TestSkill {}
public class TestMeleeAttack : TestSkill {}
public class TestSkillBook : MonoBehaviour {
public MonoScript script;
void Start () {
System.Type t = script.GetClass();
TestSkill skill = gameObject.AddComponent(t) as TestSkill;
}
}