Definition
DisablePrefabInstanceMaterial(string prefabInstanceName)
Description
This function disables the material of prefab instance prefabInstanceName. In this case, its prefab material is used instead of prefab instance material. By default, prefab instance material is disabled.
Parameter
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.
Example 1
function Init() DisablePrefabInstanceMaterial("1_VandaEngine17-SamplePack1_f1_barrel") end function Update() end
This script disables the material of prefab instance “1_VandaEngine17-SamplePack1_f1_barrel”.
Example 2
--Script name is DisablePrefabInstanceMaterial2.lua function Init() DisablePrefabInstanceMaterial("this") end function Update() end
If, in the Prefab Editor, you attach DisablePrefabInstanceMaterial2.lua script to a Prefab, then “this” parameter in the DisablePrefabInstanceMaterial 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 DisablePrefabInstanceMaterial function refers to the name instance1_a.
This script disables the material of current prefab instance (for example, instance1_a).
DisablePrefabInstanceMaterial