Fix first-person camera target and paint HUD rebind after networked spawn

Point the first-person camera at the dedicated FirstPersonTarget anchor
(eye height) instead of the shared CameraTarget, in both the runtime
SetPlayer rebind and the editor ResolveReferences fallback.

Rebind the paint HUD to the locally spawned avatar's MeshPainter via a
new GameModeManager.PainterChanged event. Since the spawn-on-connect
refactor, no player exists at PaintHud.Start(), so the HUD bound to a
null painter (no brush masks shown, color/settings were no-ops).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
adminandClaude Opus 4.8 committed 2026-06-27 15:22:23 +02:00
1 parent 69e185d969
commit e04868f9c0
4 files changed
+58 -22

No files matched your search

+7
View File
@@ -54,6 +54,12 @@ public class GameModeManager : MonoBehaviour
/// Argument = the now-active mode. Used by UI (e.g. the paint HUD) to follow the mode.</summary>
public event System.Action<GameMode> ModeChanged;
/// <summary>Raised when the painter the HUD should edit changes - i.e. when the local
/// networked avatar spawns and <see cref="BindLocalPlayer"/> binds its per-avatar painter.
/// With spawn-on-connect there is no painter at scene start, so the paint HUD follows this
/// to (re)bind its widgets to the live painter once it exists.</summary>
public event System.Action<MeshPainter> PainterChanged;
private readonly List<GameMode> _modes = new List<GameMode>();
private int _activeIndex = -1;
@@ -122,6 +128,7 @@ public class GameModeManager : MonoBehaviour
// The painter lives on the player (per-avatar), so bind the local one.
if (!painter) painter = localPlayer.GetComponentInChildren<MeshPainter>(true);
PainterChanged?.Invoke(painter);
Transform camTarget = localPlayer.transform.Find("CameraTarget");