What a script cannot block

Since SDK 0.2.1

The player can always open the menu, respawn and leave your world. NodeWorld keeps it so whatever your scripts do: the few things below are refused or undone for that. Players read the same rules in Blocks, kicks and bans.

Keys and buttons

Input.GetKey, Input.GetKeyDown and Input.GetKeyUp never see Key.Escape (the menu) or Key.P (the camera): they always return false. Key.Tab also frees the mouse pointer, and your scripts read it too: a world can open a panel with it, the mouse is then free to click it. Key.R pressed while a Shift key is held is the player's respawn: it reads as not pressed until it is let go. Shift, V and the other keys are yours to read.

In VR, InputButton.LeftSecondary (Y on Meta Quest Touch) opens the menu: Input.GetButton, Input.GetButtonDown and Input.GetButtonUp always return false for it.

A script may give the keyboard to one of its text fields (Select()): while the player types there, your scripts get no key. Esc still opens the menu: it leaves the field first.

The player

Player.immobilized, walkSpeed, runSpeed, strafeSpeed, jumpImpulse, gravityStrength, velocity, sittingPoint and Player.Teleport never stop the menu: it opens, and in VR it moves with the player when you teleport or push them.

When the player chooses Respawn in the menu, or presses Shift+R, NodeWorld first gives the player their own moves back (not immobilized, the speeds and the jump of their rig, gravity 1, no velocity of yours, no sitting point), then brings them to the spawn point. Your scripts get OnPlayerRespawn() as for any respawn: set your values again there if your world needs them. Your own Player.Respawn() changes none of them.

When the player leaves your world, nothing your scripts set follows them.

The interface stays in front

The menu, its windows, the notifications, the keyboard and the microphone icon are drawn after your world on layer 31 (NodeWorld UI), with no depth test, and they take the player's clicks before anything of your world: before a canvas of yours sorted above them, and before a collider or an interactable in front of them. For that:

  • layer 31 is not your world's: setting layer to 31 on an object, or on drawing by instances, is an error; an object of your scene, or a copy your scripts make, found on layer 31 goes to Default (a warning in the log);
  • a camera of your world draws only into a render texture (mirrors, screens, security cameras): one with no target texture, turned on by a script, an Animator or an event, is turned off;
  • a canvas of your world drawn on the screen (Screen Space - Overlay, or Screen Space - Camera without a camera) keeps a Sort Order of 31999 at most: a higher one comes down to 31999, under the client's screens, which start at 32000;
  • your cameras, mirrors included, never show the client's interface.

Only your world's objects

Your scripts reach the objects of your scene as you published it, and the objects they make (copies, cameras, render textures, network copies). The menu is not in your scene at all. While your world runs, NodeWorld also puts its own objects in your scene: the players' avatars, the portals, the players' photo cameras, their voices. They are not yours:

  • GameObject.Find, transform.Find and the searches of your scripts do not see them, and raycasts and overlaps go through them;
  • changing one, or putting one of your objects under it, is an error;
  • an event can still give you one to read, such as the collider of a player in OnTriggerEnter.

An object of your scene you take out of its parent (transform.parent = null) stays yours. Play mode does the same: its rig and its avatar are not your world's.

Scripts that never end

A call into your scripts in which your code runs for more than 10 seconds (60 seconds while the world loads; the game's own work does not count) is stopped, every thread of the world with it, and the world stays shown; the player gets a notice and the menu answers right after. Your compute threads are not watched: a thread that never ends does not freeze the player. See Threads and async.