Table of Contents

Class ScriptSystem

Namespace
Stride.Engine.Processors
Assembly
Stride.Engine.dll

The script system handles scripts scheduling in a game.

public sealed class ScriptSystem : GameSystemBase, IDisposable, ICollectorHolder, IGameSystemBase, IComponent, IReferencable, IUpdateable, IDrawable, IContentable
Inheritance
ScriptSystem
Implements
Inherited Members
Extension Methods

Constructors

ScriptSystem(IServiceRegistry)

Initializes a new instance of the GameSystemBase class.

public ScriptSystem(IServiceRegistry registry)

Parameters

registry IServiceRegistry

The registry.

Remarks

The GameSystem is expecting the following services to be registered: IGame and ContentManager.

Properties

Scheduler

Gets the scheduler.

public Scheduler Scheduler { get; }

Property Value

Scheduler

The scheduler.

Methods

Add(ScriptComponent)

Add the provided script to the script system.

public void Add(ScriptComponent script)

Parameters

script ScriptComponent

The script to add

AddTask(Func<Task>, long)

Adds the specified micro thread function.

public MicroThread AddTask(Func<Task> microThreadFunction, long priority = 0)

Parameters

microThreadFunction Func<Task>

The micro thread function.

priority long

Returns

MicroThread

MicroThread.

Destroy()

Disposes of object resources.

protected override void Destroy()

LiveReload(ScriptComponent, ScriptComponent)

Called by a live scripting debugger to notify the ScriptSystem about reloaded scripts.

public void LiveReload(ScriptComponent oldScript, ScriptComponent newScript)

Parameters

oldScript ScriptComponent

The old script

newScript ScriptComponent

The new script

NextFrame()

Allows to wait for next frame.

public ChannelMicroThreadAwaiter<int> NextFrame()

Returns

ChannelMicroThreadAwaiter<int>

ChannelMicroThreadAwaiter<System.Int32>.

Remove(ScriptComponent)

Remove the provided script from the script system.

public void Remove(ScriptComponent script)

Parameters

script ScriptComponent

The script to remove

Update(GameTime)

This method is called when this game component is updated.

public override void Update(GameTime gameTime)

Parameters

gameTime GameTime

The current timing.

WhenAll(params MicroThread[])

Waits all micro thread finished their task completion.

public Task WhenAll(params MicroThread[] microThreads)

Parameters

microThreads MicroThread[]

The micro threads.

Returns

Task

Task.