You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 250cc92
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: docs/Subclassing_API.md
+71Lines changed: 71 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -86,6 +86,77 @@ class Hero(Character):
86
86
Functions and Events
87
87
--------------------
88
88
89
+
By default any methods having the same signature of an internal virtual one (like ReceiveBeginPlay in the previous examples) will became
90
+
automagically an override. Pay attention to the function annotation style for helping the blueprint system discovering the type of arguments. Except from self, any argument (or return value) without proper type will result in ignoring the argument:
91
+
92
+
```py
93
+
import unreal_engine as ue
94
+
from unreal_engine.classes import Character, PawnSensingComponent, Pawn, FloatProperty
95
+
96
+
classHero(Character):
97
+
98
+
# you can set it from the editor as array
99
+
UpSpeed = [FloatProperty]
100
+
101
+
# automatic override
102
+
defReceiveTick(self, DeltaSeconds: float):
103
+
location =self.get_actor_location()
104
+
location.z +=self.UpSpeed[0] * DeltaSeconds
105
+
self.set_actor_location(location)
106
+
107
+
# this new method will be available to blueprints
108
+
defFunnyNewMethod(self, a_word: str):
109
+
ue.print_string('This is a word from blueprint: '+ a_word)
110
+
```
111
+
112
+
you can do manual override too:
113
+
114
+
```py
115
+
import unreal_engine as ue
116
+
from unreal_engine.classes import Character, PawnSensingComponent, Pawn, FloatProperty
117
+
118
+
classHero(Character):
119
+
120
+
# you can set it from the editor as array
121
+
UpSpeed = [FloatProperty]
122
+
123
+
# manual override
124
+
deffunny_receive_tick(self, DeltaSeconds: float):
125
+
location =self.get_actor_location()
126
+
location.z +=self.UpSpeed[0] * DeltaSeconds
127
+
self.set_actor_location(location)
128
+
funny_receive_tick.override ='ReceiveTick'
129
+
```
130
+
131
+
To mark a method as 'pure' (in the Blueprint sense):
132
+
133
+
```py
134
+
import unreal_engine as ue
135
+
from unreal_engine.classes import Character
136
+
137
+
classHero(Character):
138
+
139
+
# this new method will be available to blueprints
140
+
defFunnyNewMethod(self, a_word: str):
141
+
ue.print_string('This is a word from blueprint: '+ a_word)
142
+
FunnyNewMethod.is_pure =True
143
+
```
144
+
145
+
or static:
146
+
147
+
```py
148
+
import unreal_engine as ue
149
+
from unreal_engine.classes import Character
150
+
151
+
classHero(Character):
152
+
153
+
# this new static method will be available to blueprints
0 commit comments