Welcome, these are video adaptations of Unity’s text tutorials for making a simple multiplayer game. These tutorials are a basic introduction to Unity’s multiplayer system. If you prefer video tutorials then these will be useful to you.
I’m trying to implement player health bar in first person camera mode, but the bar only rotate in server side player. I’ve synced the y rotation value but the local non-controlled player’s bar not rotate accordingly. Would you mind giving a clue for how to do this, thank you.
I didn’t network the health bars, but the y rotation of the local player fps camera. Sorry for not mention about that and I not quite understand about your meaning of treating them like enemy. I’m quite new to unity networking and unet anyway.
Study the tutorials, for the player they should see their own health on their HUD canvas. Other players shouldn’t see that, instead they should just see a bar that hovers over your players head.
Hi I just have a problem with UNET and I’ve been stuck on for quiet a while now . Here is what I want
I want the host and the client to be able to instantiate an object
public void objectPlacement() {
if (isLocalPlayer) {
if (Input.GetKeyUp(KeyCode.E))
{
Debug.Log(“InsideKeyCodeE”);
placedObstaclesCounter++;
Debug.Log (“placedObstaclesCounter”);
Debug.Log (playersObstacles.Length);
if (placedObstaclesCounter < playersObstacles.Length)
The host is successfully able to spawn an object and works fine , but nothing happens when I try to run it on the client . I have localplayerautority set and all the prefabs have network identity and are set as spoonable objects in network manager . Any help would be greatly appreciated
To be honest, that health bar was a bit of a hack, as I didn’t want to spend the time in this networking tutorial to do health bars correctly. That’s more of a ui tutorial. They probably should be tracked in screen space which would require registering them over the network. I have not followed @GTGD 's project, so they may have a better solution.
@Adam-Buckner_1 I suppose you are representing unity , I have the problem where I’m not able to instantiate an object from the client . I’ve done a lot of research and above is my code . I’m a student and I’ve been stuck ob this for a while now , any help would be greatly appreciated
Can you start by listing formatted code? If this is not part of this tutorial series, however, I would suggest starting your own thread, as I would assume @GTGD would like to keep this thread on-topic and related to his recordings of the tutorial series.
Edit: nvm, it works now with if(isServer), dont know why it didnt before.
My players’ healthbars are not updating, or moving at all.
I tested with a print (“Taken “+amount+” damage.”); in the TakeDamage function, and it never reach it.
My TakeDamage function is this:
public void TakeDamage(int amount)
{
if(!Network.isServer)
{
return;
}
currentHealth -= amount;
print (“Taken “+amount+” damage.”);
if(currentHealth <= 0)
{
currentHealth = 0;
print (“Dead”);
}
}
Almost same as in the tut, except the if(!Network.isServer), because it throws an error without the Network in front.
I need some help. I used this tutorial creating android fps and my problem is whenever i click, the bullet spawns in different position or like it spawns where I last applied changes to my character. I used button instead of getkey. Any help will be much appreciated. thank you.
Hi All,
How can i drag the same gameobject in both server and client side and also it should reflect on the other side. (If i am dragging a gameobject from the server side it should reflect on client side and i am selecting the same gameobject from the client and dragging, it should reflect on server side…)
Hey @GTGD I followed your tutorial and make UI canvas options to playe the game on an android platform… But i am unable to find each other game instance between two android phones. How do I find the players who are connected to the same WiFi connection?
hi I am at the part of making player movement. I did exactly what you did in the video but my player is not moving!
can you maybe tell me why or what should I do in order to make player movement.