Skip to content

Commit ca7398e

Browse files
author
Roberto De Ioris
authored
Update MemoryManagement.md
1 parent 1eed91e commit ca7398e

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

docs/MemoryManagement.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,34 @@ import unreal_engine as ue
188188
material = ue.new_object(ue.find_class('Material'), None, 'DumbMaterial001', ue.RF_PUBLIC|ue.RF_STANDALONE)
189189
```
190190

191+
## Owning
192+
193+
We have seen how a UObject is differently managed based on the way it has been created:
194+
195+
```python
196+
# owned by python
197+
material = Material()
198+
199+
200+
# owned by unreal
201+
material2 = ue.new_object(Material)
202+
```
203+
204+
The interesting thing is that we are allowed to change the owner using the .own() and .disown() methods:
205+
206+
```python
207+
# owned by unreal
208+
material2 = ue.new_object(Material)
209+
210+
# now owned by python
211+
material2.own()
212+
213+
# owned again by unreal
214+
215+
material2.disown()
216+
```
217+
218+
You can check if an object is owned or not by using the .is_owned() method (returns a bool)
191219

192220
## UStruct
193221

0 commit comments

Comments
 (0)