Scripting integration
Use this page only if an existing camera controller competes with Camera Tool for the same transform. Normal setup requires no code; begin with Quick Start.
Both Forge3D.F3DCameraTool and Forge3D.F3DCameraToolEditor exist only under UNITY_EDITOR. There is no Player Camera Tool API.
Suspend an existing camera controller
Section titled “Suspend an existing camera controller”Place the guarded check before your existing camera movement logic. This is an integration fragment, not a shipped gameplay controller:
private void LateUpdate(){#if UNITY_EDITOR if (Forge3D.F3DCameraTool.Enabled) return;#endif // Existing gameplay camera movement goes here.}Only the Camera Tool check is conditional. Your gameplay movement remains available in a Player context where the product type is absent. Adapt the placement to the method that actually writes your camera transform rather than adding a second competing update method.
Understand the global flag
Section titled “Understand the global flag”F3DCameraTool.Enabled is a static boolean, distinct from the component’s inherited enabled. It can stay true after disabling, destruction, or scene unload, leaving a controller with this check suspended.
Stop the tool before removing it. While the component is present, clearing its custom Enabled control clears the flag but does not restore camera poses. Direct code assignments also skip the alignment callbacks. This snippet does not repair lifecycle cleanup.
Relevant public methods
Section titled “Relevant public methods”| Method | Preconditions and behavior |
|---|---|
AutoSetup() | Fills references only when both slots are empty and enabled cameras exist; uses descending depth. Always sets C. Does not create cameras, capture origins, or enable following. A partially assigned component is not completed automatically. |
OnBecameActive() | If Match Scene is configured and Primary and Scene View exist, aligns Scene View to current Primary pose and requests perspective. Does not set Enabled or store origins. |
OnBecameInactive() | Restores each assigned slot whose Self align flag is on, including both position and rotation. Does not set Enabled or validate a stored pose. |
The two alignment methods are ordinary methods called by the tool’s input paths, not universal Unity lifecycle hooks. A direct AutoSetup call guards an empty camera list, but the setup menu can fail earlier while choosing its host.
PrimaryCamera and SecondaryCamera are the scene Camera reference fields. For their settings and user-facing behavior, use the Inspector reference. The original Inspector’s shared static target is internal coupling, not a safe multi-instance integration API.