Scripting API

Scripting API

ExecuteAlwaysAttribute

Class in Abyss.Core, from Abyss.Core.

Marks a plugin that runs while its game is edited, as well as while it plays.

public sealed class ExecuteAlwaysAttribute : Attribute

Remarks

For what the editor should show as the game is edited: something placed from numbers the inspector edits, a trajectory drawn for whoever lays out a level. A Rust plugin is marked the same way, plugin!(#[execute_always] Placing). It is part of the game, and runs in the game on its own too; what only the editor needs goes in a plugin marked EditorOnlyAttribute.

The editor builds it as it opens the game, and again at every Play from the game's C# loaded afresh, so its static fields start as their initializers say; its systems run on every frame the editor draws, rather than only when something in the scene changes, so what they keep up to date is up to date while the scene is looked at. While the game plays they run before the rest of its systems, as they do in a game on its own, where Schedule.AddPlugins builds them first. A pause holds them with the rest of the game.

What its systems change while the game is edited stays changed, and is saved with the scene; one that should act only in play reads World.GameMode. What they change during Play is put back at Stop with everything else.

Not inherited: a plugin derived from a marked one is not marked, so marking one never makes others run while the game is edited without saying so.