Table of Contents

Class PrefabUtils

Namespace
Nautilus.Utility
Assembly
Nautilus.dll
A small collection of prefab related utilities.
public static class PrefabUtils
Inheritance
PrefabUtils
Inherited Members

Methods

AddBasicComponents(GameObject, string, TechType, CellLevel)

Adds and configures the following components on the prefab.


- PrefabIdentifier: Required for an object to be considered a prefab.
- TechTag: Required for inventory items, crafting, scanning, etc.
- LargeWorldEntity: Required for objects to persist after saving and exiting.
- SkyApplier: Added if Renderers exist in the hierarchy. Applies the correct lighting onto an object.
public static void AddBasicComponents(GameObject prefab, string classId, TechType techType, LargeWorldEntity.CellLevel cellLevel)

Parameters

prefab GameObject
The prefab to operate on.
classId string
The class ID associated with the specified prefab.
techType TechType
Ignored if TechType.None is inputted.
cellLevel LargeWorldEntity.CellLevel
Level of distance this prefab can stay visible before unloading.

AddConstructable(GameObject, TechType, ConstructableFlags)

Adds and configures the Constructable component on the specified prefab.
public static Constructable AddConstructable(GameObject prefab, TechType techType, ConstructableFlags constructableFlags)

Parameters

prefab GameObject
The prefab to operate on.
techType TechType
The tech type associated with the specified prefab.
constructableFlags ConstructableFlags
A bitmask comprised of one or more ConstructableFlags that specify how the prefab should be treated during placement.

Returns

Constructable
The added constructable component.

AddVFXFabricating(GameObject, string, float, float, Vector3, float, Vector3)

Adds the VFXFabricating component onto the child found by pathToModel.
public static VFXFabricating AddVFXFabricating(GameObject prefabRoot, string pathToModel, float minY, float maxY, Vector3 posOffset = default, float scaleFactor = 1, Vector3 eulerOffset = default)

Parameters

prefabRoot GameObject
The prefab object that this is applied to.
pathToModel string
Leave as null or empty to point to the prefab root. Otherwise this is the path to the crafting model Transform, relative to the prefab's root Transform. For example, the Repair Tool's would be `welder_scaled/welder`.
minY float

The relative y position of where the ghost effect begins, in global coordinates relative to the model's center, taking the posOffset into account.

Typically a negative value because the bottom of an object is below its center. You may need to adjust this at runtime with Subnautica Runtime Editor to get desired results.

maxY float

The relative y position of where the ghost effect ends, in global coordinates relative to the model's center, taking the posOffset into account.

Typically a positive value because the top of an object is above its center. You may need to adjust this at runtime with Subnautica Runtime Editor to get desired results.

posOffset Vector3
The offset of the model when being crafted (in METERS). This is generally around zero, but the y value may be ajusted up or down a few millimeters to fix clipping/floating issues.
scaleFactor float
The relative scale of the model. Generally is 1x for most items.
eulerOffset Vector3
Rotational offset.

Returns

VFXFabricating
The added component.