Scripting
Gameplay scripts can be written in Strata or C#
Hyperion supports scripting with C#. Scripts can be attached to individual objects to define behaviour.
Exposing C++ to scripts
Engine types show up in both languages through reflection. Add a class in C++ with reflection macros, and Hyperion's CodeGenTool generates binding code so you can use it in scripts.
HYP_CLASS()
class Camera : public Entity
{
HYP_OBJECT_BODY(Camera);
public:
HYP_METHOD(Property = "FOV")
float GetFOV() const;
HYP_METHOD(Property = "FOV")
void SetFOV(float v);
};
In shipped games
When you package a game, C# scripts are compiled ahead of time with NativeAOT, so the game doesn't need .NET installed.
In this section
- Your first scriptAttach a script to an entity and make it move.
- Calling engine codeHow engine types show up in Strata and C#, and how to expose your own.
- SamplesExample scripts
