Unity Character Customization - Steam Multiplayer Game in Unity

  Рет қаралды 27,616

Zyger

Zyger

Күн бұрын

Пікірлер: 69
@TripalYT
@TripalYT 2 жыл бұрын
brb, learning how to make a triple A game from these tutorials!
@ZygerGFX
@ZygerGFX 2 жыл бұрын
😂
@nile64
@nile64 2 жыл бұрын
just found your channel 30 minutes ago and it has this steam multiplayer series AND a save and load level system? thanks for these tutorials, ill really need them for my game!
@cacula28
@cacula28 2 жыл бұрын
Hey, nice video, I dont know much about unity or c#, but I think a nice feature to add if you press on the next color arrow and its the end of the color ( a.length ) it will go back to the first color so it will still switch colors and wont stuck. =)
@ZygerGFX
@ZygerGFX 2 жыл бұрын
Yeah that's definitely what I would do if I continued the project. For the video I didnt bother adding it but definitely a great idea.
@yll1b596
@yll1b596 2 жыл бұрын
Seems like a fairly simple fix by just checking which button you hit and if the current index is at the end, set it to the start value
@Shahmuradov
@Shahmuradov 2 жыл бұрын
You can edit your script to this for that functionality :) using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using Steamworks; using Mirror; public class CharacterCosmeticsController : MonoBehaviour { public int currentColorIndex = 0; public Material[] playerColors; public Image currentColorImage; public Text currentColorText; private static string CURRENT_COLOR_INDEX = "currentColorIndex"; private void Start() { currentColorIndex = PlayerPrefs.GetInt(CURRENT_COLOR_INDEX, 0); UpdateNewColorUI(); } public void NextColor() { if (currentColorIndex < playerColors.Length - 1) { currentColorIndex++; PlayerPrefs.SetInt(CURRENT_COLOR_INDEX, currentColorIndex); UpdateNewColorUI(); } else if (currentColorIndex == playerColors.Length - 1) { currentColorIndex = 0; PlayerPrefs.SetInt(CURRENT_COLOR_INDEX, currentColorIndex); UpdateNewColorUI(); } } public void PreviousColor() { if (currentColorIndex > 0) { currentColorIndex--; PlayerPrefs.SetInt(CURRENT_COLOR_INDEX, currentColorIndex); UpdateNewColorUI(); } else if (currentColorIndex == 0) { currentColorIndex = playerColors.Length - 1; PlayerPrefs.SetInt(CURRENT_COLOR_INDEX, currentColorIndex); UpdateNewColorUI(); } } private void UpdateNewColorUI() { currentColorImage.color = playerColors[currentColorIndex].color; currentColorText.text = playerColors[currentColorIndex].name; } }
@danharris7735
@danharris7735 Жыл бұрын
If you are having trouble with the colours not updating, it's because the CmdUpdatePlayerColor function is never called. To resolve this, you need to reference the LobbyController Instance (specific to the player), call the cmd function and input the index number from the lobby via the use of: LobbyController.Instance.LocalplayerController.CmdSendPlayerColor(index); This is my version of the CharacterCosmetics.cs class, I've used TMPro instead of the UI component as the old text features are now not recommended in later Unity versions. I also removed the 'PlayerPrefs.GetInt("currentColourIndex", 0);' in the start function, as it would cache previous choices which I didn't want to implement in my interpretation. Wrapping was also added so when you reach the last colour, it loops back to the first! ---------------------------- using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using TMPro; using Steamworks; using Mirror; public class CharacterCosmetics : MonoBehaviour { public int currentColorIndex = 0; public Material[] playerColors; public Image currentColorImage; public TextMeshProUGUI currentColorText; private void Start() { // Generate new Steamworks variable, and set to 0 if not already created // currentColourIndex = PlayerPrefs.GetInt("currentColourIndex", 0); SetColor(currentColorIndex); } private void SetColor(int index) { PlayerPrefs.SetInt("currentColourIndex", currentColorIndex); currentColorImage.color = playerColors[currentColorIndex].color; currentColorText.text = playerColors[currentColorIndex].name; LobbyController.Instance.LocalplayerController.CmdSendPlayerColor(index); } public void NextColor() { if (currentColorIndex < playerColors.Length - 1) // Increment currentColorIndex++; else if (currentColorIndex == playerColors.Length - 1) // Wrap currentColorIndex = 0; SetColor(currentColorIndex); } public void PreviousColor() { if (currentColorIndex > 0) // Decrement currentColorIndex--; else if (currentColorIndex == 0) // Wrap currentColorIndex = playerColors.Length - 1; SetColor(currentColorIndex); } }
@kcdahnert
@kcdahnert Жыл бұрын
HI. I too do not get the chosen colors applied. I replaced your code into CharacterCosmetics.cs but then got this below error. Are there some other code changes to other scripts? : error CS1061: 'PlayerObjectController' does not contain a definition for 'CmdSendPlayerColor' and no accessible extension method 'CmdSendPlayerColor' accepting a first argument of type 'PlayerObjectController' could be found (are you missing a using directive or an assembly reference?). Thanks!
@XathosLP
@XathosLP Жыл бұрын
@@kcdahnert It's because you cmd is called 'CmdUpdatePlayerColor', not 'CmdSendPlayerColor' (if you strictly followed Zyger's tutorial :) )
@grambino8622
@grambino8622 10 ай бұрын
It works but I keep getting this error: Command System.Void PlayerObjectController::CmdUpdatePlayerColor(System.Int32) called on PlayerObject without an active client.
@xyoxus
@xyoxus 2 жыл бұрын
You should set the Steam Mulitplayer Tutorial playlist to automatically sort from oldest to newest, it currently is all over the place and will always happen again if you don't set the sorting of it.
@Shahmuradov
@Shahmuradov 2 жыл бұрын
I made this playlist so I can find them easily if I need it. But it is public, so you can save it too :) kzbin.info/aero/PLmMS--T1mpeGNrVYu9L97fL7ks7yegWHN
@WolfServant
@WolfServant 2 жыл бұрын
Thank you for making these tutorials Zyger it's helped me a ton!
@faiazbinnesar2937
@faiazbinnesar2937 2 жыл бұрын
Another Banger and the exact thing I needed❤
@EntikaiCG
@EntikaiCG 2 жыл бұрын
Another fantastic tutorial. Thanks for the upload!
@ZygerGFX
@ZygerGFX 2 жыл бұрын
thank you
@germaincasse
@germaincasse 2 жыл бұрын
Thanks, great tutorial!
@ZygerGFX
@ZygerGFX 2 жыл бұрын
Thanks !
@Xian_NoTTV
@Xian_NoTTV Жыл бұрын
Awesome tutorial serie, really helpful and straight forward. It might be awesome if you could create a tutorial for making a two teams game. I can't figure out how to modify your script to make the networkmanager split players into different teams. I tried by myself and even asked to ChatGPT but it's the same; a bunch of errors or the script isn't working as intended. When I managed to make it work, the original GamePlayer is still spawning and isn't controlled by anyone in the middle of the scene. Thanks a lot for this tutorials btw taught me a lot about NetworkBehaviour and how to manage a multiplayer lobby!
@teddy6178
@teddy6178 2 жыл бұрын
Thank you, you’re amazing!
@yaaannn8126
@yaaannn8126 2 жыл бұрын
YEEEESS FINALYYY
@Bloopblop1
@Bloopblop1 2 жыл бұрын
What a helpful tutorial enjoyed it ❤️
@Shadowkiwi
@Shadowkiwi 2 жыл бұрын
For some reason the color is never set, it just uses the color in the 0 value. I downloaded the source files and ran that project and it also does not work there. I think the issue is that "CmdUpdatePlayerColor(int newValue)" does not appear to ever be called but not sure where to put that.
@WolfServant
@WolfServant 2 жыл бұрын
I posted a comment that should help you out.
@Shadowkiwi
@Shadowkiwi 2 жыл бұрын
@@WolfServant Posted a comment where? I don't see anything else from you in the comments on this video
@Shadowkiwi
@Shadowkiwi 2 жыл бұрын
@@WolfServant Nevermind I got it working. I added the FindLocalPlayer method and varibales from the lobbycontroller script into the CosmeticController and added a line to call the command from the playerobject controller: LocalplayerController.CmdUpdatePlayerColor(currentColorIndex);
@brunoayre2234
@brunoayre2234 2 жыл бұрын
@Frosty could you fully explain what you did to solve this?​
@brunoayre2234
@brunoayre2234 2 жыл бұрын
@@Shadowkiwi Could you fully explain what you did to solve this?
@madpingui5007
@madpingui5007 2 жыл бұрын
1:35 UsingEngine.UI Steamworks ... And finally using Mirror Proceeds to use Microsoft instead hahahah Nice video btw, I think multiplayer is something that is not taught much, thanks.
@ZygerGFX
@ZygerGFX 2 жыл бұрын
yeah i changed it after but forgot to show it hahah. thanks a lot !!
@fuzzyleon1773
@fuzzyleon1773 2 жыл бұрын
Hey Zyger, I'm a 3D modeller who's trying to make a game on his own. I can't code a bit but thanks to you I've already got multiplayer running. I tried adding a "leave lobby" and "leave game" button myself, but it's still to much for me. Especially the fact that if the host leaves that you need A. Host migration or B. force quit everyone back to main menu. I'm also thinking of just stopping the game and returning everyone to lobby when one player leaves, since it's a 1vs4 game. But could you perhaps make a tutorial about that? A leave lobby and leave game button? I've been searching and asking people for 5 days now but no one seems to be able to help me :(
@dekirudev
@dekirudev 2 жыл бұрын
Been trying to figure that out myself...
@Shahmuradov
@Shahmuradov 2 жыл бұрын
Nice tutorial! But I have a question. In CharacterCosmeticsController we added Steamworks and Mirror libraries, but never used it. Will we be using it in the next tutorials? Because right now they seem unnecessary and I want to remove them from top of my script :D
@ZygerGFX
@ZygerGFX 2 жыл бұрын
Yeah no remove them there's no need for them. i think i kept that in because originally I was going to do something but then edited it out.
@sajadtroll9186
@sajadtroll9186 2 жыл бұрын
amazing
@3ABKRENOGAMER
@3ABKRENOGAMER 2 жыл бұрын
Hello can u PLZ do an tutorial about player health sync ♥
@not_vdb0059
@not_vdb0059 2 жыл бұрын
Hey i really like your vids coups you Mauve make a tutorial on how to make a prophunt game?
@erenbatu1009
@erenbatu1009 Жыл бұрын
hi how do I add the libraries: Steamworks and Mirror
@SantaGamerYoutube
@SantaGamerYoutube Жыл бұрын
google them
@YoNatrix
@YoNatrix Жыл бұрын
how to make backbutton in lobby?
@ozalpm
@ozalpm 2 жыл бұрын
I have a question, how can one player trigger another player's component. I will be very happy if you answer
@notanagger4861
@notanagger4861 Жыл бұрын
How would one go about creating a leave function to leave the lobby?
@ZygerGFX
@ZygerGFX Жыл бұрын
there are different ways but I posted a solution in my discord server
@NBGTZ
@NBGTZ 2 жыл бұрын
The color dont change its stuck on blue even if i change in the lobby its still stuck how can i fix it?
@kili8517
@kili8517 2 жыл бұрын
Hey Zyger, I tried to make that if one player picked a color, others player can't pick it. But I can't make it work? How can I do this?
@ZygerGFX
@ZygerGFX 2 жыл бұрын
You would have to keep track of what color someone picked, probably like an I'd for each color index. That data would need to be sent to every user so I'd probably send the data when somebody locks in a color. I'd then just make it so that if a player clicks on a color and its index is on that list it doesn't let them pick it. Of course you can make it looks more polished with a visual indication or something. It shouldn't be too difficult and there's multiple ways to go about it but the one I proposed here should be quite straight forward.
@lofiscide
@lofiscide 2 жыл бұрын
Zyger still play indie games?
@aonalt
@aonalt 2 жыл бұрын
When new tutorial?
@ZygerGFX
@ZygerGFX 2 жыл бұрын
Soon just working on some atm
@aonalt
@aonalt 2 жыл бұрын
@@ZygerGFX What will it cover?
@mrpoint1013
@mrpoint1013 Жыл бұрын
player select pls)
@minecraftcompilationz
@minecraftcompilationz 2 жыл бұрын
Second!
@mdcdev_
@mdcdev_ 11 ай бұрын
do you need to purchace anything to test these
@ZygerGFX
@ZygerGFX 11 ай бұрын
no you dont. You just need to install steam which is free. Bare in mind though if you do actually plan to release your game, purchasing a steam application would be wise, but still not 100% necessary.
@mdcdev_
@mdcdev_ 11 ай бұрын
thank you@@ZygerGFX
@RubikMaster13
@RubikMaster13 2 жыл бұрын
First!
@mylogic156
@mylogic156 2 жыл бұрын
i cant find where were syncing the player color int for the life of me, if anyone knows please help edit; i know that its a syncvar but where are we making it equal to the Character select's current color index?
@mylogic156
@mylogic156 2 жыл бұрын
found it, i added playerMat = PlayerPrefs.GetInt("currentMatIndex", 0); to the update method now both players are the same color when im scrolling through the list tho, progress
@mylogic156
@mylogic156 2 жыл бұрын
Got it! i called the CommandUpdatePlayerColor(); in the update method, then i passed in the colorIndex from the CharacterCosmeticsScript, so CommandUpdatePlayerColor(characterCosmetics.colorIndex); this seemed to fix my problem, though, it will be updating the color every frame so i recomend making an if statment to check if ur out of the character customization screen, and then disabling it if u are also discard my previous comment about the PlayerPrefs in the update method, doesnt work Hope i Helped Someone out!
@splashguy
@splashguy 2 жыл бұрын
First comment!
@nullnull5371
@nullnull5371 2 жыл бұрын
我的颜色为什么设置不上,up能修复这个bug吗? 这对我很重要! 谢谢。 你这个善良美丽的女人。
Making MULTIPLAYER Games has never been EASIER!
12:49
Code Monkey
Рет қаралды 83 М.
小丑揭穿坏人的阴谋 #小丑 #天使 #shorts
00:35
好人小丑
Рет қаралды 41 МЛН
У вас там какие таланты ?😂
00:19
Карина Хафизова
Рет қаралды 20 МЛН
Elza love to eat chiken🍗⚡ #dog #pets
00:17
ElzaDog
Рет қаралды 21 МЛН
This dad wins Halloween! 🎃💀
01:00
Justin Flom
Рет қаралды 63 МЛН
Гайд по Mirror мультиплееру в Unity 2д
18:29
How I Became a Sea of Thieves Developer
8:05
Zyger
Рет қаралды 272 М.
How To Connect Using Steam - Unity Multiplayer Tutorial
21:44
Dapper Dino
Рет қаралды 92 М.
How To Make A Steam Multiplayer Game with Netcode (MLAPI)
29:40
I Made a Graphics Engine in Scratch
8:27
Zyger
Рет қаралды 186 М.
Why Making Multiplayer Games SUCKS
6:46
Tom Weiland
Рет қаралды 430 М.
Make YOUR OWN Multiplayer FPS (2023 - Unity, Photon PUN 2)
16:15
Mia Boyka х Карен Акопян | ЧТО БЫЛО ДАЛЬШЕ?
1:21:14
Что было дальше?
Рет қаралды 9 МЛН
Он Отлично Справляется ❤️
0:18
Глеб Рандалайнен
Рет қаралды 8 МЛН
Sefari's Transformation  #sekoraandsefariplay
0:20
Sekora and Sefari Play
Рет қаралды 35 МЛН
Sefari's Transformation  #sekoraandsefariplay
0:20
Sekora and Sefari Play
Рет қаралды 35 МЛН