Ok, so i know you cant drag objects from the hierarchy into a prefab in the inspector.
i have my sound effects on objects in the hierarchy, and i want the prefabs to use them as the game goes.
this code does work in start of the prefabs script:
enemyExplodesSound = FindObjectOfType<AudioSource>();
But i’m not sure if this is a good way of doing this, i read bad things about FindObjectOfType that its slow.
I tried GetComponent instead but that didnt work.
my audio objects are in an object called
—EnemySounds—
EnemyExplodes (This is where the audio source is)
so how do i reference that?