In this tutorial we will look at how to make a player skin select and menu and spawn the player into a game with their selected character!

********************************

Discord https://discord.io/divingsquid
Patreon https://www.patreon.com/diving_squid
Play my games! https://diving-squid.itch.io

********************************

If you have any problems, let me know in the comments!

40件のコメント

  1. Pretty late comment, but i have a problem with this tutorial. After trying to build my project, an error appears regarding UnityEditor, and unless i delete it, i wont be able to build the game. Anyone has any ideas?

  2. How do you make like a name and description for each character in the shop
    And how do you sell each character for a price

  3. Only problem is the game doesn't build. This will "break" any attempt to build due to you using a editor function on a gameobject 🙁
    Otherwise, cool thanks!
    Edit: Just make another script and leave it in the editor to call that function that saves the asset. Then use #if UNITY_ANDROID before it and #endif after (on both scripts) to fix the errors and build error.

  4. Very cool, but how do i do different powers for different characters? The idea is that when you click E and your skin is santa he throwes a present. But when you click E and your skin is fire boy you throw a fireball. Please help!

  5. I have this Problem :"A new expression requires (), [], or {} after type" what must i do? heres my Code

    using System.Collections;

    using System.Collections.Generic;

    using UnityEngine;

    using UnityEngine.SceneManagment;

    using UnityEditor;

    public class Character_Selector : MonoBehaviour

    {

    public SpriteRenderer sr;

    public List<Sprite> skins = new List<Sprite>;

    private int selectedSkin = 0;

    public GameObject playerSkin;

    public void NextOption()

    {

    selectedSkin = selectedSkin 1;

    if (SelectedSkin == skins.Count)

    {

    selectedSkin = 0;

    }

    sr.Sprite = skins[SelectedSkin];

    }

    public void BackOption()

    {

    selectedSkin = selectedSkin – 1;

    if (selectedSkin < 0)

    {

    selectedSkin = skins.Count – 1;

    }

    }

    public void PlayGame()

    {

    PrefabUtility.SaveAsPrefabAssets(playerSkin, "Assets/Other Things.Mause");

    SceneManager.LoadScene("Testing");

    }

    }

  6. So if I had already created my game with a singular Player, do I essentially have to remove & rewrite my PlayerController script since I believe I have to delete the Player that already exist? Or can I just add this to my existing PlayerController script and essintially just remove the already existing Mesh Renderer (3D game.)

  7. First of all, great tutorial! But, currently I’m having an issue with the sprites not showing up when I’m in play. I will press the next / back button and nothing will show up in the scene, but I will press pause and the next character will be there. Any solutions or maybe I missed something

  8. you forgot to mention this, but after the "playerskin" prefab is added via playtesting, you have to remove the "PrefabUtility.SaveAsPrefabAsset" line, or else unity starts tweakin when you try to build.

    edit: ok does anyone have a fix that doesnt require me to have an identical list for every player sprite

  9. Thanks for the tutorial, sadly in the last few lines of the skinmanager. You said "PrefabUtility.SaveAsPrefabAsset", but you can't use prefabutility in a build. Could you make another tutorial about a character selection menu without using prefabs?

  10. This tutorial is really great until you want to build your project into an actual game, since everithing that needs the line "using UnityEditor" at the beginning of the code only works in the editor, and will drop an error when building the project.

  11. when I start my game, i have to reset my game scene first, (in my game, there are spikes so i just touched one of them and it resets the scene) then it loads the correct character. is it the current editor that i'm using is in the wrong date or did i just miss something in the video. if so, can someone tell me how to fix this?

  12. Pardon me; but I believe your solution won't actually work. UnityEditor doesn't unfortunately work in games outside of builds. Although I'm pretty sure you can use an persisted game object with DontDestroyOnLoad called on it to hold the selected sprite for the next scene. The only thing is to add a save system or use player prefs to persist the default skin.

    Good day Diving Squid.

  13. when i try to build it says you cant use "using UnityEditor" so how do i change it to do the same thing as before but so i can build it

  14. Great tutorial, one question tho: How can I now animate the characters since all of their sprites are in the same gameObject?

Leave A Reply