diff --git a/Assets/Scripts/Components/UI/PaintHud/PaintHud.cs b/Assets/Scripts/Components/UI/PaintHud/PaintHud.cs index 24721a3..91eee0a 100644 --- a/Assets/Scripts/Components/UI/PaintHud/PaintHud.cs +++ b/Assets/Scripts/Components/UI/PaintHud/PaintHud.cs @@ -25,9 +25,6 @@ public partial class PaintHud : MonoBehaviour [Tooltip("Painter the HUD edits. Empty = the manager's painter, else found automatically.")] public MeshPainter painter; - [Tooltip("Authored panel layout. Instantiated and bound at startup.")] - public GameObject layoutPrefab; - // Stable widget names shared by the baked prefab and the binder. private const string PanelGeneral = "Panel_General"; private const string PanelSpray = "Panel_Spray"; @@ -111,16 +108,7 @@ public partial class PaintHud : MonoBehaviour private void Start() { _font = LoadFont(); - - EnsureEventSystem(); - EnsureCanvas(); - - if (layoutPrefab) - { - var go = Instantiate(layoutPrefab, transform); - go.name = layoutPrefab.name; // strip the "(Clone)" suffix - _panel = go; - } + _panel = transform.GetChild(0).gameObject; // Snapshot the authored panel positions now, while the layout is untouched - before RestoreHudState // (in BindPainter) overwrites them. The reset button restores exactly these. @@ -209,37 +197,6 @@ public partial class PaintHud : MonoBehaviour return f; } - // --- Canvas --- - - private void EnsureCanvas() - { - var canvas = GetComponent(); - if (!canvas) canvas = gameObject.AddComponent(); - canvas.renderMode = RenderMode.ScreenSpaceOverlay; - canvas.sortingOrder = 100; - - var scaler = GetComponent(); - if (!scaler) scaler = gameObject.AddComponent(); - scaler.uiScaleMode = CanvasScaler.ScaleMode.ScaleWithScreenSize; - scaler.referenceResolution = new Vector2(1920f, 1080f); - scaler.screenMatchMode = CanvasScaler.ScreenMatchMode.Expand; - - if (!GetComponent()) gameObject.AddComponent(); - } - - private void EnsureEventSystem() - { - if (FindFirstObjectByType()) return; - - var es = new GameObject("EventSystem", typeof(EventSystem)); -#if ENABLE_INPUT_SYSTEM - var module = es.AddComponent(); - if (!module.actionsAsset) module.AssignDefaultActions(); -#else - es.AddComponent(); -#endif - } - // --- Wiring (behaviour; shared by the code-gen and prefab paths) --- private void WirePanel(Transform panel)