Tutorial - Create a Local Co-Op Player Setup Screen in Unity with the New Input System

Поділитися
Вставка
  • Опубліковано 20 жов 2024
  • In this video I demonstrate a pattern which can be used in a game to create a player-join setup screen that is common in most games where local co-op multiplayer is supported. We will be building off of the example from my last video ( • Local Co-op in Unity u... ) where I add a setup screen and create a system which will persist the player input configuration to span scenes. We will be using components found in the new input system package such as PlayerInputManager, PlayerInput, InputSystemUIInputModule, and MultiplayerEventSystem.
    Technology Used
    Unity Engine 3D 2019.3
    New Unity Input System
    Git
    Visual Studio 2019
    .Net Scripting in C#
    Everything shown in the video can be downloaded from my Github repository so you can follow along, or reference my approach to creating a local co-op setup screen and multiplayer system in this project.
    Github Repository Link: github.com/Srf...
    Github Sample Start Link: github.com/Srf...
    Github Completed Sample Link: github.com/Srf...
    Official Documentation Link: docs.unity3d.c...
    Time Codes:
    02:14 Create Setup Menu Scene
    03:40 Create a PlayerConfigurationManager Singleton (holds the PlayerInputManager Component)
    16:00 Create PlayerConfiguration Prefab (holds the PlayerInput Component)
    17:25 Create Individual Player Setup Menu UI Prefab
    34:27 Add New Player Action And Generate C# Class
    36:24 Spawn Player Setup Menu when player joins
    43:50 Update existing scene to load in player configurations from setup screen
    56:13 Final Working Result
    Broken Knights Games:
    Website: brokenknights.com
    Twitter: / broken_knights
    Instagram: / brokenknightsgames
    ► Music Credit: LAKEY INSPIRED
    Track Name: "Better Days"
    Music By: LAKEY INSPIRED @ / lakeyinspired
    License for commercial use: Creative Commons Attribution 3.0 Unported "Share Alike" (CC BY-SA 3.0) License.

КОМЕНТАРІ • 146

  • @tzsjynx
    @tzsjynx 4 роки тому +31

    I couldn't find anything else like this in any form anywhere to help with this - I have no idea how this has so few views/likes. Thanks for doing this it covers everything needed to setup local multiplayer!

    • @dangeloodin5501
      @dangeloodin5501 3 роки тому

      I realize it is kinda off topic but does anyone know a good place to stream new movies online ?

    • @giovannihuxley323
      @giovannihuxley323 3 роки тому

      @Keegan Karsyn Definitely, I have been using flixzone for since april myself :D

    • @ezekieljulian7387
      @ezekieljulian7387 3 роки тому

      @Keegan Karsyn Thanks, I signed up and it seems like a nice service :D I really appreciate it!!

    • @bentonarjun8513
      @bentonarjun8513 3 роки тому

      @Keegan Karsyn Thanks, I signed up and it seems like they got a lot of movies there :) I really appreciate it!

    • @angelparker5897
      @angelparker5897 3 роки тому

      @Keegan Karsyn thanks, I went there and it seems like a nice service :) I really appreciate it !

  • @morskystudio3973
    @morskystudio3973 4 роки тому +2

    I don't normally comment, but I'm just really thankful for you taking the time to explain something that has absolutely no explanation from Unity.

  • @sirpaulmcd
    @sirpaulmcd 4 роки тому +10

    This tutorial was amazing! Your videos on the new input system are far better than any others that are currently available. In your code, you clearly show care for good software practices which many tutorials lack. You've saved me countless hours and frustration. I'm subbed and looking forward to future videos!

  • @starskey3458
    @starskey3458 4 роки тому +10

    Not a lot of info out there for this kind of thing with the new input system so thanks for all these videos you're doing

  • @kuraikage15
    @kuraikage15 4 роки тому +3

    I spent a lot of time breaking my head over how to use the C# events with PlayerInput and I came to the same solution as you did. I couldn't find anything better either. Good to get some validation from another fellow developer. Thanks. Exactly what I was looking for.

  • @dp825
    @dp825 3 роки тому +1

    This is an absolute Life-Saver! Wonderful Tutorial! I hope you come back and make more Vids!

  • @gabriellpweb
    @gabriellpweb Рік тому

    This is one if not the one best tutorial about local multiplayer coop input setup. Pitty you didn't make anymore videos

  • @sHorz
    @sHorz 4 роки тому +4

    Great content, so good to have someone to look for when i'm lost
    Appreciate u

  • @colorbreakers2383
    @colorbreakers2383 4 роки тому +1

    Awesome video as always! I love that you make videos about topics that almost no one else talks about. Keep up the good work!

  • @calvin8950
    @calvin8950 3 роки тому +6

    @49:55 I found a good way to do it! In PlayerConfigurationManager don't add DontDestroyOnLoad. In the sample scene keep the player input manager but change the join behavior to join players manually. When you instantiate the players in the LevelInitializer they are instantiated in the order of player number and replace the PlayerInput.PlayerIndex of the now deleted PlayerConfigurations.

    • @friesarecool4777
      @friesarecool4777 Рік тому

      i cannot express how much u sir have just saved my life thank u so much
      to all others of this issue, if you download the scripts from his github, DO THIS IT WORKS

  • @perryplatypult9287
    @perryplatypult9287 3 роки тому

    WOW you are such a small channel with great content especially around the new input system!

  • @petipois28
    @petipois28 3 роки тому

    Great Tutorial, I have always wanted to make a local multiplayer game but the old unity system made it so confusing. Thank you so much really needed this. :D

  • @tamerxero
    @tamerxero 4 роки тому +1

    Thanks, mate! Great tutorial that makes for a super modular system! Using this in my aetherpunk rpg, thanks again!

  • @japandoudou67
    @japandoudou67 2 роки тому

    Your tutorial was amazing ! Thank you for sharing this and the sources ! They helped me when it doesn't work in my use case, by comparing the configuration diff !

  • @shawnw86
    @shawnw86 4 роки тому +5

    Great tutorial! I did something similar, but decided to put my PlayerInputHandler on the PlayerConfiguration object that gets created instead. This way, I still have direct access to the PlayerInput component and can subscribe to events (or just use SendMessage) instead of comparing the string name of the class in Controls with the string name of the fired event. This also fixed a problem where controls were playing twice, as both regular and cancelled presses would fire the action event.
    To get it working, i just had to find the reference to my Mover, which I did by dispatching an Event when a player joins in which is received by the object that contains the game boards. If playerconfig[0] doesnt exist, then it gets the first board's mover, and if it does, it goes the second. Works flawlessly so far, and I can subscribe to each press/cancel/hold event separately.

    • @brokenknightsgames7966
      @brokenknightsgames7966  4 роки тому

      I like the improvements to the approach!

    • @erosjagatpulagana6403
      @erosjagatpulagana6403 4 роки тому +1

      this seems to be my case, but i still dont get it thoroughly. would you please kindly elaborate the second paragraph, oh how it works by pseudocode? that would mean a lot. Thanks!!

    • @foundtexas5424
      @foundtexas5424 3 роки тому

      I´m curious about what you did with the LevelInitializer in order to assign the mover I managed to do it with avery convoluted referance but yours seam a bit more clean

    • @sudarshanseshadri5504
      @sudarshanseshadri5504 2 роки тому

      @@foundtexas5424 did you figure this out?

  • @xanarihstudios2997
    @xanarihstudios2997 3 роки тому +1

    Really good tutorial man, its so thorough and I cant wait to finish implementing it :D

  • @DrFross09
    @DrFross09 2 роки тому

    Great Tutorial everything worked out fine, It took me a day to figure this out, but I'm GLAD that you stuck with it until the end, to deliver such quality.
    I do have an issue when returning to the main menu and trying to join players again (only new devices can join) , but you got me this far I think I can handle that much...
    If there was a way to clear all devices from the input manager that would work swell.
    *Edit* well it seems the code from the PlayerSetupMenu worked perfectly. I just told the menu (via for loop) to Instantiate playerSetupMenuPrefabs based on the number of connected devices and connect it to the corresponding device.

    • @BattleDuckz
      @BattleDuckz 11 місяців тому

      I realise you posted this comment a year ago, but I'm just running up against the same issue.
      I don't suppose you'd be able to go into a little more depth or share the code you used for for solution. Im struggling to loop through the connected devices & connect them to the corresponding inputs.

  • @tomasabrams7234
    @tomasabrams7234 3 роки тому

    Aye I was the 700th subscriber lol, thanks for the tutorial!! Very Helpful!

  • @mikesk1993
    @mikesk1993 4 роки тому

    I don't usually make comments on videos but I seriously appreciate this tutorial so much. Have been searching for a while to find a tutorial for this exact thing and I'm glad I found your video! Liked and subscribed! :D

    • @twopieces8154
      @twopieces8154 4 роки тому

      I have a problem with “playerInput.playerIndex”
      PlayerIndex doesn’t work/exists, can you help me?

    • @wildBcat
      @wildBcat 4 роки тому

      @@twopieces8154 Where in the code is this?

  • @rafaelharana1494
    @rafaelharana1494 4 роки тому

    Great tutorial, will sure help me with my project. Thanks for such effort even with few views (by now)!

  • @tehanperera4
    @tehanperera4 3 роки тому

    I've literally found the exact thing I've been looking for, Thanks!

  • @mr.kofeek
    @mr.kofeek Рік тому

    Thank you for your tutorial! It's not what I exactly needed, but it is a really good foundation!

  • @JoshuaSonOfOne
    @JoshuaSonOfOne 4 роки тому +2

    Really appreciate this tutorial! So few people are covering the new Input System.
    If you're taking suggestions, I'd love to see a tutorial building on this one that demos the automatic split-screen feature in Player Input Manager. I haven't found any good resources covering that feature yet.

  • @Fidfriendly7106
    @Fidfriendly7106 Рік тому

    Thank you, this video was extremely helpful.

  • @bome99
    @bome99 3 роки тому

    Great tutorial! Still hold up even with the new updates

  • @qball13z
    @qball13z 4 роки тому +2

    I loved this! Thank you for putting this information together in an easily digestible video! I have one question, have you tried this on mobile? Gamepads work, even keyboard and mouse, but when I run on my iPhone the menu doesn't initialize when I tap the screen. It's as if the Touchscreen is disabled. Appreciate any ideas you may have, keep up the great work!

  • @adamkarolin
    @adamkarolin 4 роки тому +1

    Really high quality content, thx ;)

  • @digitalspirit8247
    @digitalspirit8247 3 роки тому

    Really, really great job ! I've learned a lot thank you :)

  • @DaLivelyGhost
    @DaLivelyGhost 3 роки тому

    Incredible tutorial. Learned a lot.

  • @TheDamiano16
    @TheDamiano16 3 роки тому

    You saved my life! Thank you for this video :)

  • @vege8222
    @vege8222 4 роки тому

    This was super helpful. Thank you!

  • @johannaavala3189
    @johannaavala3189 4 роки тому +3

    Great tutorial. Tried to make player jump. The problem was that both of my players jumping with both controls. Anyone knows how to make Jump function work for each player?

    • @wildBcat
      @wildBcat 4 роки тому

      How did you add the jump feature?

  • @tacoconsalsa4078
    @tacoconsalsa4078 4 роки тому

    Man, you just nailed it

  • @marmadon6341
    @marmadon6341 Рік тому

    Thank you sir, this tutorial was very helpful! I'm now trying to reset the player inputs when returning to the main menu. The way I'm doing it is simply to destroy the Player Input Manager object. However, I'm now having a problem that the players can't select their color at the set-up screen. The player index are successfully being resetted, so I'm not sure what the problem might be. Did anyone here manage to make it work?

  • @gabrielchammo8378
    @gabrielchammo8378 4 роки тому +3

    I have a problem with this. 43:26 I get an error saying ""ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
    Parameter name: index"

    • @Chen-pf7wc
      @Chen-pf7wc 4 роки тому

      ya, same problem. Did anyone solved?

    • @wildBcat
      @wildBcat 4 роки тому +1

      @@Chen-pf7wc I solved it (I don't know if you had the same problem). In the player configuration manager I had if (playerConfigs.Any(p => p.PlayerIndex == pi.playerIndex)) instead of if (!playerConfigs.Any(p => p.PlayerIndex == pi.playerIndex)) I was missing the !

    • @AetherXIV
      @AetherXIV 4 роки тому +1

      @@wildBcat I had the same problem and realized I forgot the "!" and then saw your comment :) so hopefully others will read our comments

    • @keparsons12
      @keparsons12 3 роки тому +1

      @@wildBcat Thank you so much! Was looking this up everywhere! You sir are amazing!

  • @TheMrSnipey
    @TheMrSnipey 3 роки тому

    Excellent tutorial. Thanks.

  • @RomekjeG
    @RomekjeG 7 місяців тому

    How does leaving work? Disconnect a controller. Or if you joined with a controller for example. being able to leave. And later Join again.

  • @xXGoJonnyXx
    @xXGoJonnyXx 4 роки тому

    Great vid! Really helped a lot! I am making a simple game with 1 vs 1 local multiplayer. I got that working (thanks to this tutorial) and have been trying to implement an online 1 vs 1 multiplayer using mirror but i can't get it to work. I would like to use the basics you showed in this vid but then have it work online with mirror as well. Is there a simple way of doing it or is it another 1h video on that topic?

  • @yeeteronipizza
    @yeeteronipizza 4 роки тому

    Super helpful, thanks so much my dood

  • @braxtonsdev9564
    @braxtonsdev9564 10 місяців тому

    Works beautifully if using a Gamepad and a Keyboard; however, if I use 2 keyboards they both read as the same input. Any Advice?

  • @backflipbro790
    @backflipbro790 2 роки тому

    Is the last tutorial necessary to follow this one? He uses his past movement script but idk

  • @budiandraym8451
    @budiandraym8451 3 роки тому +4

    There are 2 event systems in the scene. Please ensure there is always exactly one event system in the scene
    UnityEngine.InputSystem.UI.MultiplayerEventSystem:Update ()
    help

    • @joanlinan8931
      @joanlinan8931 3 роки тому +1

      I'm having exactly the same problem, i have downloaded his unity project and it doesn't happen to him, so maybe is the unity version? idk cause i have done this tutorial like 3 times.
      The navegation works, buti dont like this warning.

    • @nagybalint1474
      @nagybalint1474 3 роки тому

      he has warnings turned off it even says that in his version

  • @friesandcats1919
    @friesandcats1919 Рік тому

    ion know if anyone still sees this but whenever i load into the sample scene, the player configuration loads with me and it takes up controller, how do i delete it upon loading the scene?

  • @chriswickham8306
    @chriswickham8306 3 роки тому

    Struggling to get beyond 15mins or so with:
    ''PlayerInput' does not contain a definition for 'playerIndex'.
    Everywhere where this is referenced. Any insights?

  • @th3c0r4x
    @th3c0r4x 2 роки тому

    Cannot figure out how to make jumping work T.T
    I created an OnJump, pretty much replication how OnMove works. I figured out to pass context.ReadValue() instead of context.ReadValue(). But inside my Jumper.cs I have no idea to make the acutal Jump work.

  • @Steveg2110
    @Steveg2110 2 роки тому

    Does this account for if ur controller dosconects? And if so where is the part that fixes it?

  • @xvalue
    @xvalue 3 роки тому

    *subscribed*
    Great work on this.

  • @90Bilu
    @90Bilu Рік тому

    IO know this is 3 years old but I encounter an issue.
    If the first player is keyboard controlled and the second is a gamepad controlled, after the loading of the second scene, player 1 is stildd controlled by the keyboard and player 2 is still controled by the gamepad.
    But in the first scene, if the player 1 is controlled by a gamepad and the second player by the keyboard, when the second scene is loaded, the first player is now controlled by the keyboard and the second player is now controlled by the gamepad.
    And finally, if in the first scene the player 1 is controlled by a gamepad and the scond player is controller bu a second gamepad. When the secon scene has loaded, the first player can be controlled by the first gamepad but the second player doesn't move at all (keyboard or gamepad do nothing)
    If I use the keyboard for player one, and gamepad for player 2 and gamepad for player 3, all is working very well.
    Like it seems that unity NEED a player controlled by a keyboard and it NEED to be the player 1 (index 0).
    Some one to help me ?

  • @erosjagatpulagana6403
    @erosjagatpulagana6403 4 роки тому

    hidden gem indeed

  • @Pierre_Dev
    @Pierre_Dev 2 роки тому

    how would you make it work in a single Canvas? like a character selection screen? thanks for the help until

  • @ianpercy1333
    @ianpercy1333 2 роки тому +1

    Not sure why, but when a new controller joins, the old one stops working. Does anyone know why this might be? Apart from this, I've gotten everything else working. Great tutorial.

    • @ianpercy1333
      @ianpercy1333 2 роки тому

      That was an easy fix. For anyone encountering this: I had a separate map in Player Input (PlayerConfiguration object) for UI Input. The default map was getting set to Player, which did not have bindings for UI navigation.

    • @kieranclarke6161
      @kieranclarke6161 2 роки тому

      OMG I COULD KISS YOU RIGHT NOW!! HOLY ... THANK YOU!!

  • @anishpunish
    @anishpunish 4 роки тому +1

    Hi, I have a weird bug.
    after selecting the colors. When both players have the option to press "Ready", if only either one of the player presses ready, the SampleScene is loaded.
    It does not happen when one player presses ready first and then a second player joins.
    Can anyone tell me what I might be doing wrong?
    Edit: Found the problem and solved it. It was a logical error. I feel so stupid
    Solution: In "PayerConfigurationManager.cs", in ReadyPlayer function, instead of using the correct lambda expression to check the condition, i was setting it up in a wrong way. So for example, instead of p=>p.IsReady==true, it was p=>p.IsReady= true.

  • @Delvarn
    @Delvarn 2 роки тому

    Firstly, great video! been looking for one that explains 2 player set up on one screen. Question - do you know why my UI works for my controller player but not for a keyboard and mouse player?

    • @friesandcats1919
      @friesandcats1919 Рік тому

      not sure if u figured it out, but i assume u need to set up your control scheme to allow for keyboard specifically as well as controller! hope that helps!

  • @vincent666skate
    @vincent666skate 4 роки тому

    I am in 10 min and i so like this tuto ! :D

  • @chickenfrenzy9096
    @chickenfrenzy9096 Рік тому

    I know this is a fairly old video so don't know if Ill get a response. I have rewatched and retraced my steps a handful of times, but for some reason only one controller controls both players. The first player uses the control map then the second is using a clone of it. I am using the player input manager, the Input system UI module, and the multiplayer event system. Not getting any errors in the code. Any places I should look in particular?

    • @chickenfrenzy9096
      @chickenfrenzy9096 Рік тому +1

      Found my issue. input.uiInputModule was reading null on the SpawnPlayerSetupMenu. Had to access the event system and get it from there. Now when a new player joins however, the button of the first player is having its disabled color applied for some reason 🧐

    • @justinlooman5791
      @justinlooman5791 Рік тому

      ​@@chickenfrenzy9096 I am having this exact same issue. I was trying to understand what you meant by saying to access the event system and how to go about that. Also I don't know if this happened with yours but the player clones weren't spawning in the level initializer game object but instead inside of my configuration manager. Maybe I messed up somewhere else along the line, but like you I've spent many hours making sure I did everything correct, even downloading the github repo.

  • @derkillerfelix1
    @derkillerfelix1 4 роки тому +1

    Hey the tutorial helped me a lot, but I got a question for you: Lets say you have a main menu where you setup the players like in the video. Then you enter the game and play a bit and then return from the GameScene to the main menu. Is there any good solution to make the players able to re-change their color (and make it able so another Device can also be connected while being in the main menu the 2nd time)? The problem I am having is that I cant really spawn the same PlayerSetupMenu's the players used the first time they were in the main menu, since they only get created if a new player connects to the InputSystem. Any ideas for a good solution?

    • @brokenknightsgames7966
      @brokenknightsgames7966  4 роки тому

      You might be able to accomplish what you are describing by making the level load additively so the UI scene is still alive along side the level, then you can add logic to handle displaying the UI or the level scene.

    • @derkillerfelix1
      @derkillerfelix1 4 роки тому

      @@brokenknightsgames7966 Thank you for the answer. I will take a look at that.

    • @Jooseephh
      @Jooseephh 4 роки тому

      its late but the way i personally would do it is to create a load function on the playermanager to loop through the configs and spawn the objects
      then i would run this function whenever a duplicate of the playermanager is detected (so when you return to the menu this would happen)
      you can just run the function right before you delete the duplicate, but make sure you run it on the actual static instance of the singleton and not on the duplicate one
      if you want to be extra safe you could nest an extra if statement to also check the scene that youre currently in so that it can only happen in the menu
      this method just works for me because the awake of the playermanager wont run when changing scenes, but the awake of the duplicate one will

  • @Beaumerang128
    @Beaumerang128 4 роки тому +5

    Exactly what I needed, except I have 1 issue. no matter what I try Unity does not recognize playerIndex which is a fairly key ingredient to making this all work.
    does anyone else have this problem or know how to fix it?
    the error i get reads:
    PlayerInput does not contain a definition for playerIndex.

    • @twopieces8154
      @twopieces8154 4 роки тому +3

      Is have the same problem, helppp

    • @jojolp01
      @jojolp01 4 роки тому

      Me too

    • @jojolp01
      @jojolp01 4 роки тому

      I solved the problem in my project i haven't inport all sample.
      Now i have import all sample and the except have disaper

  • @CarnivorousSuperIntendent
    @CarnivorousSuperIntendent 2 роки тому

    i know this video is a little over 2 years old but, can you possibly do a tournament fighter tutorial with auto combo feature with unity's new input system.? unity barely has tutorials on UA-cam for just a tournament fighter let alone a good auto combo input system and the majority of those tutorials if not all of them use the old input system. if you decide to do this tutorial series can you show us how to set up single player, local multiplayer and online multiplayer ?

  • @ThiefManRS
    @ThiefManRS 3 роки тому

    how can i get a list of my controllers and assign them to the right player input?

  • @PPLorux
    @PPLorux 4 роки тому

    Got no problem for the first part, however, for the second part, around 43:00, when you remade the PlayerSetupMenuPrefab, some stuffs broke.
    I tried remaking it and linking everything, but unfortunately I cannot control the movement on the buttons.
    I get a "ArgumentException: method arguments are incompatible System.Delegate.CreateDelegate".
    I think it might have something to do with the event system but I'm not sure what.
    If you have any clue I would appreciate it. Thanks!
    EDIT : Fixed my mistake by accident!?
    First, the colors of the button were set at the wrong place (on the Image component instead of the Button component).
    Second, I did try to mess around with everything, relinking stuffs etc and now it works... don't ask me how.
    If you have the same kind of issues, I suggest you look at the github and try replacing some of your prefabs with the prefabs from the github.

  • @foundtexas5424
    @foundtexas5424 3 роки тому

    Dude this is very cool ! I was just wandering if there is a way of unlog players in case of a game over.? I was thought about destroying or clearing the player configs which kind of works but if there is a better wat it would be great :D

  • @AetherXIV
    @AetherXIV 4 роки тому

    Thank you for making one of the few videos on this topic!
    Q: My menus are spawned for both controllers in the hierarchy, but I can't see the 2nd Player's menu. Did anyone else have this problem?

    • @AetherXIV
      @AetherXIV 4 роки тому

      Fixed it! my "Rect Transform" on my "PlayerSetupMenu" was the size of my display. Lowered the numbers and now both are visible, though the text is crunched bad. I'll work on that.

  • @lapesi
    @lapesi 4 роки тому +1

    well done! :thumbsup:

  • @chriswooten8032
    @chriswooten8032 4 роки тому

    Great Videos. I am getting a NullReferenceException: Object reference not set to an instance of an object PlayerInputHandler.Awake () (at Assets/Scripts/PlayerInputHandler.cs:20)
    I am trying to compare file and they do not look the same as the first video. What changes did you make to get the code to work?

    • @brokenknightsgames7966
      @brokenknightsgames7966  4 роки тому +1

      Hi I am assuming you are comparing to the completed solution project. If you look at line 20 in the awake function it's grabbing a mover component from the game object that player input handler is on. If you are getting a null reference exception from that, then your game object doesn't have the mover component attached to it.

  • @PPLorux
    @PPLorux 4 роки тому

    Awesome! Thank you!

  • @maxsaylor9333
    @maxsaylor9333 Рік тому

    thanks for the amazing video!!!
    How to do the same with ToolkitUI?

  • @thomaseduardo7653
    @thomaseduardo7653 4 роки тому

    Hi, thanks a lot, that helped me a lot!
    Could you help me with a one more thing? Anywere i click with the mouse, it automaticly recognize as a palyer and set it to the player list. How can i set the mouse to be one with the keyboard?

  • @finalflash1359
    @finalflash1359 2 роки тому +1

    hey so in the tutorial when you click play and add the players in the panels stand side by side how do you do that? because mine overlap over each other

  • @ultumbrothers7541
    @ultumbrothers7541 Рік тому

    This guy's literally tobey maquire >:D

  • @Leon-wv4dn
    @Leon-wv4dn 3 роки тому +1

    Do you have any tips on how to learn scripting in the same grade as you? Like how did you learn to get that good?

    • @brokenknightsgames7966
      @brokenknightsgames7966  3 роки тому +2

      I have a degree in computer science and I am a software engineer by trade, so I write code on a daily basis, it takes lots of practice but I think lots of people can do it too. Things that help; break the problem down into small simple steps, google all the things, and keep on trying even when you are struggling with getting something to work. Once you can break through a problem you will become a better programmer and harder goals won't seem as insurmountable.

    • @Leon-wv4dn
      @Leon-wv4dn 3 роки тому +2

      @@brokenknightsgames7966 Thanks! I just started with c# and have been doing lua. And since I’m only 14 years old this language seemed so hard. But I am learning slowly!

    • @brokenknightsgames7966
      @brokenknightsgames7966  3 роки тому +2

      Keep at it and don't give up, making games in unity and c# is a great way to learn the fundamentals.

    • @Leon-wv4dn
      @Leon-wv4dn 3 роки тому

      @@brokenknightsgames7966 yeah thanks!

  • @ludvigstrom
    @ludvigstrom 3 роки тому

    Great tutorial but I get an error after following it. "There are 2 event systems in the scene. Please ensure there is always exactly one event system in the scene". Is that not the point with multiplayer eventsystem that you can have more than one? You need one for each menu right?

    • @ludvigstrom
      @ludvigstrom 3 роки тому

      Samething in your completed sample scene on github. Running it in Unity 2020.2.1f1

    • @brokenknightsgames7966
      @brokenknightsgames7966  3 роки тому

      Sounds like there was a change in unity 2020 and/or the input system package since this video was made. This sample was originally created in unity 2019.x .

    • @ludvigstrom
      @ludvigstrom 3 роки тому

      @@brokenknightsgames7966 I reported this problem to Unity and it was indeed a bug. It should be fixed in the upcoming releases.

  • @NickHazrd
    @NickHazrd 3 роки тому

    Get an ArgumentOutOfRangeException: Index was out of range error when I press the ready option. Any help would be appreciated!

    • @NickHazrd
      @NickHazrd 3 роки тому

      Found that I changed the PlayerMenuSetupController to reference a null (missing or empty) value.

    • @nullCode_g
      @nullCode_g Рік тому

      @@NickHazrd ​ can you show yours code or explain more , i have same problem and i dont get how to solve it

  • @maestradebobobo767
    @maestradebobobo767 3 роки тому

    Is it normal that my controller controls all players?

  • @nagybalint1474
    @nagybalint1474 3 роки тому

    I got very confused in the movement part I already have a player movement that works with both keyboard and mouse and with 2 local players but you just not really show it so I'm stuck EDIT: I figured out most of it but for some reason i have 2 multiplayereventsystems from the UI and that messes up everything

  • @backflipbro790
    @backflipbro790 2 роки тому

    How do I make the player choose a character (fighting game) in the startup menu with specialized attacks instead of just choosing color?
    Essentially:
    1. Should I just modify the PlayerConfigurationManager class to have different attacks as methods? If so, how can I distinguish between the characters they're choosing?
    2. How do I modify the menu to have one screen that both players pick from for their characters?
    Thanks if anyone helps

    • @izandevega8195
      @izandevega8195 Рік тому

      I have an scriptable object player with references to each attack that character has, in select screen i assign the character to the player and it kinda works. The characacter scriptable object is referenced in playerConfigurationManager.

  • @CellarPhantom
    @CellarPhantom 4 роки тому

    Is there some standard you are following when using capital first letter on variables or no? I don't see the pattern, maybe someone could help?

    • @brokenknightsgames7966
      @brokenknightsgames7966  4 роки тому +1

      Nope.. I think you most likely found something unintentional on my part. I generally follow the convention of any private members, variables, or functions will start with a lowercase letter and anything public will start with an uppercase.

  • @hanavargas666
    @hanavargas666 3 роки тому

    Thank you so much

  • @Victornemeth
    @Victornemeth 4 роки тому

    Thank you!

  • @watercat1248
    @watercat1248 3 роки тому

    Same time i will try to add the new input system company with the old input system

  • @BramOuwerkerk
    @BramOuwerkerk 2 роки тому

    Legend

  • @Jimaniki
    @Jimaniki 4 роки тому

    Thank you

  • @Lowskii
    @Lowskii 3 роки тому

    When u make this for 4 players it would be nice if the 3th and 4th PlayerSetupMenu would spawn below the first and 2nd. Anyone knows how to to this because they all spawn on a horizontal line now

    • @Delvarn
      @Delvarn 2 роки тому

      You can use different layout groups. I think you can use a generic 'canvas layout group' and decide whether to split vertically or horizontally.

  • @nagybalint1474
    @nagybalint1474 3 роки тому

    thanks :D

  • @Edgar-tn1dx
    @Edgar-tn1dx 2 роки тому

    Thanks to the update of the unity package this tutorial won't work with the 1.0.3 and upper versions of the input package.
    I've figured out why and here is how to deal with the latest update :
    - Modify the SpawnPlayerSetupMenu script to look like this :
    public class SpawnPlayerSetupMenu : MonoBehaviour
    {
    public GameObject playerSetupMenuPrefab;
    public PlayerInput input;
    private InputSystemUIInputModule module = null;
    private void Awake()
    {
    var rootMenu = GameObject.Find("MainLayout");
    if (rootMenu != null)
    {
    var menu = Instantiate(playerSetupMenuPrefab, rootMenu.transform);
    module = menu.GetComponentInChildren();
    input.uiInputModule = module;
    menu.GetComponent().SetPlayerIndex(input.playerIndex);
    }
    }
    public IEnumerator WillResetModule()
    {
    yield return new WaitForSeconds(0.25f);
    StartCoroutine("ResetModule");
    }
    public IEnumerator ResetModule()
    {
    module.enabled = false;
    yield return new WaitForSeconds(0.25f);
    module.enabled = true;
    }
    }
    - Change the HandlePlayerJoin fonction in the PlayerConfigurationManager to this :
    public void HandlePlayerJoin(PlayerInput pi)
    {
    Debug.Log("Player " + pi.playerIndex + " joined");
    if (!playerConfigs.Any(p => p.PlayerIndex == pi.playerIndex))
    {
    pi.transform.SetParent(transform);
    playerConfigs.Add(new PlayerConfiguration(pi));
    foreach(SpawnPlayerSetupMenu menu in FindObjectsOfType())
    {
    menu.StartCoroutine("WillResetModule");
    }
    }
    }
    That worked for me and I hope it will help some of you here

    • @friesarecool4777
      @friesarecool4777 Рік тому

      what namespaces are you using here?

    • @friesarecool4777
      @friesarecool4777 Рік тому

      i have an error with the SetPlayerIndex and i do not know if this is a missing variable or a namespace issue

    • @Edgar-tn1dx
      @Edgar-tn1dx Рік тому

      @@friesarecool4777 I just followed the tutorial but I added a reset on the module :
      public IEnumerator ResetModule()
      {
      module.enabled = false;
      yield return new WaitForSeconds(0.25f);
      module.enabled = true;
      }
      Because unity decided to desactivate it when another joined so I just did it manually and put it on again after
      It is not a great solution but it is the best I could fine to keep these scripts after the MAJ

  • @minhmang3372
    @minhmang3372 3 роки тому

    very complicated for me (new to unity)