terça-feira, 7 de junho de 2016

BP Compendium 2: Construction Script

Construction Script

"Construction Script" is a special function that all Blueprints have that will be performed when the Blueprint is added to the level and when there is any change in their properties. The "Construction Script" has a separate tab where the actions to be performed can be placed.

As an example, create a new blueprint, add a component of the type "Static Mesh" and choose the "Shape_Cylinder" as "Static Mesh". See the image below that the "Static Mesh" already has a default material. The "Construction Script" will be used to allow the material to be set in the level editing and independently for each object of this blueprint.

Create a variable named "Material Type" using the type "Material", select the "Editable" option. This will allow the value of this variable to be changed on an object that has been placed in the level.

The "Construction Script" uses the "Set material" function to define the type of material of the "Static Mesh" according to the material selected in the variable "Material Type". Whenever the "Material Type" is modified, the "Construction Script" runs again updating the object with the new material.

Table of Contents