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

preview_player
Показать описание

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.

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:

► Music Credit: LAKEY INSPIRED
Track Name: "Better Days"
License for commercial use: Creative Commons Attribution 3.0 Unported "Share Alike" (CC BY-SA 3.0) License.
Рекомендации по теме
Комментарии
Автор

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!

tzsjynx
Автор

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.

morskystudio
Автор

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

starskey
Автор

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!

sirpaulmcd
Автор

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.

kuraikage
Автор

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

calvin
Автор

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

gabriellpweb
Автор

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

dp
Автор

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

colorbreakers
Автор

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

sHorz
Автор

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

perryplatypult
Автор

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.

shawnw
Автор

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 !

japandoudou
Автор

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

xanarihstudios
Автор

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

gabrielchammo
Автор

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

petipois
Автор

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

tomasabrams
Автор

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

mikesk
Автор

Thank you, this video was extremely helpful.

Fidfriendly
Автор

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.

JoshuaSonOfOne
join shbcf.ru