From c90e23827d03dedccd60062419dc12d76a747065 Mon Sep 17 00:00:00 2001 From: SubatomicPlanets <133254461+SubatomicPlanets@users.noreply.github.com> Date: Wed, 26 Jun 2024 11:06:48 +0200 Subject: [PATCH] Call DontDestroyOnLoad on root to remove warning When calling DontDestroyOnLoad on a child object it won't work and logs a warning. Calling it on the transform.root.gameObject instead will always work. --- Runtime/LLM.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Runtime/LLM.cs b/Runtime/LLM.cs index 0f7388f9..d4756c3f 100644 --- a/Runtime/LLM.cs +++ b/Runtime/LLM.cs @@ -214,7 +214,7 @@ public async void Awake() slotSaveDir = Application.persistentDataPath; if (asynchronousStartup) await Task.Run(() => StartLLMServer()); else StartLLMServer(); - if (dontDestroyOnLoad) DontDestroyOnLoad(gameObject); + if (dontDestroyOnLoad) DontDestroyOnLoad(transform.root.gameObject); } private void SetupLogging()