Search code examples
unity-game-enginecharactergame-physics

How to show/hide a character in unity


I am thinking about a 2d endless runner game with a few choice of character. In my game I will place all characters but they will be deactivated by default.

I want to give a menu to choose which character player like to play with. When player will select a character that specific character will be activated to play.

I don't have any script yet. As I don't how to handle these things


Solution

  • You'll need a script but it should just be a one line call in C# for gameObject.SetActive(false)

    Documentation and example here: https://docs.unity3d.com/ScriptReference/GameObject.SetActive.html