- Home /
Question by
aljndro · Apr 19, 2017 at 01:15 PM ·
characterprogrammingcharacter controlleravatarcharacters
How can I change character?
I don't know how can I change character, I have two characters a ball, and one avatar, my avatar can transform in that ball, I have those models and animations, but I don't know how can I change it, I tried with a Empy Game Object and a simple script, like this:
public GameObject Avatar;
public GameObject Ball;
public KeyCode inventoryKey;
public KeyCode inventoryKey1;
// Use this for initialization
void Start () {
Ball.gameObject.SetActive(true);
Avatar.gameObject.SetActive(false);
}
// Update is called once per frame
void Update () {
if (Input.GetKeyDown(inventoryKey))
{
Ball.gameObject.SetActive(true);
Avatar.gameObject.SetActive(false);
}
else if (Input.GetKeyDown(inventoryKey1))
{
Ball.gameObject.SetActive(false);
Avatar.gameObject.SetActive(true);
}
}
}
But it daesn't work, and I want to change those if for collider, like this:
OnCollisionEnter(){ Active my avatar and desactive the ball } and when the collision finish active ball and desactive avatar.
Comment
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Minor Addition to Jumping using CharaterController 1 Answer
Character Controller, changing collider's size? 0 Answers
Should I have a root bone? 0 Answers