FL# scripts

FL# (FluxSharp) is how a world comes alive: doors, mirrors, portals, synced objects, games. You write C# much like a Unity MonoBehaviour, but the scripts are not compiled by Unity: the SDK compiles them with fluxc into one WebAssembly module per world, the same for every platform. The module runs in the FL# interpreter, a sandbox, on every player's device and on the server, so a world cannot touch the player's computer or the game outside its own scene.

There is nothing to install: fluxc comes with the SDK and runs on the .NET runtime of the Unity Editor.

Start here

  1. Your first FL# script: a door that opens for everyone, from the scripts folder to publishing.
  2. Write FL# in your IDE: completion and the compiler's errors in Visual Studio or Rider.
  3. Scripts, callbacks and fields: what a script is, when its methods run, where it runs.
  4. The example world: eight scripts for what a world often needs (a mirror, a television, a portal, synced objects…), to read and copy.

Where the scripts go

  1. In the Project window, right-click a folder of your world, then Create, NodeWorld, FL# Scripts Folder: the SDK makes a Flux folder with an assembly definition (.asmdef) whose Define Constraints are never true (NODEWORLD_FLUX_SOURCES_NEVER_DEFINED). Put the world's .cs scripts in it. Unity sees the files but does not compile them: they are written against the FL# API, not against UnityEngine.
  2. In the world's NW World Config, list the scripts in Flux Sharp Sources.
  3. On an object of the scene, add the FL# Script component (Add Component, NodeWorld, FL# Script): the class of the script (Namespace.Class), the network ID of the object if it is synchronized, and the values of its public fields.

The basics

To…Read
find, move, show and hide objectsObjects and components
show the same thing to every playerSynced objects and values
tell every player something happened, or ask the serverNetwork events
read and move the players, seat them, change how they hear each otherPlayers
make objects players use or grab, read keys and buttonsInteraction and input
push bodies, cast rays, react to collisionsPhysics
play soundsSound
play videos from the internetVideo players
drive panels, buttons, sliders and text fieldsInterfaces (UI)
change materials, render cameras, drive lights, particles and animatorsCameras, materials and effects
wait, repeat, and draw random numbersTime, coroutines and random numbers
remember a player's choices between visitsPlayer data
find what your scripts wrote, and why one stoppedLogs of your scripts
know how far you can go, on the server and in Play modeLimits and performance

Going further

What keeps players safe

The API

The names follow Unity's where they do the same thing: GameObject, Transform, Rigidbody, Physics.Raycast, Vector3, Quaternion, Mathf, Time, Debug.Log… plus what is NodeWorld's own: Player and Players, Networking, Interaction, Portals. Every type and member is in the FL# API reference, generated from the code.

When something does not work: troubleshooting.