Pass ForgeDocs Product page

API

Editor scripting

Editor utilities in the PassForge.EditorTools namespace, for setup scripts and tools. Code that uses them goes in an Editor folder or an editor only assembly.

PassForgeProjectSettings

Pass Forge settings stored with the project, under Project Settings > Pass Forge.

public sealed class PassForgeProjectSettings : ScriptableSingleton<PassForgeProjectSettings>

Namespace PassForge.EditorTools, assembly PassForge.Editor.

PassForgeProjectSettings.stripping

Which screen effects a player build leaves out.

public EffectStripping stripping { get; set; }

PassForgeProjectSettings.keepLitEffects

Keep the shaders Dissolve, Occluder Fade and Cross Section draw with, Lit Effects with its variants and the Sprite Effects and Dissolve Edge shaders for sprites, in every build, for those components added from scripts. Builds with one of them in a scene keep them anyway.

public bool keepLitEffects { get; set; }

PassForgeProjectSettings.alwaysInclude

Full type names of effects every build keeps, for effects that scripts add at runtime.

public IReadOnlyList<string> alwaysInclude { get; }

PassForgeProjectSettings.SetAlwaysInclude(Type, bool)

Keeps or stops keeping an effect in every build.

public void SetAlwaysInclude(Type effectType, bool include)

EffectsSetup

One step setup for the ready made effects. Copies the default effect graphs into the project, where they can be edited, and adds the two effects renderer features to every renderer the project's URP assets use.

public static class EffectsSetup

Namespace PassForge.EditorTools, assembly PassForge.Editor.

EffectsSetup.projectFolder

Project folder the setup writes graphs, profiles and presets into.

public const string projectFolder = "Assets/Pass Forge Effects"

EffectsSetup.userPresetsFolder

Project folder for presets saved by the user.

public const string userPresetsFolder = projectFolder + "/Presets"

EffectsSetup.userMomentsFolder

Project folder for moments saved by the user.

public const string userMomentsFolder = userPresetsFolder + "/Moments"

EffectsSetup.highlightProfilesFolder

Project folder for editable highlight profiles.

public const string highlightProfilesFolder = projectFolder + "/Highlight Profiles"

EffectsSetup.volumeProfilesFolder

Project folder for the profiles of the Effects Volumes the GameObject menu creates.

public const string volumeProfilesFolder = projectFolder + "/Volume Profiles"

EffectsSetup.beforePostGraphName

Graph with the effects that run before URP post-processing.

public const string beforePostGraphName = "Pass Forge Effects Before Post.asset"

EffectsSetup.afterPostGraphName

Graph with the effects that run after URP post-processing.

public const string afterPostGraphName = "Pass Forge Effects After Post.asset"

EffectsSetup.beforePostFeatureName

Feature running highlights, afterimages, trails and feedback, before bloom and tonemapping.

public const string beforePostFeatureName = PassGraphRendererFeature.effectsFeaturePrefix + " (Before Post-Processing)"

EffectsSetup.afterPostFeatureName

Feature running painterly and the stylize stack, on the finished picture.

public const string afterPostFeatureName = PassGraphRendererFeature.effectsFeaturePrefix + " (After Post-Processing)"

EffectsSetup.packageRoot

Project path of the Pass Forge folder: Packages/com.ybaltaci.passforge when it is installed as a package, or the folder it was imported into under Assets, wherever it was moved since. Found from where the editor assembly definition sits, the one path the compilation pipeline always reports.

public static string packageRoot { get; }

EffectsSetup.defaultGraphFolder

Folder holding the default effect graphs inside the package.

public static string defaultGraphFolder { get; }

EffectsSetup.presetsFolder

Folder holding the presets that ship with the package.

public static string presetsFolder { get; }

EffectsSetup.SetUp()

Copies the default graphs into the project when they are not there yet, and adds any missing effects feature to the renderers of every URP asset the project uses. Graphs copied by an older version of Pass Forge get the effect nodes added since. Running it again changes nothing that is already set up, so edits to the graphs and features are kept.

public static Result SetUp()

EffectsSetup.UpgradeProjectGraphs()

Adds the effect nodes an updated Pass Forge introduced to the project's copies of the effect graphs, and returns how many were added. The copies are the graphs the effects features run, wherever they were moved or renamed to, and the ones in the setup folder. The editor runs this by itself after it loads, and Set Up Effects does it as well. Projects that were never set up are left alone.

public static int UpgradeProjectGraphs()

EffectsSetup.WarmUpEffectShaders()

Compiles the effect shaders up front for the graphics API the editor uses, behind a progress bar. Unity compiles them synchronously the first time an effect draws, which otherwise freezes the editor for a minute or more on a fresh project. Passes that are already compiled are skipped, so running it again is quick.

public static void WarmUpEffectShaders()

EffectsSetup.CreateEffectsProfile(string)

Saves a new Volume Profile holding every Pass Forge screen effect in the Volume Profiles folder. Parameters start without overrides, as URP does, so each effect stays off until its intensity is overridden.

public static VolumeProfile CreateEffectsProfile(string baseName)

EffectsSetup.CreateEffectsProfileAt(string)

Saves a new effects profile at an exact path, whose folder must exist.

public static VolumeProfile CreateEffectsProfileAt(string path)

EffectsSetup.StoreInProfile(VolumeComponent, VolumeProfile)

Stores a component added by code inside its profile asset, the way the Volume editor does.

public static void StoreInProfile(VolumeComponent component, VolumeProfile profile)

EffectsSetup.IsSetUp()

True when the active pipeline's renderers carry both effects features with graphs.

public static bool IsSetUp()

EffectsSetup.ActivePipelineRuns(Type)

True when an enabled Pass Forge feature on the active pipeline runs a node of the given type.

public static bool ActivePipelineRuns(Type nodeType)

MomentPresetUtility

Fills Pass Forge Moments with the ready made moments from editor scripts, such as tools that build scenes, the way the Preset list in the inspector does.

public static class MomentPresetUtility

Namespace PassForge.EditorTools, assembly PassForge.Editor.

MomentPresetUtility.presetNames

The names of every ready made moment, such as Explosion or Player Hurt.

public static IEnumerable<string> presetNames { get; }

MomentPresetUtility.Apply(PassForgeMoment, string)

Replaces a moment's steps with a ready made moment and sets how it plays. A moment without a Name gets the preset's. Returns false for a name no ready made moment has, or when a screen preset it uses is missing.

public static bool Apply(PassForgeMoment moment, string presetName)

NodeDefaults

Fills in the assets a freshly created node needs, so a node that would otherwise arrive broken is usable the moment it lands on the canvas.

public static class NodeDefaults

Namespace PassForge.EditorTools, assembly PassForge.Editor.

NodeDefaults.Apply(PassNode)

Assigns default assets to a node that has none. Safe to call on any node.

public static void Apply(PassNode node)

NodeRegistry

Discovers every concrete PassNode in the project so the add menu picks up nodes a user writes themselves without any registration step.

public static class NodeRegistry

Namespace PassForge.EditorTools, assembly PassForge.Editor.

NodeRegistry.entries

All creatable node types, sorted by menu name.

public static IReadOnlyList<NodeTypeEntry> entries { get; }

NodeRegistry.Rebuild()

Rescans for node types. Called automatically after a domain reload.

public static void Rebuild()

NodeRegistry.Create(Type)

Instantiates a node type and gives it an identity.

public static PassNode Create(Type type)

EffectPresetsWindow

Ready made looks, one click away. Screen presets are written into a Volume; highlight and afterimage presets are applied to the selected objects.

public sealed class EffectPresetsWindow : EditorWindow

Namespace PassForge.EditorTools, assembly PassForge.Editor.

EffectPresetsWindow.shippedScreenPresets

Names of the screen presets shipped with Pass Forge, in the order they are listed.

public static IEnumerable<string> shippedScreenPresets { get; }

EffectPresetsWindow.shippedHighlightPresets

Names of the highlight presets shipped with Pass Forge, in the order they are listed.

public static IEnumerable<string> shippedHighlightPresets { get; }

EffectPresetsWindow.shippedAfterimagePresets

Names of the afterimage presets shipped with Pass Forge, in the order they are listed.

public static IEnumerable<string> shippedAfterimagePresets { get; }

EffectPresetsWindow.Open()

Opens the presets window.

public static void Open()

EffectPresetsWindow.NeedsSceneDepth(VolumeProfile)

True when a screen preset turns up an effect that works on the 3D surfaces the camera sees, reading their depth, normals or motion. Sprites on the URP 2D Renderer leave those empty, so there that part of the look shows nothing or treats the whole picture as far away.

public static bool NeedsSceneDepth(VolumeProfile preset)

EffectPresetsWindow.ApplyScreenPreset(VolumeProfile, VolumeProfile, bool)

Applies a screen preset to a profile with undo, storing any new components in the asset.

public static void ApplyScreenPreset(VolumeProfile preset, VolumeProfile target, bool turnOffOthers)

EffectsSetup.Result

What SetUp did.

public struct Result

Namespace PassForge.EditorTools, assembly PassForge.Editor.

EffectsSetup.Result.featuresAdded

Renderer features added.

public int featuresAdded

EffectsSetup.Result.renderersChecked

Renderers inspected.

public int renderersChecked

EffectsSetup.Result.renderersSkipped

Renderers skipped because they live inside a package.

public int renderersSkipped

EffectsSetup.Result.nodesAdded

Effect nodes added to graphs copied by an older version of Pass Forge.

public int nodesAdded

EffectsSetup.Result.beforePostGraph

The project copy of the before post-processing graph.

public PassGraphAsset beforePostGraph

EffectsSetup.Result.afterPostGraph

The project copy of the after post-processing graph.

public PassGraphAsset afterPostGraph

EffectsSetup.Result.error

Why setup stopped, or null when it finished.

public string error

NodeTypeEntry

One node type the user can add from the graph editor.

public readonly struct NodeTypeEntry

Namespace PassForge.EditorTools, assembly PassForge.Editor.

new NodeTypeEntry(Type, string)

Creates an entry.

public NodeTypeEntry(Type type, string menuName)

NodeTypeEntry.type

Concrete node type.

public readonly Type type

NodeTypeEntry.menuName

Label shown in the add menu.

public readonly string menuName

PassGraphEditorWindow

The graph editor window. Double click a Pass Forge graph asset to open it here.

public sealed class PassGraphEditorWindow : EditorWindow

Namespace PassForge.EditorTools, assembly PassForge.Editor.

PassGraphEditorWindow.Open(PassGraphAsset)

Opens the window on a graph, focusing it if it is already open.

public static void Open(PassGraphAsset asset)

PassGraphEditorWindow.OpenFromMenu()

Opens the window on the selected graph. With no graph selected it keeps the graph the window already shows, or opens the project's effect graphs, before any other graph in the project.

public static void OpenFromMenu()

PassGraphEditorWindow.FrameGraph()

Zooms and pans so every node fits in the view.

public void FrameGraph()

PassGraphEditorWindow.Reload()

Rebuilds the canvas from the asset. Needed after something outside the window changes the graph, such as a script edit or a version control update.

public void Reload()

EffectStripping

Which screen effects a player build leaves out.

public enum EffectStripping

Namespace PassForge.EditorTools, assembly PassForge.Editor.

ValueMeaning
KeepAllKeep every effect in every build.
NotInAnyProfileLeave out effects that no Volume Profile in the build holds.
NotTurnedOnInAnyProfileLeave out effects that no Volume Profile in the build turns on, even when a profile holds them switched off.