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
ColorRGBA color value used by serialized script fields.CoroutineA running routine returned by EntityScript.StartCoroutine.EntityHandle to an entity in one world (scene).EntityRefSerializable reference to a scene entity by GUID.EntityScriptThe base class of game scripts.GameControls the running game itself.HierarchyScene hierarchy helpers for parent and child traversal.SceneCreates entities in the running scene: empty ones, and instances of prefabs from the project's Content folder.TransformPosition, rotation and scale of one entity, local (relative to its parent) and in world space.WaitForFixedUpdateContinues the coroutine in the next fixed step, after this script's OnFixedUpdate.WaitForLateUpdateContinues the coroutine this frame, after every script's OnLateUpdate (where cameras follow their targets).WaitForSecondsContinues the coroutine after a number of seconds of game time, counted down with each frame's delta time (so never sooner than the next fr…WorldHandle selecting the scene scripts act on (editor play, game client or dedicated server).YieldInstructionThe base of the waits a coroutine can yield: WaitForSeconds, WaitForFixedUpdate and WaitForLateUpdate.
03
Time, input and debug
DebugWrites messages to the Console panel in the editor, to the player's log in a shipped game and to the server log on the dedicated server.GamepadAxisGamepad axes.GamepadButtonStandard gamepad buttons (Xbox naming: South = A, East = B, West = X, North = Y).InputInput actions, contexts, rebinding, gamepads and raw keyboard/mouse state.InputControlOne physical control (key, mouse button, gamepad button or axis, mouse motion or wheel axis) with the modifier keys it requires.KeyCodeKeyboard key codes supported by the current scripting input API.LogLevelSeverity level used by the script logging bridge.MouseButtonMouse buttons supported by the scripting input API.RebindResultResult of Input.Rebind.TimeHow much time passed: the frame time for OnUpdate, the fixed step for OnFixedUpdate, and how far the rendered frame is between two fixed st…
04
Physics
BodyTypeHow a Rigid Body moves: Static never moves, Kinematic moves only where it is put, Dynamic is simulated.BuoyancyScript access to an entity's Buoyancy: how a rigid body floats on the ocean or a water body.ColliderScript access to an entity's Collider: shape, size, offset, trigger flag and collision layers.CollisionContact data passed to OnCollisionEnter, OnCollisionStay and OnCollisionExit.ConstraintScript access to an entity's physics Constraint (joint) between two bodies.GameplayLayerBuilt-in gameplay and surface classification used by physics queries and game logic.PhysicsQuestions about the physics world of the running scene: rays, shape casts and overlaps against colliders, filtered by gameplay layers and c…RaycastBatchBufferReusable storage for allocation-free batched raycast tests.RaycastCommandBatched raycast command for high-volume query tests.RaycastHitResult data for a physics raycast.RigidBodyScript access to an entity's Rigid Body: body type, mass, damping, velocities, sleep and axis locks.
05
Characters and gameplay
CharacterControllerScript access to an entity's Character Controller: the capsule that walks, jumps and climbs slopes in fixed steps, driven by player input o…FirstPersonCameraScript access to an entity's First Person Camera rig settings.GameplayGameplay surface/layer helpers for scene entities.HealthHealth helpers for entities that have a native HealthComponent.RotatorScript access to an entity's Rotator, which turns the entity at a constant rate.SpawnPointScript access to an entity's Spawn Point, where players start in Play mode and on the server.ThirdPersonCameraScript access to an entity's Third Person Camera rig: distance, offsets, collision and smoothing.
06
Animation
AnimationEventData sent to scripts when an animator crosses an animation event marker during playback.AnimatorDrives an entity's Animator from scripts: the parameters its controller's transitions and blend trees read (bool, float, int, trigger), the…RagdollScript access to an entity's Ragdoll: switching between animation and physics and blending between them.
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).
09
Rendering and effects
BillboardScript access to an entity's Billboard: a camera-facing quad with a material.CameraScript access to an entity's Camera: field of view, clip planes and whether it is the active camera.ClothScript access to an entity's Cloth simulation settings.DirectionalLightScript access to an entity's Directional Light: colour, intensity and shadows.MeshRendererScript access to an entity's Mesh Renderer: visibility, mesh, material, skinning, level of detail and draw distance.OceanScript access to an entity's Ocean: waves, colours and surface quality.ParticleEmitterScript access to an entity's Particle Emitter: playback, emission, shape, lifetime, colour and size settings.PointLightScript access to an entity's Point Light: colour, intensity, range and shadows.SpotLightScript access to an entity's Spot Light: colour, intensity, range, cone angles and shadows.TerrainScript access to an entity's Terrain: size, height scale, resolution, material and brush settings.VfxPlays .kvfx effects.
10
Audio
11
UI
12
Save games
13
Assets and attributes
AssetBase marker type for asset references.AssetGuidPersistent asset id (the asset's GUID, the same text the engine writes in asset metadata).AssetRefSerializable reference to an engine asset.AudioClipAssetMarker type used with AssetRef{TAsset} for audio clip assets.MaterialAssetMarker type used with AssetRef{TAsset} for material assets.MeshAssetMarker type used with AssetRef{TAsset} for mesh assets.RangeAttributeDefines an Inspector numeric range for supported numeric fields.SerializeFieldAttributeMarks a private field as serialized, saved, and shown in the Inspector.TextureAssetMarker type used with AssetRef{TAsset} for texture assets.
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
DefaultExecutionOrderAttributeSets the default execution order for a script class.FormerTypeNameAttributeRecords a previous managed type name for script migration.FormerlySerializedAsAttributeRecords a previous serialized field name for script field migration.HideInInspectorAttributeHides a serialized field from the Inspector.ISaveableImplemented by an EntityScript that keeps state outside its serialized fields (private caches, collections, timers).NetworkServerInfoA server found on the local network: its address, names, map, player counts and ping (Network.GetServers).ProbeVolumeScript access to an entity's Probe Volume: enable it, scale its light, and request a new bake of its probes for the running game with SetBa…ReadOnlyAttributeMakes an Inspector-exposed field read-only.ReflectionProbeScript access to an entity's Reflection Probe: enable it, scale its light, and request a new capture with SetBakeRequested(entity, true) (t…ScriptDisplayNameAttributeSets the display name used for a script class in editor UI.VfxEventA "Notify Script" event of an effect: its name and the world position of the particle.
Generated from Managed/EngineScriptCore by Tools/BuildDocsSite.py. 1537 of 1811 members have a description.