Skip to content

Commit

Permalink
Fix language example tabs in Relationships.md
Browse files Browse the repository at this point in the history
  • Loading branch information
SanderMertens committed May 6, 2024
1 parent 46be19b commit 2ccdd99
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion docs/Relationships.md
Original file line number Diff line number Diff line change
Expand Up @@ -1778,6 +1778,10 @@ Relationship properties are tags that can be added to relationships to modify th
### Trait property
The trait property marks an entity as a trait, which is any tag that is added to another tag/component/relationship to modify its behavior. All properties in this section are marked as trait. It is not required to mark a property as a trait before adding it to another tag/component/relationship. The main reason for the trait property is to ease some of the constraints on relationships (see the Relationship property).

<div class="flecs-snippet-tabs">
<ul>
<li><b class="tab-title">C</b>

```c
ECS_TAG(world, Serializable);

Expand Down Expand Up @@ -1809,6 +1813,10 @@ world.Component<Serializable>().Entity.Add(Ecs.Trait);
### Relationship property
The relationship property enforces that an entity can only be used as relationship. Consider the following example:

<div class="flecs-snippet-tabs">
<ul>
<li><b class="tab-title">C</b>

```c
ECS_TAG(world, Likes);
ECS_TAG(world, Apples);
Expand Down Expand Up @@ -1857,6 +1865,10 @@ Entity e = ecs.Entity()

Entities marked with `Relationship` may still be used as target if the relationship part of the pair has the `Trait` property. This ensures the relationship can still be used to configure the behavior of other entities. Consider the following code example:

<div class="flecs-snippet-tabs">
<ul>
<li><b class="tab-title">C</b>

```c
ECS_TAG(world, Likes);
ECS_TAG(world, Loves);
Expand Down Expand Up @@ -1901,6 +1913,10 @@ world.Component<Loves>().Entity.Add(Ecs.With, world.Component<Likes>().Entity);
### Target property
The target property enforces that an entity can only be used as relationship target. Consider the following example:

<div class="flecs-snippet-tabs">
<ul>
<li><b class="tab-title">C</b>

```c
ECS_TAG(world, Likes);
ECS_TAG(world, Apples);
Expand Down Expand Up @@ -1947,7 +1963,6 @@ Entity e = ecs.Entity()
</ul>
</div>


### Tag property
A relationship can be marked as a tag in which case it will never contain data. By default the data associated with a pair is determined by whether either the relationship or target are components. For some relationships however, even if the target is a component, no data should be added to the relationship. Consider the following example:

Expand Down

0 comments on commit 2ccdd99

Please sign in to comment.