// Start is called before the first frame update void Start() { playerCharacter = Instantiate <Transform>(PlayerCharacterRef, PlayerStart.position, Quaternion.identity); GameObject statsgo = new GameObject("GameStats"); stats = statsgo.AddComponent <TrackableStats>(); DontDestroyOnLoad(statsgo); }
private void Awake() { stats = GameObject.FindObjectOfType <TrackableStats>(); statsObject = new GameObject("NewStats"); statsObject.AddComponent <TrackableStats>(stats); Destroy(stats.gameObject); stats = statsObject.GetComponent <TrackableStats>(); }