This function plays video videoName once.
Specifies the name of the video object. You can also use the name “this” for this parameter. In this case, “this” refers to the video object that this script is attached to.
--Name of script is PlayVideoOnce1.lua function Init() PlayVideoOnce("this") end function Update() end
In this case, “this” string in the PlayVideoOnce points to the video that PlayvideoOnce1.lua script is attached to. For example, if PlayVideoOnce1.lua script is attached to a video object named “video1”, “this” will be equivalent to the name “video1”. In our example, PlayVideoOnce function plays the current video object, which is “video1”, once.
function OnTriggerEnter(otherActorName) PlayVideoOnce("video1") end function OnTriggerStay(otherActorName) end function OnTriggerExit(otherActorName) end
Assume that the above script is attached to a trigger named trigger1. Whenever the main character or a prefab instance that has dynamic physics enters “trigger1”, video “video1” will be played once.PlayVideoOnce