NodeWorld

WorldContentCheck

La référence est en anglais : elle est générée à partir des commentaires du code, écrits en anglais.

csharp
public static class WorldContentCheck

Namespace NodeWorld.SDK.ContentAllowlist.

Reads a world bundle with AssetsTools.NET and checks it against WorldContentAllowlist: the types of each serialized file (Unity class ids; scripts by the assembly, namespace and class of their MonoScript), the calls written in UnityEvents and the animation events. The client writes the bundle again without what is not allowed (« Charger sans ce composant »): a component leaves the m_Component list of its GameObject and its object is deleted, a call leaves its event. The SDK runs the same check on the bundle it has just built, so both give the same verdict. Reading an LZMA bundle decompresses it here (slow in managed code): the client gives it an LZ4 one, recompressed by Unity.

Methods

Inspect

csharp
public static ContentCheckResult Inspect(string bundlePath, string workDirectory)

Checks a bundle without changing it (the SDK, when a world is published).

  • bundlePath: The bundle (LZMA, LZ4 or not compressed).
  • workDirectory: Where to decompress it while it is read (deleted after).

Sanitize

csharp
public static ContentCheckResult Sanitize(string bundlePath, string outputPath, string workDirectory)

Checks a bundle and, when something is not allowed, writes it again without it to outputPath (not compressed: the client recompresses it with Unity). Nothing is written when the bundle is clean.

  • bundlePath: The bundle as downloaded (best as LZ4: LZMA is decompressed here, slowly).
  • outputPath: The bundle without what is not allowed; replaced if it exists.
  • workDirectory: Where to decompress it while it is read (deleted after).

EnsureBundle

csharp
public static void EnsureBundle(string bundlePath)

Throws InvalidDataException unless the file is a Unity bundle whose header and file list can be read. The client asks before handing it to Unity: Unity's recompression never ends on a file that is not a bundle.