Fix player components injection. Add lobby reloading when clients change

This commit is contained in:
2024-09-11 21:03:47 +02:00
parent 9250b7b5dd
commit e428d3a9f9
10 changed files with 284 additions and 86 deletions

View File

@@ -1,14 +1,13 @@
using HurricaneVR.Framework.ControllerInput;
using HurricaneVR.Framework.Core.UI;
using Sirenix.OdinInspector;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.UI;
using Zenject;
public class HandMenuUI : MonoBehaviour
public class HandMenuUI : NetworkBehaviour
{
[Inject]
[ReadOnly]
@@ -89,6 +88,14 @@ public class HandMenuUI : MonoBehaviour
settingsButton.onClick.AddListener(() => SettingsClicked());
}
public override void OnNetworkSpawn()
{
base.OnNetworkSpawn();
// Player components need to be injected manualy again, because NetworkManager doesn't inject them.
gameObject.Inject();
}
private void Update()
{
CheckInput();