KROYSDOCS
HomeWhat's newv0.1.0
SCRIPTING API

C# scripting API

Every public type of Kroys.EngineScripting, the API game scripts use in the editor's Play mode, the packaged game and on the dedicated server.

NamespaceKroys.EngineScripting
Types130
Members1811
Frameworknet10.0
START

A script

A script is a C# class derived from EntityScript, attached to an entity in the Inspector. The engine calls its methods: OnStart once, OnUpdate every frame, OnFixedUpdate every fixed step. Static classes such as Input, Physics and Time are available everywhere; component classes such as CharacterController take the entity as their first argument.

Vectors and quaternions are System.Numerics types. Distances are metres, angles in the API are degrees unless a member says otherwise.

Mover.cs
public sealed class Mover : EntityScript
{
    public float Speed = 4.0f;   // metres per second, editable in the Inspector

    protected override void OnFixedUpdate(float fixedDeltaTime)
    {
        Vector2 input = Input.GetAxis2D("Move");          // WASD, arrows, left stick
        if (input.LengthSquared() < 0.0001f) return;

        Transform transform = Transform;
        Vector3 move = transform.WorldForward * input.Y + transform.WorldRight * input.X;
        transform.WorldPosition += Vector3.Normalize(move) * Speed * fixedDeltaTime;
    }
}
02

Scripts and entities

03

Time, input and debug

04

Physics

05

Characters and gameplay

06

Animation

07

Multiplayer

BotDrives server bots (players added with GameSession.AddBot).ClientOnlyAttributeMarks a script class that runs only where the game is presented (editor Play mode, game clients): cameras, input, UI, audio, effects.GameModeThe game's rules on the dedicated server, written in C#.GameSessionThe dedicated server's game session: players (clients and bots), ready states, map travel, the match state and the session rules.NetIdNetwork object id, shared by the server and every client for one replicated object.NetworkNetworked play from scripts: connecting to servers, the local player, and custom messages between clients and the server.NetworkCharacterControllerScript access to the networked character of a player on the server: velocity and grounded state of the replicated object.NetworkDeliveryHow a custom message travels: Unreliable for frequent disposable data, Reliable for important events in any order, ReliableOrdered for acti…NetworkMessageA custom script message received from the server (on a client) or from a client (on the server).NetworkReaderReads a message payload in the order its values were written (NetworkMessage.CreateReader).NetworkWriterBuilds a message payload: write values in order, then pass the writer to a Network.Send method.PlayerA player of the server's game session: a connected client or a server bot.ServerOnlyAttributeMarks a script class that runs only on the dedicated server (match rules, bots, authority checks).SessionEventTypeWhat happened in the session (see GameMode).
08

AI and navigation

09

Rendering and effects

10

Audio

11

UI

12

Save games

13

Assets and attributes

14

Components (low level)

15

Enums

AITaskStatusResult of a C# behavior-tree task.AudioAttenuationModelDistance attenuation curve of a spatial AudioSource.BillboardFacingModeHow a Billboard turns toward the camera.BuoyancyForceModelHow Buoyancy computes its forces.BuoyancySamplingModeWhere Buoyancy samples the water height.ClothPinModeHow cloth vertices are pinned to the mesh.ColliderShapeTypeShapes of a Collider.CoroutinePhaseWhen a waiting coroutine is checked: every frame (after OnUpdate), every fixed step (after OnFixedUpdate) or after every script's OnLateUpd…InputDeviceKind of physical control an input binding reads.InputModifiersModifier keys a binding requires (either side counts).MeshColliderGeometryWhich geometry a mesh Collider uses.NavAgentStatusMovement status of a NavMesh Agent.NavPathStatusStatus of a navmesh path query.NetworkConnectionStateWhere a shipped game's connection to a server stands (Network.Connect).NetworkRuntimeModeWhat the current world is in a networked game: not networked, a client or the dedicated server.OceanSurfacePresetWave presets of the Ocean component.OceanSurfaceQualityMesh quality of the Ocean surface.ParticleEmitterShapeShapes particles are emitted from.ParticleSimulationSpaceWhether particles move with the emitter (Local) or stay where they were emitted (World).RagdollModeWhat drives a ragdoll: the animation, physics, or a blend of both.TerrainBrushModeSculpting modes of the terrain brush.UICanvasSpaceWhether a UI canvas draws over the screen or in the world.VfxStateWhere a VFX effect is in its life.WaterBodyModeKinds of water body a Buoyancy component can float on.WorldKindWhat kind of scene a World runs scripts in.
16

Other

Generated from Managed/EngineScriptCore by Tools/BuildDocsSite.py. 1537 of 1811 members have a description.