Skip to content

C# Resources

Server-side C# is preview. The current server binary executes only JavaScript resources server-side (server/src/CServer.cpp); it does not load a type = "csharp" resource yet. The C# SDK (sdk/Varion.SDK) ships in the kit as a preview surface. Use type = "js" for server logic today.

The working .NET path right now is client-side: client-type = "csharp" via the .NET client host (sdk/dotnet-host), additive to the primary JS/WebView2 client backend.

resource.toml (preview):

toml
enabled = true
type = "csharp"
main = "MyResource.dll"
client-type = "none"

If main is omitted, the default is <resource>.dll.

Minimal resource (preview SDK)

csharp
using Varion;

public sealed class Main : Resource
{
    public override void OnStart()
    {
        varion.Log("resource started");
    }

    public override void OnStop()
    {
        varion.Log("resource stopped");
    }
}

Common API (preview SDK surface)

  • varion.OnPlayerConnect
  • varion.OnPlayerDisconnect
  • varion.OnClient
  • varion.OnClientRpc
  • varion.EmitClient
  • varion.EmitAllClients
  • varion.CreateVehicleEntity
  • varion.CreatePedEntity
  • varion.CreateObjectEntity
  • varion.CreateVirtualEntityGroup
  • varion.CreateVirtualEntity

Source backing

This page is based on server/src/CServer.cpp (the host starts only for js resources), sdk/Varion.SDK/Varion.cs, sdk/Varion.SDK/Resource.cs and sdk/Varion.SDK/RuntimeHost.cs.

Varion Multiplayer Platform