Definition
DetachPrefabInstanceFromWater(string prefabInstanceName, string waterObjectName)
Description
This function detaches the prefab instance prefabInstanceName from the water waterObjectName. In this case, you can’t see the reflection of the prefab instance in the water.
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 that this script is attached to.
waterObjectName
Specifies the name of the water. You can also use the name “this” for this parameter. In this case, “this” refers to the water object that this script is attached to.
Note: You can’t use “this” string for both prefabInstanceName and waterObjectName at the same time.
Example 1
function Init() DetachPrefabInstanceFromWater("1_VandaEngine17-SamplePack1_house2", "water1") end function Update() end
Detaches prefab instance “1_VandaEngine17-SamplePack1_house2” from water object “water1”.
Example 2
--name of script is DetachPrefabInstanceFromWater2.lua function Init() DetachPrefabInstanceFromWater("this", "water1") end function Update() end
If, in the Prefab Editor, you attach DetachPrefabInstanceFromWater2.lua script to a Prefab, then “this” parameter in the DetachPrefabInstanceFromWater 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 DetachPrefabInstanceFromWater function refers to the name instance1_a.
This script detaches current prefab instance from the water object “water1”.
Example 3
--name of script is DetachPrefabInstanceFromWater3.lua function Init() DetachPrefabInstanceFromWater("1_VandaEngine17-SamplePack1_house2", "this") end function Update() end
Detaches prefab instance “1_VandaEngine17-SamplePack1_house2” from current water object. For example, if you attach the DetachPrefabInstanceFromWater3.lua script to a water named “water1”, then the name “this” will be equivalent to “water1”.
DetachPrefabInstanceFromWater