# Change Character Gender

**URL:** https://discussions.unity.com/t/change-character-gender/96757
**Category:** Questions & Answers
**Created:** [February 20, 2014, 3:54pm UTC](https://discussions.unity.com/t/change-character-gender/96757 "2014-02-20T15:54:17Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![thornekey](https://avatars.discourse-cdn.com/v4/letter/t/ce73a5/32.png) [@thornekey](https://discussions.unity.com/u/thornekey)
#### Post date: [February 20, 2014, 3:54pm UTC](https://discussions.unity.com/t/change-character-gender/96757/1 "2014-02-20T15:54:17Z")

</div>

Hey guys, im trying to change my characters gender in the creation screen. having a bit of trouble…

```
void Start () {
		if (gendmale){
			//change PlayerPrefab to male
			Debug.Log("gendmale = true");
		}
		else if (gendfemale) {
                    //change PlayerPrefab to female
			Debug.Log("gendfemale = true");
		}
		GameObject pc =Instantiate(PlayerPrefab, Vector3.zero, transform.rotation * Quaternion.Euler (-90,180,0)) as GameObject;

```

as you can see i have a GameObject variable caleld PlayerPrefab (starts as a male) and buttons (not referenced here) that switch booleans to false and true. If male is true i want PlayerPrefabs model to be changed to the male model and vice versa… how would i do this properly?

---

<div class="post-metadata">

### Author: ![DerWoDaSo](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/derwodaso/32/577016_2.png) [@DerWoDaSo](https://discussions.unity.com/u/DerWoDaSo)
#### Post date: [February 20, 2014, 4:15pm UTC](https://discussions.unity.com/t/change-character-gender/96757/2 "2014-02-20T16:15:12Z")

</div>

Just use a second property for the female prefab. Then create a variable which will be assigned the correct prefab, depending on your gendmale variable. In most cases you wont need two bool variables for male AND for female, since there is no third option. 🙂

```
void Start () {

	GameObject prefab = null;
	
	if (gendfemale)
	{
		//change prefab to FemalePlayerPrefab
		prefab = FemalePlayerPrefab;
	}
	else
	{
		//change prefab to MalePlayerPrefab
		prefab = MalePlayerPrefab;
	}

	GameObject pc =Instantiate(prefab, Vector3.zero, transform.rotation * Quaternion.Euler (-90,180,0)) as GameObject;
}

```
