Class ScyllaEditorLogScope
Routes framework Log output to the Unity console for as long as an editor tool is open.
Inherited Members
Namespace: Scylla.Core.Editor
Assembly: ScyllaCore.Editor.dll
Syntax
public static class ScyllaEditorLogScope
Remarks
Log writes to registered receivers and buffers everything when there are
none. The only thing that ever registers one is ScyllaBootstrap, at run time.
An editor-only tool therefore emits nothing: its log calls sit in the buffer and reach
the console never, or much later, flushed into a Play-mode session where they are out
of context and confusing.
The receiver is attached while at least one tool holds the scope and detached when the last one releases it, so a tool does not permanently alter logging for the whole project. It is also detached while entering Play mode, because the bootstrap registers its own console receiver there and two would print every framework message twice.
Shared rather than per-tool for exactly that reason. Log.RegisterLogReceiver
deduplicates by receiver instance, so two tools each owning a private reference count
and a private receiver would double-print whenever both were open. One count and one
receiver is what makes several tools coexist.
The count is a static and does not survive a domain reload. That is safe in both
directions: a reload clears the receiver list too, and every tool re-acquires from
CreateGUI, which Unity re-invokes afterwards. The one asymmetry is a
Release() arriving with no matching Acquire(), from a window
closed after a reload but before its CreateGUI ran; the underflow guard absorbs
it.
Acquire from OnCreateGUI and release from OnDisable, not
OnDestroy: a domain reload calls only the former pair.
Properties
IsAttached
Gets a value indicating whether the console receiver is currently registered.
Declaration
public static bool IsAttached { get; }
Property Value
| Type | Description |
|---|---|
| bool |
ReferenceCount
Gets how many holders currently want the receiver attached.
Declaration
public static int ReferenceCount { get; }
Property Value
| Type | Description |
|---|---|
| int |
Methods
Acquire()
Registers the console receiver on behalf of a newly opened tool.
Declaration
public static void Acquire()
Remarks
Idempotent. The Play-mode subscription is made only on the transition from zero, while the attach runs on every call because it early-outs when already attached.
Release()
Releases one hold, detaching the receiver when the last one goes.
Declaration
public static void Release()
Remarks
Safe to call without a matching Acquire(); see the domain-reload note in the class remarks.