Unity Character Customization - Steam Multiplayer Game in Unity

Поделиться
HTML-код
  • Опубликовано: 22 май 2024
  • Check out the Unity SPRING SALE!!!
    assetstore.unity.com/?on_sale...
    assetstore.unity.com/?flashde...
    Source Code: / 65189989
    In this video I will be showing you how to implement character customization . I will go over how to get the initial UI and system working. And also how to load this into the game and get it synced across the network.
    ----Tutorial Links----
    Previous Video: • How To Make a Steamwor...
    Steam Docs: partner.steamgames.com/doc/home
    ----My Personal Links----
    Discord: / discord
    Instagram: / gabzxd
    Twitch: / officialzyger
    Twitter: / zygerdesigns
    -----My Personal Links-----
    Discord: / discord
    Instagram: / gabzxd
    Twitch: / officialzyger
    Twitter: / zygerdesigns
    ➤WISHLIST MY GAME:
    store.steampowered.com/app/16...
    ----Time Stamps-----
    0:00 - Intro
    0:52 - UI and Unity Setup
    1:33 - Customizations Setup
    4:23 - Unity Changes
    5:37 - Syncing Over the Network
    8:32 - Final Unity Changes
    8:54 - Testing
  • РазвлеченияРазвлечения

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

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

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

    Thank you for making these tutorials Zyger it's helped me a ton!

  • @Mathewx1111
    @Mathewx1111 Год назад

    What a helpful tutorial enjoyed it ❤️

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

    Another Banger and the exact thing I needed❤

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

    Another fantastic tutorial. Thanks for the upload!

  • @TripalYT
    @TripalYT 2 года назад +3

    brb, learning how to make a triple A game from these tutorials!

  • @teddy6178
    @teddy6178 Год назад

    Thank you, you’re amazing!

  • @germaincasse
    @germaincasse 2 года назад +1

    Thanks, great tutorial!

  • @cacula28
    @cacula28 2 года назад +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 года назад +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 года назад +1

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

  • @DrNo_
    @DrNo_ 9 месяцев назад

    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!

  • @danharris7735
    @danharris7735 Год назад +6

    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 5 месяцев назад

      It works but I keep getting this error: Command System.Void PlayerObjectController::CmdUpdatePlayerColor(System.Int32) called on PlayerObject without an active client.

  • @fuzzyleon1773
    @fuzzyleon1773 2 года назад +9

    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 Год назад

      Been trying to figure that out myself...

  • @xyoxus
    @xyoxus 2 года назад +3

    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 года назад +1

      I made this playlist so I can find them easily if I need it. But it is public, so you can save it too :)
      ruclips.net/p/PLmMS--T1mpeGNrVYu9L97fL7ks7yegWHN

  • @Shahmuradov
    @Shahmuradov 2 года назад +1

    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 года назад +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

  • @Shadowkiwi
    @Shadowkiwi 2 года назад +7

    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 года назад +1

      I posted a comment that should help you out.

    • @Shadowkiwi
      @Shadowkiwi Год назад

      @@WolfServant Posted a comment where? I don't see anything else from you in the comments on this video

    • @Shadowkiwi
      @Shadowkiwi Год назад +1

      @@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 Год назад

      @Frosty could you fully explain what you did to solve this?​

    • @brunoayre2234
      @brunoayre2234 Год назад

      @@Shadowkiwi Could you fully explain what you did to solve this?

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

    I have a question, how can one player trigger another player's component. I will be very happy if you answer

  • @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 года назад +1

      yeah i changed it after but forgot to show it hahah. thanks a lot !!

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

    Hey i really like your vids coups you Mauve make a tutorial on how to make a prophunt game?

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

    YEEEESS FINALYYY

  • @NBGTZ
    @NBGTZ Год назад

    The color dont change its stuck on blue even if i change in the lobby its still stuck how can i fix it?

  • @3ABKRENOGAMER
    @3ABKRENOGAMER 2 года назад

    Hello can u PLZ do an tutorial about player health sync ♥

  • @kili8517
    @kili8517 Год назад

    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  Год назад

      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.

  • @YoNatrix
    @YoNatrix Год назад

    how to make backbutton in lobby?

  • @notanagger4861
    @notanagger4861 11 месяцев назад

    How would one go about creating a leave function to leave the lobby?

    • @ZygerGFX
      @ZygerGFX  11 месяцев назад

      there are different ways but I posted a solution in my discord server

  • @erenbatu1009
    @erenbatu1009 7 месяцев назад +1

    hi how do I add the libraries: Steamworks and Mirror

  • @mylogic156
    @mylogic156 Год назад

    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 Год назад

      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 Год назад

      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!

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

    Zyger still play indie games?

  • @mdcdev_
    @mdcdev_ 6 месяцев назад

    do you need to purchace anything to test these

    • @ZygerGFX
      @ZygerGFX  6 месяцев назад

      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_ 5 месяцев назад

      thank you@@ZygerGFX

  • @mrpoint1013
    @mrpoint1013 7 месяцев назад

    player select pls)

  • @aonalt
    @aonalt Год назад

    When new tutorial?

    • @ZygerGFX
      @ZygerGFX  Год назад

      Soon just working on some atm

    • @aonalt
      @aonalt Год назад

      @@ZygerGFX What will it cover?

  • @nullnull5371
    @nullnull5371 Год назад

    我的颜色为什么设置不上,up能修复这个bug吗? 这对我很重要! 谢谢。 你这个善良美丽的女人。

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

    First!

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

    Second!

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

    First comment!