Skip to main content
added examples
Source Link

You can add script at runtime. You can create an empty objects with a script that "browse" the 200 or more objects and atach the sript to each of them

AtachScriptAtRunTime

ExamoleExample: to add the script named FoobarScript to the game object use:

gameObject.AddComponent ("FoobarScript");

Clearly you must recognize all the objects. (example you can use FindGameObjectsWithTag) Full example:

objList = GameObject.FindGameObjectsWithTag("MeaningfullTagName");        
foreach (GameObject obj in objList ) {
   obj.AddComponent ("YourScript");"
}

You can add script at runtime. You can create an empty objects with a script that "browse" the 200 or more objects and atach the sript to each of them

AtachScriptAtRunTime

Examole: to add the script named FoobarScript to the game object use:

gameObject.AddComponent ("FoobarScript");

Clearly you must recognize all the objects. (example you can use FindGameObjectsWithTag) Full example:

objList = GameObject.FindGameObjectsWithTag("MeaningfullTagName");        
foreach (GameObject obj in objList ) {
   obj.AddComponent ("YourScript");"
}

You can add script at runtime. You can create an empty objects with a script that "browse" the 200 or more objects and atach the sript to each of them

AtachScriptAtRunTime

Example: to add the script named FoobarScript to the game object use:

gameObject.AddComponent ("FoobarScript");

Clearly you must recognize all the objects. (example you can use FindGameObjectsWithTag) Full example:

objList = GameObject.FindGameObjectsWithTag("MeaningfullTagName");        
foreach (GameObject obj in objList ) {
   obj.AddComponent ("YourScript");"
}
added 307 characters in body
Source Link

You can add script at runtime. You can create an empty objects with a script that "browse" the 200 or more objects and atach the sript to each of them

AtachScriptAtRunTime

Examole: to add the script named FoobarScript to the game object use:

gameObject.AddComponent ("FoobarScript");

Clearly you must recognize all the objects. (example you can use FindGameObjectsWithTag) Full example:

objList = GameObject.FindGameObjectsWithTag("MeaningfullTagName");        
foreach (GameObject obj in objList ) {
   obj.AddComponent ("YourScript");"
}

You can add script at runtime. You can create an empty objects with a script that "browse" the 200 or more objects and atach the sript to each of them

AtachScriptAtRunTime

Clearly you must recognize all the objects. (example you can use FindGameObjectsWithTag)

You can add script at runtime. You can create an empty objects with a script that "browse" the 200 or more objects and atach the sript to each of them

AtachScriptAtRunTime

Examole: to add the script named FoobarScript to the game object use:

gameObject.AddComponent ("FoobarScript");

Clearly you must recognize all the objects. (example you can use FindGameObjectsWithTag) Full example:

objList = GameObject.FindGameObjectsWithTag("MeaningfullTagName");        
foreach (GameObject obj in objList ) {
   obj.AddComponent ("YourScript");"
}
Source Link

You can add script at runtime. You can create an empty objects with a script that "browse" the 200 or more objects and atach the sript to each of them

AtachScriptAtRunTime

Clearly you must recognize all the objects. (example you can use FindGameObjectsWithTag)