using UdonSharp; using UnityEngine; using VRC.SDKBase; using VRC.Udon; public class DebugView : Scoreboard { [SerializeField] private DebugPlayerRow playerRowPrefab; [SerializeField] private GameObject rowContainer; private DebugPlayerRow[] playerRows = new DebugPlayerRow[0]; public override void UpdateScoreboard() { UpdatePlayerRows(); } public void UpdatePlayerRows() { if (playerManager == null || rowContainer == null || playerRowPrefab == null) return; // Clear existing rows for (int i = 0; i < playerRows.Length; i++) { if (playerRows[i] != null) { Destroy(playerRows[i].gameObject); } } // Get current players VRCPlayerApi[] players = playerManager.GetCurrentPlayers(); playerRows = new DebugPlayerRow[players.Length]; // Create a row for each player for (int i = 0; i < players.Length; i++) { VRCPlayerApi player = players[i]; if (player == null) continue; GameObject rowObj = Instantiate(playerRowPrefab.gameObject); rowObj.transform.SetParent(rowContainer.transform, false); DebugPlayerRow row = rowObj.GetComponent(); row.player = player; row.playerManager = playerManager; // Build player info string int playerId = player.playerId; string playerName = player.displayName; int score = playerManager.GetScore(playerId); string team = playerManager.GetTeam(playerId); string info = playerName + " | Team: " + team + " | Score: " + score; row.SetPlayerInfo(info); playerRows[i] = row; } } }