Hi All,
So I am trying to create a script which iterates through all of the scene game objects and if they have certain components, then they are added to a list which is later used for further processing. Currently the issue:
- I have two AudioSource components, each with different AudioClips
- Through debugging with print statement, I can see that Clip#1 is added x2 to the list, as opposed of clip#1 and clip #2 being x1 in list.
I am using an AudioStreamIDList.Add command to add to a pre-declared list below my namespace.
private void FindComponents()
{
GameObject[] AllObjects = FindObjectsOfType<GameObject>();
for (int i = 0; i < AllObjects.Length; i++)
{
if (AllObjects*.GetComponent<AudioSource>() != null)*
{
AudioStreamIDList.Add(“signal:” + AllObjects*.GetComponent().clip.name);*
print(i);
print(AudioStreamIDList*);*
}
}
XmlGenerator();
}