The clients can’t interact with the hud, they see the hud but when you hover over or click the buttons on the screen the game doesn’t detect it. What could be causing it?
Can you post all your relevant code?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
public class PlayAreaUiManager : MonoBehaviour
{
public GameObject PlayAreaMenu;
public GameObject AllwaysOnScreenMenu;
private void Start()
{
PlayAreaMenu.SetActive(false);
AllwaysOnScreenMenu.SetActive(true);
}
public void openPlayAreaMenu()
{
PlayAreaMenu.SetActive(true);
AllwaysOnScreenMenu.SetActive(false);
Debug.Log("openedGameAreaMenu");
}
public void closePlayAreaMenu()
{
PlayAreaMenu.SetActive(false);
AllwaysOnScreenMenu.SetActive(true);
}
}
this is all the code.
The code is simple enough, the functions openPlayAreaMenu
and closePlayAreaMenu
are connected to buttons on the UI I assume? Have you checked that this is still true in the Inspector when the editor is running a client instance? Is the PlayAreaUiManager
on an object that exists for the client?
yes the functions are connected to buttons on the ui, the script is on the GameController and that is active for clients, the problem seems to be that the system that tells the game when you are hovering over a button is not working, i set the highlighted color to red and the buttons don’t change when i hover over them. i don’t see any differences between the host and the client in the editor.
EDIT: that seems to be the case, i put the open and close functions to keys on my keyboard and now they work.
ok so i did some testing and the issue is in the netcode, i joined as client (the hud didnt work), stopped the client (the hud didn’t work), started host (the hud worked). And i did this via the networkManager object without leaving the scene so there is no way that the code had loaded something different with the client. so the thing is that for the raycast or whatever is responsible for the detection of the cursor to work you need to be host, why and where to change it.
Are there any components that are needed on the hud objects to work like this or what?