How To Make A Multiplayer Game In Unity - Ownership & Authority

Поделиться
HTML-код
  • Опубликовано: 27 янв 2025

Комментарии • 297

  • @BannedFromJordo
    @BannedFromJordo 4 года назад +187

    Make sure to put at the top using Mirror;

    • @maxacan8532
      @maxacan8532 4 года назад +17

      thanks :D. i was trying to get the "NetworkBehaviour" working but couldn't figure out why it was not working

    • @BannedFromJordo
      @BannedFromJordo 4 года назад +6

      @@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.

    • @transformers395
      @transformers395 4 года назад

      Thanks Man! you saved my alot of time. :)

    • @transformers395
      @transformers395 4 года назад +1

      @@BannedFromJordo right, this is the most important thing for the script and he didn't tell in the video. Maybe he forgot.

    • @tksnack
      @tksnack 4 года назад

      so, when im putting it at the top, it doesn't shown up and "using mirror" doesnt work

  • @Throzen
    @Throzen 4 года назад +9

    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
      @alipk2633 4 года назад

      same here
      however there are not alot of tutorial about mirror :(

    • @Throzen
      @Throzen 4 года назад

      @@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

  • @eldowado1381
    @eldowado1381 4 года назад +84

    When using *networkbehaviour* you will need to add "using Mirror;" at the top of the script, for example, directly below "using UnityEngine;"

    • @TheFede98
      @TheFede98 4 года назад +8

      u saved my life

    • @greenstone1489
      @greenstone1489 4 года назад +10

      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 !!!!

    • @raderth
      @raderth 3 года назад +5

      you're a saviour

  • @noha3087
    @noha3087 4 года назад +6

    this series is so helpful. I love it, u really deserve more subs

  • @EnderElohim
    @EnderElohim 4 года назад +13

    what is the different of [Server] and [ServerCallback]
    Also what is the difference of hasAuthority and isLocalPlayer

    • @Change-jy1rl
      @Change-jy1rl 3 года назад +2

      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

    • @EnderElohim
      @EnderElohim 3 года назад

      @@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

  • @vasildinev688
    @vasildinev688 4 года назад +3

    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!

  • @bl0rgus
    @bl0rgus 4 года назад +11

    You should make more mirror videos theyre really helpful :)

  • @DiffyMC
    @DiffyMC 3 года назад

    Why does the networktransform component not sync anything AT ALL for me? I don't understand what I'm doing wrong...

  • @glenzhang3646
    @glenzhang3646 4 года назад +9

    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

    • @goldytack
      @goldytack 4 года назад +6

      You can use UnityProjectCloner from hwaet on github. It's the as Uecho. I really recommend it instead of building your project each time

    • @glenzhang3646
      @glenzhang3646 4 года назад +2

      @@goldytack I'll try it out, thanks a lot!

  • @laughingwater
    @laughingwater 4 года назад +4

    0:12 "and stole it ,aaaaa, sorry open in Unity" XD

  • @georgecalin9942
    @georgecalin9942 4 года назад +7

    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?

  • @echophantom8511
    @echophantom8511 3 года назад +3

    make sure to put Using Mirror; just below where it says Using UnityEngine or your script wont work at all

  • @ElSolitarioPerpetuo
    @ElSolitarioPerpetuo 4 года назад +3

    I tried export to android and i have one bug "A connection cannot be established as the target computer expressly denied that connection."

  • @nerozbiceps
    @nerozbiceps 11 месяцев назад +2

    Problem "The name 'hasAuthority' does not exist in the current context" is update to => hasAuthority = isOwned

  • @Sir.Rollback
    @Sir.Rollback 4 года назад +1

    This is a really clear tutorial, Thanks!

  • @jakobriess9971
    @jakobriess9971 2 года назад

    Nice video! Is there a video of you where you show how to check the player authority on the server? Would be super helpful.

  • @pennaverdeful
    @pennaverdeful 4 года назад +1

    I love it!
    Thank you for this amazing tutorial!

  • @MidnaTv
    @MidnaTv 10 месяцев назад

    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.

  • @rosechan8258
    @rosechan8258 4 года назад +4

    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

    • @ballboy2.029
      @ballboy2.029 4 года назад +2

      add using Mirror to the list of libraries at the top

    • @slime8045
      @slime8045 4 года назад

      @@ballboy2.029 it says Mirror cant be found. do i need to get the library from somewhere else?

    • @renstrom9885
      @renstrom9885 4 года назад

      @@slime8045 Yes, download Mirror from the asset store and import it to your project.

    • @maxwright5075
      @maxwright5075 4 года назад

      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

    • @slime8045
      @slime8045 4 года назад

      have you guys got multiple visual studios downloaded? i think i may be that i have 2016 and 2019

  • @elirannissani914
    @elirannissani914 4 года назад +1

    how did you do the server stuff did you created it alone or you bought a amazon cloud server or google cloud server?

  • @historiewarteuwagi
    @historiewarteuwagi 4 года назад +2

    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?

    • @akarsh9407
      @akarsh9407 3 года назад

      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

  • @mickmickymick6927
    @mickmickymick6927 3 года назад +1

    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

  • @ahmedthegreat3973
    @ahmedthegreat3973 3 года назад

    7:06 Why Dont We Use isLocalPlayer?

  • @zannleft7117
    @zannleft7117 4 года назад +2

    Awesome! Just what I hoped for

  • @user-th8pr7no5p
    @user-th8pr7no5p 4 года назад +1

    Wont the client rpc tell ALL the clients to move? Why is only one client moving?

    • @spidernh
      @spidernh 4 года назад

      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.

    • @user-th8pr7no5p
      @user-th8pr7no5p 4 года назад +1

      @@spidernh honestly i dont even remember lmao

  • @cjon7982
    @cjon7982 4 года назад

    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?

  • @sivachennai7572
    @sivachennai7572 4 года назад +1

    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?

  • @evanmaxey
    @evanmaxey 3 года назад

    behavior vs behaviour ....people separated by the same language :D
    Great work here, thanks!

  • @MidnaTv
    @MidnaTv 10 месяцев назад

    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?

    • @MidnaTv
      @MidnaTv 10 месяцев назад

      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

  • @adnanshaukat412
    @adnanshaukat412 2 года назад

    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

  • @_el_tas_
    @_el_tas_ 4 года назад +1

    Very good tutorials, explanation 1000 and understanding and cover many things

  • @akarsh9407
    @akarsh9407 3 года назад

    Please tell how i can implement validate Server Authoritative Movement? please i really wanted to know it somehow

  • @nawlian-mat5976
    @nawlian-mat5976 4 года назад +6

    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 ?

    • @DapperDinoCodingTutorials
      @DapperDinoCodingTutorials  4 года назад +3

      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

    • @shortiez3149
      @shortiez3149 4 года назад +3

      From stress tests it has been shown to hold 400+ players in a really small map

    • @nawlian-mat5976
      @nawlian-mat5976 4 года назад

      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
      @GymCritical 4 года назад

      Nawlian - Mat also. You can’t make an MMORPG. It is literally nearly impossible as a solo indie dev, which I assume you are.

    • @LuukDomhof
      @LuukDomhof 4 года назад +2

      @@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?

  • @ved0321
    @ved0321 4 года назад +1

    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?

  • @davidgeron324
    @davidgeron324 4 года назад +3

    whenever i connect a client, the host and client use that new player?How do i keep the host using the original player?

    • @angrycatgirl7879
      @angrycatgirl7879 4 года назад +1

      If each player prefab has it's own camera, you need to write a script that disables it if it's not the localPlayer.

  • @thesilhouette1529
    @thesilhouette1529 4 года назад +2

    network identity dosent work for me my playre script says there no such thing as networkBehavior

    • @scottdarcy6062
      @scottdarcy6062 4 года назад

      Did you ever get this fixed?

    • @scottdarcy6062
      @scottdarcy6062 4 года назад +2

      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);
      }
      }

    • @thesilhouette1529
      @thesilhouette1529 4 года назад

      @@scottdarcy6062 Ok thx

    • @thesilhouette1529
      @thesilhouette1529 4 года назад +1

      @@scottdarcy6062 yeh i got it fixed

    • @ceilingfandev651
      @ceilingfandev651 4 года назад

      @@scottdarcy6062 Thx

  • @MarshmallowBoy
    @MarshmallowBoy 3 года назад

    great now how do i assign a camera to use just the client but its not the parent in the prefab.

  • @tabooization123
    @tabooization123 3 года назад

    Very detailed in describing how this how thing works. THanks

  • @msbrdmr
    @msbrdmr 2 года назад

    If ClientRPC calls that translate method on all the clients, why pressing space didnt move all the objects.

  • @xGAMER-xc4tm
    @xGAMER-xc4tm 4 года назад +1

    plz can somebody help me i got stuck unity tells me that !hasAuthority isnt known

  • @mikael9931
    @mikael9931 4 года назад +13

    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.

  • @pineappleturnovers9431
    @pineappleturnovers9431 4 года назад +4

    I'm thinking of creating a multiplayer fps for LAN hosting - mirror or photon?

    • @DapperDinoCodingTutorials
      @DapperDinoCodingTutorials  4 года назад +4

      Just for LAN? Regardless, I'd say Mirror since you don't have to pay and it's a lot simpler in my opinion

    • @pineappleturnovers9431
      @pineappleturnovers9431 4 года назад

      @@DapperDinoCodingTutorials Ah okay, will you be covering how to set everything up and implement it into games?

  • @ivanpolkanov3273
    @ivanpolkanov3273 4 года назад +21

    Yeah bro is is brilliant like always!!

  • @lukass1604
    @lukass1604 4 года назад

    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?

  • @borisgolubovic4533
    @borisgolubovic4533 4 года назад +4

    How did it work with you without "Using Mirror;" ??

    • @acfgcnbjh
      @acfgcnbjh 4 года назад

      He's using a namepsace, I think that's why.

    • @borisgolubovic4533
      @borisgolubovic4533 4 года назад +1

      @@acfgcnbjh actually I saw this clip yesterday, I think that "use mirror" added itself when he changed to NetworkBehavaiour ...
      But thank you anyway :)

    • @wondercoll3719
      @wondercoll3719 4 года назад

      holy potato you are a life saver, thank you so much, i was stuck on that for soooo long :))))

  • @shortiez3149
    @shortiez3149 4 года назад +3

    To stop hackers from moving your character can you not just check if the input came from localPlayer ?

    • @DapperDinoCodingTutorials
      @DapperDinoCodingTutorials  4 года назад +3

      Nope, because that localPlayer check is being ran on the client so it can still be hacked

    • @Justin-qr9mh
      @Justin-qr9mh 4 года назад

      @@DapperDinoCodingTutorials I'm still working my way through your videos but do you cover the validation logic for these scenarios at any point?

  • @davidxkie2258
    @davidxkie2258 4 года назад +1

    Very well explained!!

  • @powplowdevs2415
    @powplowdevs2415 4 года назад +3

    Why can't you just do if(input.getkeydown()) for movement? Is the ! Necessary

    • @morvister
      @morvister 4 года назад +1

      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

    • @Justicefu
      @Justicefu 4 года назад +1

      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

    • @mayapapaya4328
      @mayapapaya4328 4 года назад

      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

  • @xxanton8xx
    @xxanton8xx 4 года назад +3

    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?

    • @luisjs
      @luisjs 4 года назад +4

      "RpcMove" runs on all the client applications, but only applies for the single object where "CmdMove" was called.

    • @xxanton8xx
      @xxanton8xx 4 года назад +1

      @@luisjs thanks!

    • @koferperk
      @koferperk 3 года назад

      @@luisjs thanks!

    • @koferperk
      @koferperk 2 года назад

      o.o

  • @bloch1347
    @bloch1347 2 года назад

    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 ?

  • @raistlinmajere2257
    @raistlinmajere2257 4 года назад

    The Telepathy Transport uses TCP. Isn't UDP better suited to face paced games like shooters?

  • @desmondmies3095
    @desmondmies3095 4 года назад +1

    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?

  • @chuasunghui6812
    @chuasunghui6812 4 года назад +1

    i'm getting this error in unity "NetworkBehaviour namespace could not be found" and i'm stuck right here

    • @muskito
      @muskito 4 года назад +1

      just add a library in your script: Using Mirror;

    • @sirplayalot1020
      @sirplayalot1020 4 года назад

      @@muskito doesnt help

  • @GaLzZy.
    @GaLzZy. 4 года назад

    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

  • @iKidBuu
    @iKidBuu 3 года назад

    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.

  • @muratcan118
    @muratcan118 2 года назад

    Mobile joystick not working after applying this. Can you help ?

  • @intrer8601
    @intrer8601 4 года назад +1

    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?

    • @davidgeron324
      @davidgeron324 4 года назад

      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.

    • @kaloczikvn
      @kaloczikvn 4 года назад

      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.

    • @acfgcnbjh
      @acfgcnbjh 4 года назад

      @@kaloczikvn Thanks mate!

    • @bigchotonight
      @bigchotonight 4 года назад

      change the namespace to Mirror i.e wrap your NetworkBehaviour with: namespace mirror {class goes here}

  • @TrophyGuide101
    @TrophyGuide101 4 года назад +1

    The player on the client will not move for me. Any ideas?

    • @alfenstein6356
      @alfenstein6356 4 года назад

      You have to give Client Authority 5:47

    • @TrophyGuide101
      @TrophyGuide101 4 года назад

      @@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!

  • @ekawooha5870
    @ekawooha5870 4 года назад

    hi thsnkd for the video
    any tips on how to connect vr headset to a network using steamvr and mirror ?

  • @huntserston3579
    @huntserston3579 4 года назад

    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?

  • @saadanees7989
    @saadanees7989 3 года назад

    Can I multiply movement with time.DeltaTime to make it smooth?

  • @blablu2475
    @blablu2475 3 года назад

    Hey Dino. Command in client, client can remove Command ??

  • @Exxayy
    @Exxayy 4 года назад

    Thanks for your video, great explanations, great rythm

  • @Roadis
    @Roadis 4 года назад

    Why not using Unity Netcode with Dots? That would be nice to see.

  • @rachelstroud2863
    @rachelstroud2863 4 года назад

    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

  • @Sillymonkeies
    @Sillymonkeies 3 года назад

    Anyone get "The type or namesapce name "Steamworks" cannot be found (are you missing a using directive or an assembly reference)?

  • @chocokai
    @chocokai 4 года назад

    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

  • @everydaydev6408
    @everydaydev6408 4 года назад

    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!

  • @Justicefu
    @Justicefu 4 года назад

    fuck this series is so good man, thanks for your time

  • @jasonross2513
    @jasonross2513 4 года назад

    Hey! Love the Vids! I was wondering how do I get the Github Documentation of mirror onto Visual Studio or Visual Studio Code?

  • @muffle2877
    @muffle2877 2 года назад

    I am doing everything like you did but for some reason the last player that joined controlls all players

  • @eloreneloreneloreneloreneloren
    @eloreneloreneloreneloreneloren 4 года назад

    What is validation? How to do it? 11:00

  • @klaudialustig3259
    @klaudialustig3259 3 года назад +1

    For me, the [Client] Tag produced an "Invalid IL code" error. I had to remove it!

    • @DapperDinoCodingTutorials
      @DapperDinoCodingTutorials  3 года назад

      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

    • @eerie5450
      @eerie5450 3 года назад

      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

  • @dream_catcher7725
    @dream_catcher7725 4 года назад

    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????

  • @SuperCaitball
    @SuperCaitball 3 года назад

    If you make the server validate ALL player movement, wouldn't that make player movement have massive input delay based on ping?

    • @BlizzardZGaming
      @BlizzardZGaming 3 года назад

      Need to implement client side prediction which is difficult but prevents cheating

  • @gano105
    @gano105 4 года назад

    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?

  • @llIIllIlIIllX_XIillIIllIIllIll
    @llIIllIlIIllX_XIillIIllIIllIll 4 года назад

    steamVR please and also how to use DOTS with mirror ???

  • @Ginjitzu
    @Ginjitzu 4 года назад

    Wait! I appreciate that you already have a NetworkManager, but how did you add it in the first place?

    • @mickmickymick6927
      @mickmickymick6927 3 года назад +1

      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.

  • @agentgc
    @agentgc 4 года назад +1

    When I input your tutorial folder into my unity I immediately get errors and cant run anything. Is there a typo in the script?

    • @sneakycheeky531
      @sneakycheeky531 4 года назад

      u tried using the same unity version? also i havent importerd his tutorial

  • @watercat1248
    @watercat1248 4 года назад +1

    personally i use parents object to separate an categorize my project

  • @monishvyas2749
    @monishvyas2749 4 года назад

    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?

  • @ballboy2.029
    @ballboy2.029 4 года назад

    would you be able to connect using the port "localhost" even if you aren't on the same wifi connection as the server host?

    • @EricWilliamsCG
      @EricWilliamsCG 4 года назад +1

      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.

  • @mas3675
    @mas3675 4 года назад

    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?

  • @rupeshsappata1432
    @rupeshsappata1432 4 года назад

    is it works for mobile wifi hotspot game
    i want to create offline multiplayer game like mini militia

  • @boringsoren
    @boringsoren 4 года назад

    NetworkBehaviour not working on the newest version of unity, is there any way to fix it other than switching to an older version?

    • @strahinjapantic6529
      @strahinjapantic6529 4 года назад

      If you put using Mirror; it will work. I haven't tried coding yet but I assume it fixes the problem

    • @boringsoren
      @boringsoren 4 года назад

      Yeah It does! I eventually figured it out, thanks anyway

  • @flash3621
    @flash3621 4 года назад

    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?

  • @mahdir_o406
    @mahdir_o406 4 года назад

    Thank you very much for this effort👍

  • @seanlynch4354
    @seanlynch4354 4 года назад

    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!

    • @spidernh
      @spidernh 4 года назад

      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.

  • @tehanperera4
    @tehanperera4 4 года назад

    Will this tutorial series work for FPS games too?

    • @spidernh
      @spidernh 4 года назад

      yes, mirror is online, it doesn't matter what you're doing with it.

    • @tehanperera4
      @tehanperera4 4 года назад

      @@spidernh Ah, I see

  • @mas3675
    @mas3675 4 года назад

    okay i got it to now now but when i move it still moves the other one

    • @spidernh
      @spidernh 4 года назад

      1. Reply to your comment instead of posting another
      2. Reply to this comment with your code, it's probably something really simple

  • @ellouzer
    @ellouzer 4 года назад

    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

    • @ellouzer
      @ellouzer 4 года назад

      @Colby Foster I think mirror mabye updated and mabye theres something new just a theory but I have no idea

    • @kippenegg
      @kippenegg 4 года назад +4

      i had to add using Mirror; at the top and that fixed it!

    • @hiddenkendo
      @hiddenkendo 4 года назад +3

      Just write using Mirror; at the top

  • @rallyman94
    @rallyman94 3 года назад

    hi how i can put cameras for every player and everyone see their own camera?
    Edit: i watched tutorials and problem is solved

  • @trisharpgaming9328
    @trisharpgaming9328 4 года назад

    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 :)

    • @Kira-zf7te
      @Kira-zf7te 4 года назад +1

      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

  • @amiyaai
    @amiyaai 4 года назад

    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?

  • @hriday684
    @hriday684 4 года назад

    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?

    • @Kira-zf7te
      @Kira-zf7te 4 года назад

      have a player host it? im confused, you can't connect to a server if the server doesn't exist

  • @vaqifquluzada2190
    @vaqifquluzada2190 4 года назад

    Thanks for this amazing tutorial bruh

  • @ahmedsaed26
    @ahmedsaed26 4 года назад

    does mirror works well with large 3d projects (about 5gb) ?
    and thanks for this awesome tutorial

    • @Kira-zf7te
      @Kira-zf7te 4 года назад

      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

    • @ahmedsaed26
      @ahmedsaed26 4 года назад

      @@Kira-zf7te thanks for the reply

  • @alfenfebral4600
    @alfenfebral4600 4 года назад

    how to play sound on client and server ?

  • @FireJojoBoy
    @FireJojoBoy 4 года назад +3

    "Weaver: stop because compile errors on target"

    • @BannedFromJordo
      @BannedFromJordo 4 года назад

      Most likely you made a error with the script.

  • @spidernh
    @spidernh 4 года назад +1

    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.