public List<UnityEditor.MonoScript> components;
for (int j = 0; j < p.components.Count; j++)
{
gameObject.AddComponent(components[j].name);
Component c = g.GetComponent(components[j].name);
c.CallAMethod(); // Issue is here :(
}
So the above code shows a slightly modified version of the code I am trying to produce. My goal is to procedurally generate GameObjects that can have different components added to them depending on what they are. The problem is that once I have added the component, I don’t know how to access its members as I can’t rely on knowing what the component is.