File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -20,3 +20,37 @@ component = self.uobject.get_actor_component('Mesh')
2020material = ue.load_object(Material, ' /Game/Materials/Iron' )
2121component.set_material(index, material);
2222```
23+
24+ Creating a Material (editor only)
25+ ---------------------------------
26+
27+ ``` py
28+ from unreal_engine.classes import Material
29+ new_material = Material()
30+ new_material.set_name(' New Funny Material' )
31+ new_material.save_package(' /Game/Materials/NewFunnyMaterial' )
32+ ```
33+
34+ Creating a Material Instance (editor only)
35+ ------------------------------------------
36+
37+ You have two ways to create a instanced material:
38+
39+ (new_material is a reference to a previously created/loaded material)
40+
41+ ``` py
42+ from unreal_engine.classes import MaterialInstancedConstant
43+
44+ material_instance = MaterialInstancedConstant()
45+ material_instance.set_name(' New Funny Material Instance' )
46+ material_instance.set_material_parent(new_material)
47+ material_instance.save_package(' /Game/Materials/instanced' )
48+ ```
49+
50+ or the shortcut:
51+
52+ ``` py
53+ import unreal_engine as ue
54+ # the material instance will get the name of the parent with the _inst suffix
55+ material_instance = ue.create_material_instance(new_material)
56+ ```
You can’t perform that action at this time.
0 commit comments