Definition
SetPrefabInstanceShininess(string prefabInstanceName, float shininess)
Description
This function sets the shininess of prefab instance prefabInstanceName. In order for this function to change the shininess of prefab instance, you must enable the material of prefab instance prefabInstanceName. For this purpose, you can click on the prefab instance prefabInstanceName in the Prefabs and GUIs section of Vanda Engine editor and click the Edit button to activate the Enable Prefab Instance Material option in the dialog that appears. You can also use the EnablePrefabInstanceMaterial function to enable the prefab instance material at runtime. In this case, prefab instance material is used instead of its prefab material.
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.
shininess
Specifies the shininess of prefab instance. This value must be greater than or equal to 0.0.
Example 1
function Init() EnablePrefabInstanceMaterial("1_VandaEngine17-SamplePack1_f1_barrel") SetPrefabInstanceShininess("1_VandaEngine17-SamplePack1_f1_barrel", 20.0) end function Update() end
First we enable the material of prefab instance “1_VandaEngine17-SamplePack1_f1_barrel”. Then we set the shininess of prefab instance “1_VandaEngine17-SamplePack1_f1_barrel” to 20.0.
Example 2
--Script name is SetPrefabInstanceShininess2.lua function Init() EnablePrefabInstanceMaterial("this") SetPrefabInstanceShininess("this", 20.0) end function Update() end
If, in the Prefab Editor, you attach SetPrefabInstanceShininess2.lua script to a Prefab, then “this” parameter in the SetPrefabInstanceShininess 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 SetPrefabInstanceShininess function refers to the name instance1_a.
In this example, we enable the material of current prefab instance (for example, instance1_a). Then we set the shininess of current prefab instance (for example, instance1_a) to 20.0.
SetPrefabInstanceShininess