@@maxacan8532 I don't understand why he did not tell us that. Btw all the coding is unnecessary. All you have to do is just put your player in the network manager. It saves a lot of time.
Great Video! I switched to mirror a while back at work when we needed a replacement for the traditional UNet and I just then found out about it, and I'm glad to see it get some love :) Keep up the great work.
@@alipk2633 thats true, although pretty much all info /tutorials on UNet apply to Mirror as well. And the Discord is a good source as well, I would recommend that too
OMG I HAVE WATCHED THE VIDEO 50 TIMES NOW TO FIND OUT WHAT'S IN THE FIRST LINE I STARTED ANALYZING THE VIDEO 6:00 PM AND NOW IT'S 10:48 PM THANK YOU SO THANK YOU !!!!
when you mark a function with [Server] if anything tried to call it you'll receive a error message that's why the [ServerCallbacl] exists its basically the same as [Server,] but with no error, so you can use it on stuff you have no control over not getting it called like a update()) the main difference between hasAuthority and isLocalPlayer is that the server by default has authority over all objects so hasAuthority will return true in the host even though the object is not the local player so if you tried to move with has authority the player that is hosting the game will move all players when he moves because he has hasAuthority
@@Change-jy1rl So if i create a object in scene and in it's script if i use hasAuthority that mean only host gonna interact with it right? Cool, with it i would know only host is interacting with it
Nice tutorials man! I'm really looking forward for a tutorial on server authoritive movement and dedicated server, It will be really cool! Thanks for the good content!
Great video, are there easier ways to test multiplayer other than build and run every time? It is becoming slower when the project grows larger, sadly Uecho does not work anymore and I did not find an alternative
After i use "Command" and "ClientRpc", the host and the client dosn t sync anymore and if i try to move one player then all the players in that window start to move without sync with the other windows. Any solution?
Ok for some reason everything was working but only if i was the server and the client. When using the program only as a client it was not showing the updated position on the server, but only on the client itself. What i did to fix that was to change the "network manager" with the "authority network manager script", and now everything is working. I think it has something to do with the "network transform" component, not having the checkbox for the client authority anymore.
how do u put the networkBehaviour, I can't mine just appeared red. But if I used Using UnityEngine.networking, it said that the network behaviour will be depreciated
There is a bug that if I move one sphere (client A) to the point that it will touch second sphere (client B) then I can move second sphere (client B), not the original one. So client A moves client B instead of his sphere. I've reproduced the same issue after downloading your project from github on my PC. It is about the version of Mirror?
Nah i didn't Found Such Bug i even tried to recreate the scenario u are talking about but i was not able to remake that one so i am pretty sure u did something wrong
if (!hasAuthority) { return; } makes it so that the Cmd is only for one user, then the client rpc tells all the clients to move. But the script is on each one of the players, so on the client rpc it should tell one object on each client to move. I'm not sure what your question is.
I'm a bit confused, mostly out of ignorance. So creating the CmdMove function makes sense but why implement it within the player script if it's server code? Am I understanding that right? CmdMove method is executed as if it were the server? Why not create a method within the server code that validates and is called by the player and the player sends as a parameter a callback of RpcMove? And as for RpcMove I get that the server executes this method but what is the sequence of events here? When one player wants to move they call CmdMove which then tells the server to "move me" and then the server calls RpcMove but is RpcMove being called on every single player script in the scene at the same time or is it only calling RpcMove for the player script that initiated? How does this tie into syncing player positions?
Will be great if some one can answer this question.. When you say the method CmdMove will be run on the server, where exactly will the code be placed. All the script files will be in available on both the server and client . So do we check using the code to see if this is a server or will this script be only placed on the server physical machine?
If i understood correctly when we use CmdMove() with the command tag we're basically setting the method to work on the server. Then inside the server method we call the RpcMove which is a Client method since there's [ClientRpc]. Then what happens is On the update method if we're the owner of the gameobject, and if we're pressing space, we call the CmdMove() method which has the RpcMove() method inside it, which is eventually gonna move our gameobject in your client. My question is, where are we syncing the movement between the client and the server?
Answer to my question should be: When a client presses "spacebar" it executes the CmdMove() and then broadcasts RpcMove() to all clients. However only the gameobject owned by the client that pressed the space bar will execute rpcmove and perform the movement. This ensure that the movement is synchronized across all clients, but only affects the gameobject owned by the initiating client
I don't really see why Photon would be any better necessarily. Have a look at github.com/vis2k/Mirror and assetstore.unity.com/packages/templates/systems/ummorpg-51212
Thanks for the answer. I used to struggle a lot when talking about unity's multiplayer assets without ever understanding what differentiated every of these networking systems. Do you have any documentation for that ?
@@GymCritical Assuming someone can't do something is quite close-minded. I'm not saying the odds of one person finishing an entire MMORPG are high, but flat out stating it's impossible is a little excessive don't you think?
So I have a self balancing ragdoll setup with player controlls, so I I want to sync the ragdoll joints and the parts and stuff, do I need to add the network transform and the network identity component to every single child in the player hierarchy?
I just solved it, add 'using Mirror' (without the quotes) to the top of your player script, for example: using System.Collections; using System.Collections.Generic; using UnityEngine; using Mirror; public class Player : NetworkBehaviour { [SerializeField] private Vector3 movement = new Vector3(); [Client] private void Update() { if (!hasAuthority) { return; } if (!Input.GetKeyDown(KeyCode.Space)){ return; } transform.Translate(movement); } }
When i tried to change from monobehaviour to networkbehaviour it doesn't show up. Anyone got a fix for this? Edit: Nvm just put using Mirror; to the top.
Can somebody explain what the server is? Is it the hosting client itself or a second instance running on the hosting client? And technically can't the hosting client then easily cheat?
@@acfgcnbjh actually I saw this clip yesterday, I think that "use mirror" added itself when he changed to NetworkBehavaiour ... But thank you anyway :)
No, it's not necessary, of course. He just checked all reasons for leaving the method right at the beginning in order to get them out of the way/head. In this small piece of code, it might look weird, but it's a good style for bigger or more complex methods
if (input.getKeyDown(KeyCode.Space)) means if the key pressed is space, then do this code. The ! makes it NOT so if key entered is NOT space, then do this code. It is necessary for logic
Thanks for that very informative tutorial. I just got one question: With the ClientRpc function "RpcMove" you said that this method runs on ALL the clients, but why is only our client moving since we don't pass any Network Id to the server?
hi man when i did the same code of the clientRpc Movement but i just changed it to rigidbody movement the players movement didnt synced can u help me with that ?
i don't understand the RpcMove() part, i've already used Rpc with photon, but now you called RpcMove() for every client, but why not every player move at the same time then? because of authority?
Hi ! Nice video ! Just wanted to make sure, event if I use a client hosting kind of server, I still can have a full authorative server even tho the server is the host client or its better to have dedicated server when we want to have everything ran on the server ? Thanks
If I change my player and input scripts from mono behavior to network behavior will they still work on offline mode? I have a PVE option and a local co op option also and I don’t want to break them.
I tried changing the MonoBehaviour to "NetworkBehaviour" but it was underlined in red when I did that. I have added "using Mirror;" but that just gets underlined too. Why is this?
@@alfenstein6356 yeah I did that, might have missed my other message that explained what I did wrong. Basically I was running an old build, I had to delete it and build from scratch because just building wasn't overriding the old build for some reason. Thanks for trying to help anyway!
Quick question! I want to use the new input system and I'm using bools for button input and for some reason the bool isn't changing not sure if you covered this but how would I implement it into the game?
Can someone help me? When I type anything having to do with mirror, visual studio isn't recognizing it and underlining it in red. I said using Mirror and yes the game works but visual studio says its wrong... I'm not on visual studio community, just vs
Nice tutorial! Just wonder what sort of project setting you used for the graphics? Mine is just in default 3d, the lighting and skybox doesn't look as good. Thx!
hi im working on a small project its a unity2d topdown 4 directional movement and shooting multiplayer game i got the movement and faceing right but still have problem on the client tho i cant make him shoot in diferent direction it only shoot in the default direction is any one here good at unity networking i dont know how to make the direction var works on the client public int direction????
I want to create a simple multiplayer card games for 2-4 players. Is there a way I can use mirror to make such games with random matchmaking and other stuff?
If by not "on the same WiFi connection" you mean across the internet then you'll probably need to setup port forwarding on your router. Unless you use a network transport that can do Nat punchthrough.
whenever i put if(!hasAuthority) {return;} it just disables all of my script below except for movement and turning around!!! Does anyone know what to do to fix this?
Hey Dapper Dino, I am having a problem with adding two different player prefabs to the main scene. I want player 1 to use prefab 1 and player 2 to use prefab 2 as their player controllers. The reason why I am trying this is because I want each player to look different to the other, do you think you could help? Thanks so much!
If you want to have player 1 be one color and all the others to be a different (but same) color then do if (hasAuthority) { this.spriteRenderer.color = color; } else { this.spriteRenderer.color = color2; } if you want all colors to be random, do this: this.spriteRenderer.color = color.random; (I'm not sure about the second one, check the documentation and just set it to a random color instead of color.random.) You can also do this with textures, just change the texture instead of the color.
Hi I am having some trouble with some of the lines of code in this tutorial for some reason [Client] will not work and neither will NetworkBehaviour in the player script
Video Liked, but i have a question for this Tutorial. I've tried to move my player with 2 Inputs A and D for left and right movement but if call both inputs in the update method, the player wont move anymore. if i call just 1 input in the update method, it moves. why does it not move if i try to use more inputs for several directions? i used the call in the tutorial for your update method -> if (!Input.GetKey(A)) {return;} and the same for D but both return values together causes a bug, where im not able to move the player anymore. is that normal? and how can i use multiple inputs for command? it would be very usefull to know :)
What if I don't want there to be a person hosting it? What if I need that there is just one game at all times, and that's the one people join. How can I do this?
the files are stored locally, mirror just sends very small bits of info (this player moved over here, this player is using that cosmetic) but not actually the models etc
I'm trying to make my own thing from scratch, right now I have an issue where the client never has authority. Is there something you do in this tutorial to give the client authority? if so I can't find it. Edit: I figured it out, but im keeping the comment here so if other people get this issue they can see how I fixed it. It was literally just that I had "NetworkManager List Server" as my component instead of "NetworkManager". I'm dumb.
Make sure to put at the top using Mirror;
thanks :D. i was trying to get the "NetworkBehaviour" working but couldn't figure out why it was not working
@@maxacan8532 I don't understand why he did not tell us that. Btw all the coding is unnecessary. All you have to do is just put your player in the network manager. It saves a lot of time.
Thanks Man! you saved my alot of time. :)
@@BannedFromJordo right, this is the most important thing for the script and he didn't tell in the video. Maybe he forgot.
so, when im putting it at the top, it doesn't shown up and "using mirror" doesnt work
Great Video! I switched to mirror a while back at work when we needed a replacement for the traditional UNet and I just then found out about it, and I'm glad to see it get some love :)
Keep up the great work.
same here
however there are not alot of tutorial about mirror :(
@@alipk2633 thats true, although pretty much all info /tutorials on UNet apply to Mirror as well. And the Discord is a good source as well, I would recommend that too
When using *networkbehaviour* you will need to add "using Mirror;" at the top of the script, for example, directly below "using UnityEngine;"
u saved my life
OMG I HAVE WATCHED THE VIDEO 50 TIMES NOW TO FIND OUT WHAT'S IN THE FIRST LINE I STARTED ANALYZING THE VIDEO 6:00 PM AND NOW IT'S 10:48 PM THANK YOU SO THANK YOU !!!!
you're a saviour
this series is so helpful. I love it, u really deserve more subs
what is the different of [Server] and [ServerCallback]
Also what is the difference of hasAuthority and isLocalPlayer
when you mark a function with [Server] if anything tried to call it you'll receive a error message
that's why the [ServerCallbacl] exists its basically the same as [Server,] but with no error, so you can use it on stuff you have no control over not getting it called like a update())
the main difference between hasAuthority and isLocalPlayer is that the server by default has authority over all objects so hasAuthority will return true in the host even though the object is not the local player
so if you tried to move with has authority the player that is hosting the game will move all players when he moves because he has hasAuthority
@@Change-jy1rl So if i create a object in scene and in it's script if i use hasAuthority that mean only host gonna interact with it right? Cool, with it i would know only host is interacting with it
Nice tutorials man! I'm really looking forward for a tutorial on server authoritive movement and dedicated server, It will be really cool! Thanks for the good content!
You should make more mirror videos theyre really helpful :)
Yep I will be making plenty more :)
Why does the networktransform component not sync anything AT ALL for me? I don't understand what I'm doing wrong...
Great video, are there easier ways to test multiplayer other than build and run every time? It is becoming slower when the project grows larger, sadly Uecho does not work anymore and I did not find an alternative
You can use UnityProjectCloner from hwaet on github. It's the as Uecho. I really recommend it instead of building your project each time
@@goldytack I'll try it out, thanks a lot!
0:12 "and stole it ,aaaaa, sorry open in Unity" XD
After i use "Command" and "ClientRpc", the host and the client dosn t sync anymore and if i try to move one player then all the players in that window start to move without sync with the other windows. Any solution?
It is Work?
make sure to put Using Mirror; just below where it says Using UnityEngine or your script wont work at all
I tried export to android and i have one bug "A connection cannot be established as the target computer expressly denied that connection."
Problem "The name 'hasAuthority' does not exist in the current context" is update to => hasAuthority = isOwned
This is a really clear tutorial, Thanks!
Nice video! Is there a video of you where you show how to check the player authority on the server? Would be super helpful.
I love it!
Thank you for this amazing tutorial!
Ok for some reason everything was working but only if i was the server and the client. When using the program only as a client it was not showing the updated position on the server, but only on the client itself. What i did to fix that was to change the "network manager" with the "authority network manager script", and now everything is working. I think it has something to do with the "network transform" component, not having the checkbox for the client authority anymore.
how do u put the networkBehaviour, I can't mine just appeared red. But if I used Using UnityEngine.networking, it said that the network behaviour will be depreciated
add using Mirror to the list of libraries at the top
@@ballboy2.029 it says Mirror cant be found. do i need to get the library from somewhere else?
@@slime8045 Yes, download Mirror from the asset store and import it to your project.
I have the same problem where I have imported mirror however when I write “using mirror” at the top of the script it doesn’t work
have you guys got multiple visual studios downloaded? i think i may be that i have 2016 and 2019
how did you do the server stuff did you created it alone or you bought a amazon cloud server or google cloud server?
There is a bug that if I move one sphere (client A) to the point that it will touch second sphere (client B) then I can move second sphere (client B), not the original one. So client A moves client B instead of his sphere. I've reproduced the same issue after downloading your project from github on my PC. It is about the version of Mirror?
Nah i didn't Found Such Bug i even tried to recreate the scenario u are talking about but i was not able to remake that one so i am pretty sure u did something wrong
Ok now I followed the tut as exactly as I could, but when I disable NetworkTransform, my player doesn't sync with the server anymore
7:06 Why Dont We Use isLocalPlayer?
Awesome! Just what I hoped for
Glad you found it awesome :D
Wont the client rpc tell ALL the clients to move? Why is only one client moving?
if (!hasAuthority) { return; } makes it so that the Cmd is only for one user, then the client rpc tells all the clients to move. But the script is on each one of the players, so on the client rpc it should tell one object on each client to move. I'm not sure what your question is.
@@spidernh honestly i dont even remember lmao
I'm a bit confused, mostly out of ignorance. So creating the CmdMove function makes sense but why implement it within the player script if it's server code? Am I understanding that right? CmdMove method is executed as if it were the server? Why not create a method within the server code that validates and is called by the player and the player sends as a parameter a callback of RpcMove? And as for RpcMove I get that the server executes this method but what is the sequence of events here? When one player wants to move they call CmdMove which then tells the server to "move me" and then the server calls RpcMove but is RpcMove being called on every single player script in the scene at the same time or is it only calling RpcMove for the player script that initiated? How does this tie into syncing player positions?
Will be great if some one can answer this question.. When you say the method CmdMove will be run on the server, where exactly will the code be placed. All the script files will be in available on both the server and client . So do we check using the code to see if this is a server or will this script be only placed on the server physical machine?
behavior vs behaviour ....people separated by the same language :D
Great work here, thanks!
If i understood correctly when we use CmdMove() with the command tag we're basically setting the method to work on the server. Then inside the server method we call the RpcMove which is a Client method since there's [ClientRpc]. Then what happens is On the update method if we're the owner of the gameobject, and if we're pressing space, we call the CmdMove() method which has the RpcMove() method inside it, which is eventually gonna move our gameobject in your client. My question is, where are we syncing the movement between the client and the server?
Answer to my question should be: When a client presses "spacebar" it executes the CmdMove() and then broadcasts RpcMove() to all clients. However only the gameobject owned by the client that pressed the space bar will execute rpcmove and perform the movement. This ensure that the movement is synchronized across all clients, but only affects the gameobject owned by the initiating client
By adding command tag the ball jerks and moves when I press space. host one works good but the client one jerks. Not sure if its a problem or not
Very good tutorials, explanation 1000 and understanding and cover many things
Please tell how i can implement validate Server Authoritative Movement? please i really wanted to know it somehow
Is mirror really that great when talking about a larger scope ?
Like, if i want to create an MMORPG shouldn't I switch to photon networking instead ?
I don't really see why Photon would be any better necessarily. Have a look at github.com/vis2k/Mirror and assetstore.unity.com/packages/templates/systems/ummorpg-51212
From stress tests it has been shown to hold 400+ players in a really small map
Thanks for the answer. I used to struggle a lot when talking about unity's multiplayer assets without ever understanding what differentiated every of these networking systems.
Do you have any documentation for that ?
Nawlian - Mat also. You can’t make an MMORPG. It is literally nearly impossible as a solo indie dev, which I assume you are.
@@GymCritical Assuming someone can't do something is quite close-minded. I'm not saying the odds of one person finishing an entire MMORPG are high, but flat out stating it's impossible is a little excessive don't you think?
So I have a self balancing ragdoll setup with player controlls, so I I want to sync the ragdoll joints and the parts and stuff, do I need to add the network transform and the network identity component to every single child in the player hierarchy?
whenever i connect a client, the host and client use that new player?How do i keep the host using the original player?
If each player prefab has it's own camera, you need to write a script that disables it if it's not the localPlayer.
network identity dosent work for me my playre script says there no such thing as networkBehavior
Did you ever get this fixed?
I just solved it, add 'using Mirror' (without the quotes) to the top of your player script, for example:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Mirror;
public class Player : NetworkBehaviour
{
[SerializeField] private Vector3 movement = new Vector3();
[Client]
private void Update()
{
if (!hasAuthority) { return; }
if (!Input.GetKeyDown(KeyCode.Space)){ return; }
transform.Translate(movement);
}
}
@@scottdarcy6062 Ok thx
@@scottdarcy6062 yeh i got it fixed
@@scottdarcy6062 Thx
great now how do i assign a camera to use just the client but its not the parent in the prefab.
Very detailed in describing how this how thing works. THanks
If ClientRPC calls that translate method on all the clients, why pressing space didnt move all the objects.
plz can somebody help me i got stuck unity tells me that !hasAuthority isnt known
When i tried to change from monobehaviour to networkbehaviour it doesn't show up. Anyone got a fix for this?
Edit: Nvm just put using Mirror; to the top.
I'm thinking of creating a multiplayer fps for LAN hosting - mirror or photon?
Just for LAN? Regardless, I'd say Mirror since you don't have to pay and it's a lot simpler in my opinion
@@DapperDinoCodingTutorials Ah okay, will you be covering how to set everything up and implement it into games?
Yeah bro is is brilliant like always!!
Awh, thanks :)
Can somebody explain what the server is? Is it the hosting client itself or a second instance running on the hosting client? And technically can't the hosting client then easily cheat?
How did it work with you without "Using Mirror;" ??
He's using a namepsace, I think that's why.
@@acfgcnbjh actually I saw this clip yesterday, I think that "use mirror" added itself when he changed to NetworkBehavaiour ...
But thank you anyway :)
holy potato you are a life saver, thank you so much, i was stuck on that for soooo long :))))
To stop hackers from moving your character can you not just check if the input came from localPlayer ?
Nope, because that localPlayer check is being ran on the client so it can still be hacked
@@DapperDinoCodingTutorials I'm still working my way through your videos but do you cover the validation logic for these scenarios at any point?
Very well explained!!
Why can't you just do if(input.getkeydown()) for movement? Is the ! Necessary
No, it's not necessary, of course. He just checked all reasons for leaving the method right at the beginning in order to get them out of the way/head. In this small piece of code, it might look weird, but it's a good style for bigger or more complex methods
it's always better to check against something than checking for something, don't ask me why but I see it alot, I'm sure I'll learn why eventually :P
if (input.getKeyDown(KeyCode.Space)) means if the key pressed is space, then do this code. The ! makes it NOT so if key entered is NOT space, then do this code. It is necessary for logic
Thanks for that very informative tutorial. I just got one question: With the ClientRpc function "RpcMove" you said that this method runs on ALL the clients, but why is only our client moving since we don't pass any Network Id to the server?
"RpcMove" runs on all the client applications, but only applies for the single object where "CmdMove" was called.
@@luisjs thanks!
@@luisjs thanks!
o.o
hi man when i did the same code of the clientRpc Movement but i just changed it to rigidbody movement the players movement didnt synced can u help me with that ?
The Telepathy Transport uses TCP. Isn't UDP better suited to face paced games like shooters?
i don't understand the RpcMove() part, i've already used Rpc with photon, but now you called RpcMove() for every client, but why not every player move at the same time then? because of authority?
Exactly my question
i need an answer for this question.....
ikr, how??
i'm getting this error in unity "NetworkBehaviour namespace could not be found" and i'm stuck right here
just add a library in your script: Using Mirror;
@@muskito doesnt help
Hi ! Nice video ! Just wanted to make sure, event if I use a client hosting kind of server, I still can have a full authorative server even tho the server is the host client or its better to have dedicated server when we want to have everything ran on the server ? Thanks
If I change my player and input scripts from mono behavior to network behavior will they still work on offline mode? I have a PVE option and a local co op option also and I don’t want to break them.
Mobile joystick not working after applying this. Can you help ?
I tried changing the MonoBehaviour to "NetworkBehaviour" but it was underlined in red when I did that. I have added "using Mirror;" but that just gets underlined too. Why is this?
i just typed it in at first and it wouldnt work. i started retyping but i let it finish the word for me and it worked.
I was using Unity 2019.3.12f1 and it had the same issue for me, try using older unity like Unity 2019.1.5f. This did the trick for me.
@@kaloczikvn Thanks mate!
change the namespace to Mirror i.e wrap your NetworkBehaviour with: namespace mirror {class goes here}
The player on the client will not move for me. Any ideas?
You have to give Client Authority 5:47
@@alfenstein6356 yeah I did that, might have missed my other message that explained what I did wrong. Basically I was running an old build, I had to delete it and build from scratch because just building wasn't overriding the old build for some reason. Thanks for trying to help anyway!
hi thsnkd for the video
any tips on how to connect vr headset to a network using steamvr and mirror ?
Quick question! I want to use the new input system and I'm using bools for button input and for some reason the bool isn't changing not sure if you covered this but how would I implement it into the game?
Can I multiply movement with time.DeltaTime to make it smooth?
Hey Dino. Command in client, client can remove Command ??
Thanks for your video, great explanations, great rythm
Why not using Unity Netcode with Dots? That would be nice to see.
Can someone help me? When I type anything having to do with mirror, visual studio isn't recognizing it and underlining it in red. I said using Mirror and yes the game works but visual studio says its wrong... I'm not on visual studio community, just vs
Anyone get "The type or namesapce name "Steamworks" cannot be found (are you missing a using directive or an assembly reference)?
idk if anyone has asked yet, but why did you use a namespace here? new to coding, just asking cuz I don't think you mentioned it
Nice tutorial! Just wonder what sort of project setting you used for the graphics?
Mine is just in default 3d, the lighting and skybox doesn't look as good. Thx!
fuck this series is so good man, thanks for your time
Hey! Love the Vids! I was wondering how do I get the Github Documentation of mirror onto Visual Studio or Visual Studio Code?
I am doing everything like you did but for some reason the last player that joined controlls all players
What is validation? How to do it? 11:00
For me, the [Client] Tag produced an "Invalid IL code" error. I had to remove it!
Are you using Unity 2020.2? I think that's an issue that is yet to be solved so I'd recommend using 2020.1 for Mirror at the moment
Thanks for saying this! i couldn't work out what the issue was but it was this! still an issue today on 2021.1.13f1
hi im working on a small project its a unity2d topdown 4 directional movement and shooting multiplayer game i got the movement and faceing right but still have problem on the client tho i cant make him shoot in diferent direction it only shoot in the default direction is any one here good at unity networking i dont know how to make the direction var works on the client public int direction????
If you make the server validate ALL player movement, wouldn't that make player movement have massive input delay based on ping?
Need to implement client side prediction which is difficult but prevents cheating
I have a problem, when i run, the ball doesnt move, but makes a clone that moves and stays the same place, someone know how to fix it?
steamVR please and also how to use DOTS with mirror ???
Wait! I appreciate that you already have a NetworkManager, but how did you add it in the first place?
I guess you've figured it out by now, but it was in his previous tutorial. You add it on 'Add Component' in the Inspector tab.
When I input your tutorial folder into my unity I immediately get errors and cant run anything. Is there a typo in the script?
u tried using the same unity version? also i havent importerd his tutorial
personally i use parents object to separate an categorize my project
I want to create a simple multiplayer card games for 2-4 players. Is there a way I can use mirror to make such games with random matchmaking and other stuff?
yes
would you be able to connect using the port "localhost" even if you aren't on the same wifi connection as the server host?
If by not "on the same WiFi connection" you mean across the internet then you'll probably need to setup port forwarding on your router. Unless you use a network transport that can do Nat punchthrough.
whenever i put if(!hasAuthority) {return;} it just disables all of my script below except for movement and turning around!!! Does anyone know what to do to fix this?
is it works for mobile wifi hotspot game
i want to create offline multiplayer game like mini militia
NetworkBehaviour not working on the newest version of unity, is there any way to fix it other than switching to an older version?
If you put using Mirror; it will work. I haven't tried coding yet but I assume it fixes the problem
Yeah It does! I eventually figured it out, thanks anyway
Hey, I have a problem. Everytime I use Mirror, it adds CapsuleCollider and Rigidbody to my character. Anybody knows what the cause of this may be?
Thank you very much for this effort👍
Hey Dapper Dino, I am having a problem with adding two different player prefabs to the main scene. I want player 1 to use prefab 1 and player 2 to use prefab 2 as their player controllers. The reason why I am trying this is because I want each player to look different to the other, do you think you could help? Thanks so much!
If you want to have player 1 be one color and all the others to be a different (but same) color then do
if (hasAuthority) {
this.spriteRenderer.color = color;
} else {
this.spriteRenderer.color = color2;
}
if you want all colors to be random, do this:
this.spriteRenderer.color = color.random;
(I'm not sure about the second one, check the documentation and just set it to a random color instead of color.random.)
You can also do this with textures, just change the texture instead of the color.
Will this tutorial series work for FPS games too?
yes, mirror is online, it doesn't matter what you're doing with it.
@@spidernh Ah, I see
okay i got it to now now but when i move it still moves the other one
1. Reply to your comment instead of posting another
2. Reply to this comment with your code, it's probably something really simple
Hi I am having some trouble with some of the lines of code in this tutorial for some reason [Client] will not work and neither will NetworkBehaviour in the player script
@Colby Foster I think mirror mabye updated and mabye theres something new just a theory but I have no idea
i had to add using Mirror; at the top and that fixed it!
Just write using Mirror; at the top
hi how i can put cameras for every player and everyone see their own camera?
Edit: i watched tutorials and problem is solved
Video Liked, but i have a question for this Tutorial. I've tried to move my player with 2 Inputs A and D for left and right movement but if call both inputs in the update method, the player wont move anymore. if i call just 1 input in the update method, it moves. why does it not move if i try to use more inputs for several directions? i used the call in the tutorial for your update method -> if (!Input.GetKey(A)) {return;} and the same for D but both return values together causes a bug, where im not able to move the player anymore. is that normal? and how can i use multiple inputs for command? it would be very usefull to know :)
use if(INput.GetAxis("AxisValueHere") { code to move player }, i recommend watching videos on movement since this is a vey bad way to do it
Sir Multiplayer game has 100 players and if you want to play a game with 100 players of 4 friends, how can you invite 4 friends?
What if I don't want there to be a person hosting it? What if I need that there is just one game at all times, and that's the one people join. How can I do this?
have a player host it? im confused, you can't connect to a server if the server doesn't exist
Thanks for this amazing tutorial bruh
does mirror works well with large 3d projects (about 5gb) ?
and thanks for this awesome tutorial
the files are stored locally, mirror just sends very small bits of info (this player moved over here, this player is using that cosmetic) but not actually the models etc
@@Kira-zf7te thanks for the reply
how to play sound on client and server ?
"Weaver: stop because compile errors on target"
Most likely you made a error with the script.
I'm trying to make my own thing from scratch, right now I have an issue where the client never has authority. Is there something you do in this tutorial to give the client authority? if so I can't find it.
Edit: I figured it out, but im keeping the comment here so if other people get this issue they can see how I fixed it. It was literally just that I had "NetworkManager List Server" as my component instead of "NetworkManager". I'm dumb.