We are currently working on improving the documentation on Visual Scripting.
Here is a basic example of how to play a continuous machine gun loop while space is held.
RuntimeManager.CreateInstance
is used to create a new sound, then it is started in the enter state and stopped in the exit state. Note the instance needs to be stored in a variable otherwise we will lose our reference to it. Also note the use of RuntimeManager.AttachInstanceToGameObject
so that the Event Instance’s transform will follow the player’s position.State Graph:
![image](https://global.discourse-cdn.com/standard10/uploads/fmod/original/2X/2/274e82649a15e460b34f89d35e96f6d9c81b3c96.png)
Transition to “Firing”:
Transition to “Not Firing”: