Describe the bug
Describe the bug
LLM.Awake() calls DontDestroyOnLoad, which Unity forbids outside Play mode. This makes it
impossible to initialize an LLM from an editor script.
The model itself loads and the server starts — the console shows model loaded — and then
Awake() throws:
InvalidOperationException: DontDestroyOnLoad can only be used in play mode and, as such,
cannot be part of an editor script.
LLMUnity.LLM.Awake () at Assets/LLMUnity/Runtime/LLM.cs:365
Because the exception interrupts Awake() before the native caller is created, every request
afterwards fails with LLM caller not initialized.
Why this matters
I'm building editor tooling that lets a developer verify their setup — model present, correct,
and actually producing a reply — without entering Play mode. The rest of my stack (speech
synthesis, model management, validation) works fine from the editor; this is the only thing
that blocks the dialogue half.
Suggested fix
Guarding the call would be enough:
if (Application.isPlaying) DontDestroyOnLoad(transform.root.gameObject);
Alternatively, expose it as the serialized setting that #152 already suggested — "This could
also be a setting in the component itself" — which covers both cases and changes the default
behaviour for nobody.
To be clear: I understand DontDestroyOnLoad was added deliberately (#152, #174) and I'm not
asking for it to be removed. Only for it to be skippable when it cannot legally run.
Steps to reproduce
No response
LLMUnity version
3.0.3
Operating System
Windows
Describe the bug
Describe the bug
LLM.Awake()callsDontDestroyOnLoad, which Unity forbids outside Play mode. This makes itimpossible to initialize an
LLMfrom an editor script.The model itself loads and the server starts — the console shows
model loaded— and thenAwake()throws:InvalidOperationException: DontDestroyOnLoad can only be used in play mode and, as such,
cannot be part of an editor script.
LLMUnity.LLM.Awake () at Assets/LLMUnity/Runtime/LLM.cs:365
Because the exception interrupts
Awake()before the native caller is created, every requestafterwards fails with
LLM caller not initialized.Why this matters
I'm building editor tooling that lets a developer verify their setup — model present, correct,
and actually producing a reply — without entering Play mode. The rest of my stack (speech
synthesis, model management, validation) works fine from the editor; this is the only thing
that blocks the dialogue half.
Suggested fix
Guarding the call would be enough:
Alternatively, expose it as the serialized setting that #152 already suggested — "This could
also be a setting in the component itself" — which covers both cases and changes the default
behaviour for nobody.
To be clear: I understand
DontDestroyOnLoadwas added deliberately (#152, #174) and I'm notasking for it to be removed. Only for it to be skippable when it cannot legally run.
Steps to reproduce
No response
LLMUnity version
3.0.3
Operating System
Windows