Skip to content

Commit 82c9032

Browse files
author
rdeioris
authored
Update Material_API.md
1 parent 73bf96a commit 82c9032

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

docs/Material_API.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,37 @@ component = self.uobject.get_actor_component('Mesh')
2020
material = ue.load_object(Material, '/Game/Materials/Iron')
2121
component.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+
```

0 commit comments

Comments
 (0)