Definition
PlayResourceSoundLoop(string resourceDirectoryName_resourceFileName.ogg)
Description
This function plays resource sound resourceDirectoryName_resourceFileName.ogg continuously. 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") end end function OnTriggerStay(otherActorName) end function OnTriggerExit(otherActorName) --nil means main character controller if otherActorName == nil then PlayResourceSoundLoop("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 “fire.ogg” resource sound located in “Sounds” directory–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).
When the main character exits “trigger1”, the resource sound “fire.ogg” will be played continuously.
PlayResourceSoundLoop