Quantcast
Channel: Answers by "ThePersister"
Viewing all articles
Browse latest Browse all 99

Answer by ThePersister

$
0
0
You have a **health** variable and an **ammoSE** variable, neither of which you set, and they're private, so those **are probably null**. Try changing your Start method to: void Start() { AudioSource[] audios = GetComponents (); lowHPSE = audios [0]; lowAmmoSE = audios [1]; health = GetComponent(); ammoSE = GetComponent(); } I hope that helps, if it does, please accept my answer! It'd be much appreciated. If it doesn't, please show the null reference error, to clarify what line the error is thrown. Because alternatively, you could have less than 2 or 0 AudioSource components on the object and that would throw null references too. Best of luck! Cheers, ThePersister

Viewing all articles
Browse latest Browse all 99

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>