Skip to content

Commit 849df3b

Browse files
author
Roberto De Ioris
authored
Update Tagging_API.md
1 parent 26c9092 commit 849df3b

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

docs/Tagging_API.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,46 @@ world = ue.get_editor_world()
3535
for actor in find_all_actors_with_tag(world, 'foo'):
3636
print(actor)
3737
```
38+
39+
Eventually you can use the blueprint api:
40+
41+
```python
42+
import unreal_engine as ue
43+
from unreal_engine.classes import GameplayStatics
44+
45+
world = ue.get_editor_world()
46+
47+
# blueprint ufunctions returns a tuple (as UFunctions can returns multiple values)
48+
actors, = GameplayStatics.GetAllActorsWithTag(world, 'one')
49+
for actor in actors:
50+
print(actor)
51+
```
52+
53+
## Tagging Components
54+
55+
You can tag components too using the property 'ComponentTags':
56+
57+
```python
58+
your_component.ComponentTags = ['one', 'two', 'three']
59+
```
60+
61+
Fast-check of tag availability can be done with the component_has_tag() function:
62+
63+
```python
64+
if your_component.component_has_tag('one'):
65+
print('yes')
66+
```
67+
68+
While you can get the list of actor's component tagged with the specific value:
69+
70+
```python
71+
component_list = your_actor.get_components_by_tag('two')
72+
```
73+
74+
The function can take an optional argument specifying which classes of ActorComponent must be taken into account:
75+
76+
```python
77+
from unreal_engine.classes import SceneComponent
78+
# search all the components children of the class SceneComponent and tagged with 'two'
79+
component_list = your_actor.get_components_by_tag('two', SceneComponent)
80+
```

0 commit comments

Comments
 (0)