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

  Рет қаралды 37,369

Broken Knights Games

Broken Knights Games

4 жыл бұрын

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/Srfigie/Unity_NewI...
Github Sample Start Link: github.com/Srfigie/Unity_NewI...
Github Completed Sample Link: github.com/Srfigie/Unity_NewI...
Official Documentation Link: docs.unity3d.com/Packages/com...
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.

Пікірлер: 148
@colorbreakers2383
@colorbreakers2383 4 жыл бұрын
Awesome video as always! I love that you make videos about topics that almost no one else talks about. Keep up the good work!
@sirpaulmcd
@sirpaulmcd 4 жыл бұрын
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 жыл бұрын
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
@dp825
@dp825 2 жыл бұрын
This is an absolute Life-Saver! Wonderful Tutorial! I hope you come back and make more Vids!
@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 !
@kuraikage15
@kuraikage15 4 жыл бұрын
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.
@perryplatypult9287
@perryplatypult9287 3 жыл бұрын
WOW you are such a small channel with great content especially around the new input system!
@xanarihstudios2997
@xanarihstudios2997 3 жыл бұрын
Really good tutorial man, its so thorough and I cant wait to finish implementing it :D
@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
@tehanperera4
@tehanperera4 3 жыл бұрын
I've literally found the exact thing I've been looking for, Thanks!
@sHorz
@sHorz 4 жыл бұрын
Great content, so good to have someone to look for when i'm lost Appreciate u
@morskystudio3973
@morskystudio3973 3 жыл бұрын
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.
@tamerxero
@tamerxero 3 жыл бұрын
Thanks, mate! Great tutorial that makes for a super modular system! Using this in my aetherpunk rpg, thanks again!
@rafaelharana1494
@rafaelharana1494 4 жыл бұрын
Great tutorial, will sure help me with my project. Thanks for such effort even with few views (by now)!
@tzsjynx
@tzsjynx 4 жыл бұрын
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 !
@gabriellpweb
@gabriellpweb 9 ай бұрын
This is one if not the one best tutorial about local multiplayer coop input setup. Pitty you didn't make anymore videos
@tomasabrams7234
@tomasabrams7234 3 жыл бұрын
Aye I was the 700th subscriber lol, thanks for the tutorial!! Very Helpful!
@adamkarolin
@adamkarolin 4 жыл бұрын
Really high quality content, thx ;)
@mr.kofeek
@mr.kofeek Жыл бұрын
Thank you for your tutorial! It's not what I exactly needed, but it is a really good foundation!
@digitalspirit8247
@digitalspirit8247 2 жыл бұрын
Really, really great job ! I've learned a lot thank you :)
@TheDamiano16
@TheDamiano16 3 жыл бұрын
You saved my life! Thank you for this video :)
@vege8222
@vege8222 4 жыл бұрын
This was super helpful. Thank you!
@DaLivelyGhost
@DaLivelyGhost 3 жыл бұрын
Incredible tutorial. Learned a lot.
@tacoconsalsa4078
@tacoconsalsa4078 4 жыл бұрын
Man, you just nailed it
@yeeteronipizza
@yeeteronipizza 3 жыл бұрын
Super helpful, thanks so much my dood
@Fidfriendly7106
@Fidfriendly7106 Жыл бұрын
Thank you, this video was extremely helpful.
@bome99
@bome99 2 жыл бұрын
Great tutorial! Still hold up even with the new updates
@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 8 ай бұрын
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.
@TheMrSnipey
@TheMrSnipey 2 жыл бұрын
Excellent tutorial. Thanks.
@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 3 жыл бұрын
@@twopieces8154 Where in the code is this?
@xvalue
@xvalue 3 жыл бұрын
*subscribed* Great work on this.
@PPLorux
@PPLorux 4 жыл бұрын
Awesome! Thank you!
@vincent666skate
@vincent666skate 3 жыл бұрын
I am in 10 min and i so like this tuto ! :D
@calvin8950
@calvin8950 3 жыл бұрын
@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
@lapesi
@lapesi 4 жыл бұрын
well done! :thumbsup:
@JoshuaSonOfOne
@JoshuaSonOfOne 4 жыл бұрын
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.
@brokenknightsgames7966
@brokenknightsgames7966 4 жыл бұрын
Great idea! I'll keep that in mind, thanks for the suggestion 👍
@erosjagatpulagana6403
@erosjagatpulagana6403 3 жыл бұрын
hidden gem indeed
@Victornemeth
@Victornemeth 3 жыл бұрын
Thank you!
@hanavargas666
@hanavargas666 3 жыл бұрын
Thank you so much
@Jimaniki
@Jimaniki 4 жыл бұрын
Thank you
@BramOuwerkerk
@BramOuwerkerk Жыл бұрын
Legend
@shawnw86
@shawnw86 3 жыл бұрын
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 3 жыл бұрын
I like the improvements to the approach!
@erosjagatpulagana6403
@erosjagatpulagana6403 3 жыл бұрын
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?
@nagybalint1474
@nagybalint1474 3 жыл бұрын
thanks :D
@qball13z
@qball13z 4 жыл бұрын
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!
@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?
@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
@thomaseduardo7653
@thomaseduardo7653 3 жыл бұрын
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?
@jerms_mcerms9231
@jerms_mcerms9231 2 жыл бұрын
Any thoughts on putting the color select as one menu for both players?
@AetherXIV
@AetherXIV 3 жыл бұрын
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 3 жыл бұрын
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.
@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?
@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.
@Pierre_Dev
@Pierre_Dev Жыл бұрын
how would you make it work in a single Canvas? like a character selection screen? thanks for the help until
@maxsaylor9333
@maxsaylor9333 Жыл бұрын
thanks for the amazing video!!! How to do the same with ToolkitUI?
@braxtonsdev9564
@braxtonsdev9564 7 ай бұрын
Works beautifully if using a Gamepad and a Keyboard; however, if I use 2 keyboards they both read as the same input. Any Advice?
@codyironblood
@codyironblood Жыл бұрын
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 KZfaq 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 ?
@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 жыл бұрын
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.
@Delvarn
@Delvarn Жыл бұрын
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!
@ThiefManRS
@ThiefManRS 3 жыл бұрын
how can i get a list of my controllers and assign them to the right player input?
@johannaavala3189
@johannaavala3189 4 жыл бұрын
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 3 жыл бұрын
How did you add the jump feature?
@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?
@anishpunish
@anishpunish 3 жыл бұрын
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.
@RomekjeG
@RomekjeG 4 ай бұрын
How does leaving work? Disconnect a controller. Or if you joined with a controller for example. being able to leave. And later Join again.
@watercat1248
@watercat1248 3 жыл бұрын
Same time i will try to add the new input system company with the old input system
@derkillerfelix1
@derkillerfelix1 4 жыл бұрын
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
@backflipbro790
@backflipbro790 Жыл бұрын
Is the last tutorial necessary to follow this one? He uses his past movement script but idk
@Steveg2110
@Steveg2110 2 жыл бұрын
Does this account for if ur controller dosconects? And if so where is the part that fixes it?
@budiandraym8451
@budiandraym8451 3 жыл бұрын
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 жыл бұрын
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
@ultumbrothers7541
@ultumbrothers7541 Жыл бұрын
This guy's literally tobey maquire >:D
@gabrielchammo8378
@gabrielchammo8378 4 жыл бұрын
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 3 жыл бұрын
ya, same problem. Did anyone solved?
@wildBcat
@wildBcat 3 жыл бұрын
@@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 3 жыл бұрын
@@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 жыл бұрын
@@wildBcat Thank you so much! Was looking this up everywhere! You sir are amazing!
@chickenfrenzy9096
@chickenfrenzy9096 11 ай бұрын
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 11 ай бұрын
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 10 ай бұрын
​@@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.
@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 жыл бұрын
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.
@Beaumerang128
@Beaumerang128 4 жыл бұрын
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 жыл бұрын
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
@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?
@90Bilu
@90Bilu 10 ай бұрын
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 ?
@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.
@Codezii_games
@Codezii_games Жыл бұрын
@@NickHazrd ​ can you show yours code or explain more , i have same problem and i dont get how to solve it
@Leon-wv4dn
@Leon-wv4dn 3 жыл бұрын
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 жыл бұрын
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 жыл бұрын
@@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 жыл бұрын
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!
@backflipbro790
@backflipbro790 Жыл бұрын
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 10 ай бұрын
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.
@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.
@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 Жыл бұрын
You can use different layout groups. I think you can use a generic 'canvas layout group' and decide whether to split vertically or horizontally.
@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.
@jerms_mcerms9231
@jerms_mcerms9231 2 жыл бұрын
I set a bool to context.action.triggered then check that bool in my update function to decide if now is a good time to jump. Then for jumping and movement I do something like this (pseudo): move(movementInput * speed, veloctiy.y) // first arg is x's movement, second is y's velocity if now is a good time to jump: jump(0, jumpforce) // first arg is x's velocity, second is y's
@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
@nagybalint1474
@nagybalint1474 3 жыл бұрын
9:35
@ianpercy1333
@ianpercy1333 2 жыл бұрын
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 Жыл бұрын
OMG I COULD KISS YOU RIGHT NOW!! HOLY ... THANK YOU!!
@maestradebobobo767
@maestradebobobo767 3 жыл бұрын
Is it normal that my controller controls all players?
@finalflash1359
@finalflash1359 2 жыл бұрын
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
@allenisom3247
@allenisom3247 Жыл бұрын
Having the exact same issue.
@minhmang3372
@minhmang3372 3 жыл бұрын
very complicated for me (new to unity)
@Edgar-tn1dx
@Edgar-tn1dx Жыл бұрын
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
Local Co-op in Unity using the New Input System - Tutorial
19:41
Broken Knights Games
Рет қаралды 44 М.
THEY made a RAINBOW M&M 🤩😳 LeoNata family #shorts
00:49
LeoNata Family
Рет қаралды 37 МЛН
Use Unity's Input System Like a Pro
24:48
Paridot
Рет қаралды 25 М.
Unity's New Input System:  The Definitive Guide
32:07
DmanGames
Рет қаралды 24 М.
Unity's NEW input system in 13 minutes
13:02
BiteMe Games
Рет қаралды 14 М.
Games Where You're NOT the Main Character
14:52
i am a dot.
Рет қаралды 2 МЛН
Local Multiplayer and Split-Screen - New Input and Cinemachine
13:37
One Wheel Studio
Рет қаралды 27 М.
How to use Unity's New INPUT System EASILY
9:32
BMo
Рет қаралды 211 М.
Tierlisting the BEST (and worst) GAME ENGINES
33:51
BiteMe Games
Рет қаралды 204 М.
Local Multiplayer with NEW Input System - Unity Tutorial
15:12
Every Time Minecraft Got a 4th Dimension
15:31
NotVeryAndy
Рет қаралды 446 М.