Hello all, I’ve ran into a issue where I can’t see the players health bar, reason being is that the health bar’s canvas is under the camera, of each player, but the thing is, I’ve made it as simple as that I don’t see anyone else’s camera and joysticks by using this
if (photonView.IsMine)
{
playerCam.SetActive(true);
playerJoysticks.SetActive(true);
}
But since the other players camera’s are not active, I can’t see there health canvas either, and I cant un-parent the health canvas from the main camera, since the bar has to be facing towards the camera and not spin around 360 degrees if the player does as well. Any solution to this?
Thanks for your reply, but 2 reasons I can’t, first the players all have the same prefab as each other and 2 I mentioned above I can’t unparent it from the players camera as I don’t want the health bar spinning around or turning, having it a child of the prefab means it’ll always be facing the screen, as this is an istrometic game
Thanks for your reply again, but I don’t honk your getting me right, I’ll try explain my self.
So I have a prefab, which is a player prefab which has a camera, the camera has a child which is a canvas, the health canvas. The reason I call this code:
if (photonView.IsMine)
{
playerCam.SetActive(true);
playerJoysticks.SetActive(true);
}
Is so if the photon view isn’t mine, it’ll disable everyone else’s camera and joysticks, so I can’t see them, by disabling the camera I also disable their health canvas, which is a child of the camera, so now I won’t be able to see their health bar, and I also told you why I can’t make the health canvas a parent of the player model
I did try this: GameObject.FindObjectOfType<Camera>().enabled = true; but it only returns 1, and I’m unsure how to do this with GameObject.FindObjectsOfType<T>. Any idea?
Or does that disable the whole gameobject, so I gotta use GetComponent?
I had to add another photonView component on the camera to be able to call the code block above. Thanks for your help. I just gotta try with more than 2 players to see if it works