Greeting,
I was wondering is it possible to add multiple different scripts using array to same game object at the beginning of runtime.
This is a pseudo-code I think of:
public GameObject TargetObject;
public string[] ScriptsToAdd;
void Start(){
for(int i = 0; i < ScriptsToAdd.Length; i++){
TargetObject.addComponent<ScriptsToAdd[i]>();
}
}
If I did something wrong here, please do let me know.
AddComponentinstead ofaddComponent. Second, you need a type, not a string. It won't work imo. adding-component - you need to get a type using its literal name.