Passing Variables between Scenes !!

I need to send the start up selection options Scene(0) variables and load it to my game which is Scene(1).
I used
GameSelect =GameObject.FindGameObjectWithTag(“GameController”);
GameSelection = GameSelect.GetComponent() ;
DontDestroyOnLoad(transform.gameObject);

but always i got a error msg : Object reference not set to an instance of an object !!

:face_with_spiral_eyes::face_with_spiral_eyes::face_with_spiral_eyes::face_with_spiral_eyes::face_with_spiral_eyes:

Hi!
Which line gives you the error message?

inside the function that send variables to next level :

GameSelection.SetSelection(…data from scene1…);

Hint: SetSelection() found in the next level

I solved this issue by creating a GameObject and giving it a script with all the info i wanted to move to the next scene.

Make sure you are keeping the right game Object

DontDestroyOnLoad(this.gameObject); // keeps this GameObject alive after load is called

If or when you want these to be destroyed you have to call

Object.Destroy(gameObject);

I Solved my problem with PlayerPrefs as following :

PlayerPrefs.SetInt(“bye2”, selGridInt2);