Scripting API
Scripting API
PrefabMaking
Class in Abyss.Core.Scenes, from Abyss.Core.
An entity and everything under it written as a prefab: what dragging one from the hierarchy onto a folder makes.
public static class PrefabMakingRemarks
Its top entity at the origin, unturned and unscaled, as an instance is put where the instance is: the prefab says what its entities are and where each is from its top, and each instance where the top is. The entity's own place is given back, for the instance taking its place to be put there.
An instance is made a prefab of what it is now: unpacked while it is read, as Unpack does — each instance its prefab holds left one, and what the scene changed in it kept — and packed again at once, so the world is as it was. What is under it that is an instance of its own stays one, a reference in the new prefab as in a scene. An instance of a variant is unpacked to its base and on, so the top of an original is an instance of nothing.
Or a variant of its prefab (PrefabMaking.CaptureVariant): written as a scene writes the instance, its top an instance of the prefab with what it changed, so it follows the prefab still.
Methods
Capture
public static MadePrefab Capture(World world, ulong root, AssetDatabase database, IPrefabSource prefabs, SceneWriting writing)What root and everything under it are, as a prefab's file says them, its top at the origin; and where it was.
Parameters
world: The world it is in.root: The entity to make a prefab of.database: What every file under the asset root is called.prefabs: Where the prefabs it, or what is under it, is an instance of are read.writing: How the project writes its scenes, which its prefabs are written as.
Exceptions
AbyssException: The entity is not there, or is in no scene.
CaptureVariant
public static MadePrefab CaptureVariant(World world, ulong root, AssetDatabase database, IPrefabSource prefabs, SceneWriting writing)What the instance root is the top of and everything under it are, as a variant of its prefab says them: its top an instance of that prefab, with what the instance changed and added, at the origin; and where it was.
Parameters
world: The world it is in.root: The instance's top entity.database: What every file under the asset root is called.prefabs: Where its prefab, and what is under it, are read.writing: How the project writes its scenes, which its prefabs are written as.
Exceptions
ArgumentException:rootis the top of no instance.AbyssException: The entity is not there, or is in no scene.
Written as a scene writes an instance, against the prefab as it is built, so the variant says only what differs and follows the prefab in everything else.
NewVariant
public static SceneDocument NewVariant(AssetGuid basis, string path)A prefab's file, written of nothing but an instance of basis: a variant that changes nothing yet, as a new one is.
Parameters
basis: The prefab it is a variant of.path: Where that prefab is, under the asset root.
BaseOf
public static AssetGuid? BaseOf(SceneDocument prefab)The prefab prefab is a variant of — what its top entity is an instance of — or null for one that is no variant.
Parameters
prefab
