Hi,
I have a OnGUI Character Creation Menu where I can select 2 different characters. Based on my selection I want to add a "fresh" script onto an existing game object.
`using UnityEngine;
using System.Collections;public class CharacterSelection : MonoBehaviour
{
public static int userCharacter = 0;void OnGUI()
{
GUI.Box (new Rect (0, 0, Screen.width, Screen.height), “Select Your Character”);if (GUI.Button (new Rect (100,100,200,20), "CharacterA")) { userCharacter = 1; Debug.Log(userCharacter); gameObject.AddComponent(typeof(CharacterA));
Application.LoadLevel(“CharacterCreationScreen”);
}
if (GUI.Button (new Rect (100,160,200,20), “CharacterB”))
{
userCharacter = 2;
Debug.Log(userCharacter);
gameObject.AddComponent(typeof(CharacterB));
Application.LoadLevel(“CharacterCreationScreen”);
}
}
`
}
What I want is to choose a character and have the game know that I want this script loaded onto a game object that I have in a scene that I eventually get to..........