|
1 | 1 | <article> |
2 | | - <h1>Ecsact Runner Subsystems</h1> |
| 2 | + <h1>Ecsact Subsystems</h1> |
| 3 | + <p> |
| 4 | + The <a routerLink="/start/unreal/runner">Ecsact Runner</a> has |
| 5 | + <em>subsystems</em> that start when the runner starts. Subsystems are |
| 6 | + <em>the</em> way to listen for component events and entity lifecycle events. |
| 7 | + If you want to know when an Ecsact entity is created/destroyed or an Ecsact |
| 8 | + component is added, updated, or removed then Ecsact Runner subsystems is |
| 9 | + what you want! |
| 10 | + </p> |
3 | 11 | <section> |
4 | | - |
| 12 | + <h2 id="codegen-subsystems">Built-in Codegen Subsystems</h2> |
| 13 | + <p> |
| 14 | + There are a few built-in |
| 15 | + <a routerLink="/start/unreal/codegen">code generated</a> subsystems that |
| 16 | + are a must in any Ecsact unreal project. These subsystems allow you to |
| 17 | + listen to specific component events with their correct typings in C++ or |
| 18 | + even blueprints. |
| 19 | + </p> |
| 20 | + <p> |
| 21 | + Lets say we have this simple <code>.ecsact</code> file that has a |
| 22 | + <code>Health</code> component and <code>Dead</code> tag. |
| 23 | + </p> |
| 24 | + <pre><code ecsactLangSyntax> |
| 25 | + main package example; |
| 26 | + component Health {{'{'}} f32 amount; {{'}'}} |
| 27 | + component Dead; |
| 28 | + </code></pre> |
| 29 | + <p> |
| 30 | + After your Ecsact Codegen is ran and you've re-built your project you will |
| 31 | + have access to a new subsystem that you can extend in either bluprint or |
| 32 | + c++. The generated subsystem name will be prefixed with your Ecsact |
| 33 | + package name (in this case <code>example</code>.) Following the unreal |
| 34 | + naming convention it will have the first letter capitalized. |
| 35 | + </p> |
| 36 | + <div class="flex flex-row gap-4 text-center my-4"> |
| 37 | + <div> |
| 38 | + <div class="hidden lg:block text-lg font-bold">C++</div> |
| 39 | + <a href="/assets/unreal/unreal-subsystem-cpp-create.png"> |
| 40 | + <img src="/assets/unreal/unreal-subsystem-cpp-create.png" /> |
| 41 | + </a> |
| 42 | + </div> |
| 43 | + <div class="hidden lg:block"> |
| 44 | + <div class="text-lg font-bold">Blueprint</div> |
| 45 | + <a href="/assets/unreal/unreal-subsystem-bp-create.png"> |
| 46 | + <img src="/assets/unreal/unreal-subsystem-bp-create.png" /> |
| 47 | + </a> |
| 48 | + </div> |
| 49 | + </div> |
| 50 | + <p> |
| 51 | + Events are exposed as <code>BlueprintNativeEvent</code> in the subsystem. |
| 52 | + Meaning in blueprints you can easily implement these events in the event |
| 53 | + graph or in C++ as a virtual member function. |
| 54 | + </p> |
| 55 | + <div class="flex flex-col gap-4 items-center justify-center my-4"> |
| 56 | + <div> |
| 57 | + <div class="text-lg font-bold text-center">C++</div> |
| 58 | + <div> |
| 59 | + <code-block-variation class="m-0 rounded-md mt-3"> |
| 60 | + <pre |
| 61 | + codeBlockVariationOption |
| 62 | + optionTitle="C++"><code prism language="cpp"> |
| 63 | + #include "Example__ecsact__ue.h" // generated header |
| 64 | + |
| 65 | + auto UMySubsystem::UpdateHealth_Implementation( |
| 66 | + int32 Entity, |
| 67 | + FExampleHealth Health |
| 68 | + ) -> void {{'{'}} |
| 69 | + // TODO: play cool heal effect |
| 70 | + {{'}'}} |
| 71 | + </code></pre> |
| 72 | + </code-block-variation> |
| 73 | + </div> |
| 74 | + </div> |
| 75 | + <div> |
| 76 | + <div class="text-lg font-bold text-center">Blueprint</div> |
| 77 | + <a href="/assets/unreal/unreal-bp-subsystem-01.png"> |
| 78 | + <img |
| 79 | + class="rounded-md mt-3" |
| 80 | + src="/assets/unreal/unreal-bp-subsystem-01.png" /> |
| 81 | + </a> |
| 82 | + </div> |
| 83 | + </div> |
5 | 84 | </section> |
6 | 85 | </article> |
0 commit comments