unity get all game objects with component from a list code example
Example: unity find all objects with script
public void GetAllObjectsWithScript() {
ScriptName[] list = FindObjectsOfType(typeof(ScriptName)) as ScriptName[];
foreach(ScriptName obj in list) {
// Do whatever
}
}