Definition
PauseUpdateEventOfPrefabInstance(string prefabInstanceName)
Description
This function pauses the script’s Update() event of prefab instance prefabInstanceName.
Parameters
prefabInstanceName
Specifies the name of the prefab instance. You can also use the name “this” for this parameter. In this case, “this” refers to the prefab instance name that this script is attached to.
Example 1
function OnTriggerEnter(otherActorName) --nil means main character controller if otherActorName == nil then PauseUpdateEventOfPrefabInstance("1_animation_test_plane") end 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 enters “trigger1”, script’s Update() event of prefab instance “1_animation_test_plane” will be paused.
Example 2
--Name of script is PauseUpdateEventOfPrefabInstance2.lua function Init() PauseUpdateEventOfPrefabInstance("this") end function Update() end
If, in the Prefab Editor, you attach PauseUpdateEventOfPrefabInstance2.lua script to a Prefab, then “this” parameter in the PauseUpdateEventOfPrefabInstance function will point to instances of that Prefab in current VScene. For example, if you have an Instance named instance1_a from a Prefab named a to which this script is attached, “this” in PauseUpdateEventOfPrefabInstance function refers to the name instance1_a.
In this example, PauseUpdateEventOfPrefabInstance will pause the script’s Update() event of current prefab instance (for example, instance1_a).
PauseUpdateEventOfPrefabInstance