- Home /
Audiosource list empty?
Hello, i am making a pretty basic text adventure game following a tutorial that i finished a while ago and i started adding new systems. I'm very new to unity, so please excuse any poorly written code. In my state object(code attached in the pastebin links below), i have a variable called optionsounds, which is a list in the editor that takes sounds and plays them when certain options are pressed with the number keys. In my main script(at the bottom) I try and acess it and play it, however using debug.Log i found that the list is completely empty while in the editor I have set the list to have a sound in the first option. When i put the sound in, it throws me a "this thing is null error", while my code explicitly checks that its not null before trying to play it, however if I just dont put anything in the list, it works fine.
Basically my main problem is that the list in state is empty when accessed in my main script.
Pastebin links: State script: https://pastebin.com/6CVBcJHL
Main Script:https://pastebin.com/hNc4p6um
Your answer
Follow this Question
Related Questions
Sound on Collision script. 2 Answers
.Shift() error 0 Answers
how to share sound to the network using PUN? 0 Answers
Firework Sounds 1 Answer
Undo/back system using a List/Array 2 Answers