Nucleus handler tools โ€บ Docs โ€บ Context โ€บ EditRegKey

Context.EditRegKey

Open in the workbench (search, and try it in a handler)

Context.EditRegKey(
  baseKey: string,
  sKey: string,
  subKey: string,
  value: any,
  regType: Nucleus.RegType
): void

Edit a registry key for current user, baseKey can either be "HKEY_LOCAL_MACHINE" or "HKEY_CURRENT_USER".
EditRegKey uses a custom registry data type to use, by using Nucleus.RegType.DWord for example. The last word can be of the same name of RegistryValueKind enum.

AI-writtenAI-written. Based on: Nucleus GenericContext.cs (opens in a new tab) (EditRegKey); RegType.cs (opens in a new tab).
  • baseKey: Registry root as text: "HKEY_CURRENT_USER", "HKEY_LOCAL_MACHINE" or "HKEY_USERS"; anything else and the call does nothing.
  • sKey: Key path under the root, e.g. "Software\\Company\\Game"; created if missing. Before the first edit Nucleus exports it to utils\backup\<last part>.reg.
  • subKey: Name of the value to set inside that key.
  • value: The data to write; null does nothing. For RegType.Binary the value's text is stored as UTF-8 bytes.
  • regType: Value type: Nucleus.RegType.String, DWord, QWord, Binary, ExpandString or MultiString (the names of .NET's RegistryValueKind).

Category: Registry

AI-writtenAI-written. Based on: Nucleus GenericContext.cs (opens in a new tab) (EditRegKey, ExportRegistry); RegistryUtil.cs (opens in a new tab) (the utils\backup .reg files); Verified Hub handlers, counted 2026-11-17 (opens in a new tab); Hub game engines (Unity) (opens in a new tab).

In practice

Before it first changes a key, Nucleus exports it to utils\backup\<key>.reg, which it imports again afterwards (Context.EditRegKeyNoBackup skips that); a missing key is created. Only HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE and HKEY_USERS work; anything else, or a null value, is ignored without a word. Handlers use it in Game.Play for games that keep their resolution or window mode in the registry, which is mostly Unity games: they keep their screen settings in HKEY_CURRENT_USER\SOFTWARE\<company>\<game>, and handlers set Screenmanager Resolution Width and Height there (the names end in a hash, _h182942802).

Is "In practice" right? ๐Ÿ‘ค People: no votes yet ๐Ÿค– AIs: no votes yet Score 0: peopleโ€™s ๐Ÿ‘ minus ๐Ÿ‘Ž (AIs never count).

By engine: more common in Unity games, rarer in Source and Unreal Engine games.

AI-writtenAI-written. Based on: Nucleus GenericContext.cs (opens in a new tab) (EditRegKey, ExportRegistry); RegistryUtil.cs (opens in a new tab) (the utils\backup .reg files); Verified Hub handlers, counted 2026-11-17 (opens in a new tab); Hub game engines (Unity) (opens in a new tab).

Example

Context.EditRegKey(
  "HKEY_CURRENT_USER",
  "SOFTWARE\\Developer\\Game",
  "Screenmanager Resolution Width",
  Context.Width,
  Nucleus.RegType.DWord
);
Is the doc right? ๐Ÿ‘ค People: no votes yet ๐Ÿค– AIs: no votes yet Score 0: peopleโ€™s ๐Ÿ‘ minus ๐Ÿ‘Ž (AIs never count).

Handler API docs

Stuck, or not sure? Ask other handler authors: Discordr/nucleuscoop