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件のコメント
Tutorial is great, but there is one issue I guess. You cannot build your game using UnityEditor library
This is a good start for character selection. Thank mate!
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?
This makes me really question my game development skills.
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
I have an error with the "using UnityEditor;" at the time to build
Can this be used in multiplayer?
can you show how to do this but using bolt and sprite animation. Can't Figure it out.
BRO you brok my project man
Great work, thank you!
I'd love to see a 3D version of this. Guessing instead of Sprite, we would use Mesh…?
Nice nice , I will keep it, 🙋 that's what I am looking for..
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.
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!
can u make like u need to buy the skins with score's please
can som1 help me ? i somehow do not have the "spriteRender Functions"
Great tutorial!
But how can you make the camera follow the selected character in the game scene?
Your voice is very soothing and you made a clear tutorial
really nice video😄. You really help me.
THAK YOU SO MUCH
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");
}
}
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.)
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
you cant build the final project while using the unity editor in the script
Hello could you help me with implementing UMA and photon?
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
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?
thank you
no me salió 🙁
3:57 up to
if I try to build my game i get an error
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.
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?
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.
Does those scripts work in unity 3d ?
at the end the player doesnt work
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
What if i am using a follow camera for a game object so do each of my character need different cameras?
What's the app you are using to draw/make these buttons and characters?
Quick question, how would this work with sprites you have animated?
Great tutorial, one question tho: How can I now animate the characters since all of their sprites are in the same gameObject?