File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -487,6 +487,30 @@ To access the fields of a struct just call the fields() method.
487487
488488A good example of struct usage is available here: https://github.com/20tab/UnrealEnginePython/blob/master/docs/Settings.md
489489
490+ As structs are passed by value, you need to pay attention when manipulating structs fields that are structs by themselves:
491+
492+ ``` python
493+ from unreal_engine.structs import TerrificStruct, DumbStruct
494+
495+ ts = TerrificStruct()
496+ ts.dumb = DumbStruct(Foo = 17 , Bar = 22 )
497+
498+ # will not modify the original DumbStruct but a copy of it !!!
499+ ts.dumb.Foo = 22
500+ ```
501+
502+ You can eventually force structs to be passed by ref (extremely dangerous as the internal C pointer could be a dangling one) using the ref() function:
503+
504+ ``` python
505+ from unreal_engine.structs import TerrificStruct, DumbStruct
506+
507+ ts = TerrificStruct()
508+ ts.dumb = DumbStruct(Foo = 17 , Bar = 22 )
509+
510+ # ref() will return a pointer to a struct
511+ ts.ref().dumb.foo().Foo = 22
512+ ```
513+
490514The ue_site.py file
491515-------------------
492516
You can’t perform that action at this time.
0 commit comments