Skip to content

Commit 26c9092

Browse files
author
Roberto De Ioris
authored
Create Tagging_API.md
1 parent 99059ae commit 26c9092

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

docs/Tagging_API.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# The Tagging API
2+
3+
You can 'tag' actor and components.
4+
5+
A tag is a string (well, an FName internally) you assign to your actors and components. Each of them can have multiple tags.
6+
7+
## Tagging Actors
8+
9+
The 'Tags' properties allows you to tag actors:
10+
11+
```python
12+
your_actor.Tags = ['foo', 'Bar', tEsT']
13+
```
14+
15+
You can eventually fast-check an actor for the availability of a tag:
16+
17+
```python
18+
if your_actor.actor_has_tag('foo'):
19+
ue.log('Success')
20+
```
21+
22+
Finding all actors with a tag is unfortuntaley a slow operation (in C++, Blueprint and obviously python):
23+
24+
```python
25+
import unreal_engine as ue
26+
27+
def find_all_actors_with_tag(world, tag):
28+
for actor in world.all_actors():
29+
if actor.actor_has_tag(tag):
30+
yield actor
31+
32+
33+
world = ue.get_editor_world()
34+
35+
for actor in find_all_actors_with_tag(world, 'foo'):
36+
print(actor)
37+
```

0 commit comments

Comments
 (0)