Definition
PlaySound(string soundObjectName1, string soundObjectName2, ..., string soundObjectNameN)
Description
This function plays ambient and 3D sounds soundObjectName1, soundObjectName2, …, soundObjectNameN. If the loop state of each ambient or 3D sound is true, the sound will be played continuously, otherwise it will be played only once.
Parameters
soundObjectName1, soundObjectName2, …, soundObjectNameN
Specify the name of the ambient and 3D sounds that should be played by this function. You can also use the name “this” for soundObjectName[N]. In this case, “this” refers to the ambient or 3D sound that this script is attached to.
Example
function Init() PlaySound("this", "river") end function Update() end
Assume that the above script is attached to an ambient sound named “ambient1”. Also, “river” in the example above is the name of a 3D sound. In our example, PlaySound function plays the current sound (which has a name equivalent to “ambient1”), and the 3D sound “river”.
PlaySound