If we remove the AudioSource component the sound plays exactly the same because we’re not getting the component via GetComponent().
Was this a mistake or it will be needed for something else later?
If we remove the AudioSource component the sound plays exactly the same because we’re not getting the component via GetComponent().
Was this a mistake or it will be needed for something else later?
Hi Nelson,
From which game object do you remove the AudioSource component? And to which script are you referring to?
Well, not sure what Nelson did. But I think he might be referring to the Coin in the TileVania project. When I turn off the AudioSource component the sound will still play regardless of if its there or not. Within the CoinPickup script we write this line of code:
AudioSource.PlayClipAtPoint(coinPickupSFX, Camera.main.transform.position);
And that seems to be enough regardless of if there is an AudioSource attached to the Game Object or not.
Hi, sorry for not coming back to the thread.
That’s exactly what stealthyshiroean mentioned, you don’t need the AudioSource component attached to the Coin object.
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.