Skip to content

Commit 67d5c4f

Browse files
author
rdeioris
authored
Update Subclassing_API.md
1 parent 06009e8 commit 67d5c4f

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

‎docs/Subclassing_API.md‎

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,28 @@ from unreal_engine.classes import Character, PawnSensingComponent, Pawn
1919
class Monster(Character):
2020

2121
def __init__(self):
22-
sensor = self.add_actor_component(PawnSensingComponent, 'Sensor')
23-
sensor.SightRadius = 17000
22+
self.sensor = self.add_actor_component(PawnSensingComponent, 'Sensor')
23+
24+
# properties can only be set starting from begin play
25+
def ReceiveBeginPlay():
26+
self.sensor.SightRadius = 17000
2427

2528
def OnSeePawn(self, pawn : Pawn):
2629
ue.print_string('seen {}'.format(pawn))
2730
```
2831

32+
Another example for a custom trigger:
33+
34+
```py
35+
import unreal_engine as ue
36+
from unreal_engine.classes import TriggerBox, Actor
37+
38+
class ExplodeTrigger(TriggerBox):
39+
40+
def ReceiveActorBeginOverlap(self, other : Actor):
41+
ue.log('TRIGGERED BY ' + str(other))
42+
```
43+
2944
Properties
3045
----------
3146

0 commit comments

Comments
 (0)