I think it’s a bug but I cannot Invoke an audio source.
WHAT I WANT:
Sound to play after .5 seconds
WHAT I TRIED(couldn’t find a code format in thread creator):
AudioSource aS;
Camera mainCam;
void Awake (){
aS = mainCam.GetComponent();
}
void Foo () {
aS.Invoke(“Play”, .5f);
}
WHAT THE DEBUG WINDOW SAYS:
error CS1061: Type ‘UnityEngine.AudioSource’ does not contain a definition for ‘Invoke’ and no extension method ‘Invoke’ of type ‘UnityEngine.AudioSource’ could be found. Are you missing an Assembly reference?
I have an Invoke function in the same script referencing a function on a different script but I don’t understand why it’s not working. Perhaps Unity forgot to put Invoke within the AudioSource library, or there is some funky scripting method for audio sources.
Unity Version 5.5.1f1 Personal 64 bit.
MonoDevelop