Definition
StopResourceSound(string resourceDirectoryName_resourceFileName.ogg)
Description
This function stops resource sound resourceDirectoryName_resourceFileName.ogg that is being played. You can go to the Project Resources section through the Script Utility dialog (Tools > Script Editor > Tools > Script Utility), select the desired resource sound and hit “Copy Folder_File Name” button to copy the full name of the resource.
Parameters
resourceDirectoryName_resourceFileName.ogg
Specifies the full name of the resource sound.
Example
function OnTriggerEnter(otherActorName) --nil means main character controller if otherActorName == nil then LoadResource("Sounds", "fire.ogg") PlayResourceSoundLoop("Sounds_fire.ogg") end end function OnTriggerStay(otherActorName) end function OnTriggerExit(otherActorName) --nil means main character controller if otherActorName == nil then StopResourceSound("Sounds_fire.ogg") end end
Assume that the above script is attached to a trigger named “trigger1”. Whenever the main character enters “trigger1”, we load and play “fire.ogg” resource sound –In order for LoadResource function to load the resource sound, you must first add “fire.ogg” sound resource through the Add Resource to Current Project dialog (File > Project > Add/Remove Resource to/from Current Project).
Whenever the main character exits “trigger1”, the resource sound “fire.ogg” will stop.
StopResourceSound