1

SoundRandomizer: AudioComponent

I'm working on a script that is based partly on the example script SoundRandomizer.cs - i am having difficulties with setting the Sound Source to the audio component of the object that contains the script. 

The way i understand the example script the parameter PlayOnAudioComponent = ON would cause that the sound is IN that object, moves with the object and would become more silent if i move away from the object.

This line of code from the example would find the audio component and return it for later use:

ObjectPrivate.TryGetFirstComponent(out LocalAudioComponent);

Not only in my own script, but already in the example script i seem to be unable to get hold of that audio component.

What am i missing, that the LocalAudioComponent remains null at any time?

- Should i add a <ComponentClass>? (which?)

- Should ObjectPrivate be set to the current container object? (how?)

- anything else that i'm missing?

 

 

 

8 comments

Please sign in to leave a comment.