Hey everyone,
I’m currently taking a course on Udemy and I am still very new and learning but I went back to one of the first projects I worked on and am trying to add audio to it just for some practice. I can’t figure it out though so I was wondering if anyone could help.
Let me describe how the game works. It’s a very simple text adventure game where it’s all done through the Canvas. The player reads the text, then makes a choice and presses 1 2 or 3 and depending on what they press, different text is loaded from a [SerializedField] from a “State” Scriptable Object into the Canvas replacing the text in the text component and changing where the buttons lead for the next player choice, also drawn from a [SerializedField].
Seeing as how each of these “States” stores the text for the next section, I also thought I could also “[SerializeField] AudioClip stateAudio”, so I did. I set each different audio to each of these “States”.
Problem is… I can’t figure out how to pull the audio from them and play it in the same sort of way that the text does. I’ve spent 4 hours on this, searched everywhere but have only gotten frustrated. I can’t figure out how to play the clips using C#.
I tried to explain things as best I could, hopefully someone will be able to understand what I mean. I can put up pictures too but the project is so simple that I think the above explanation might be enough. Any help would be amazing, thanks!