how to reference scripts in other scenes unity

C#
//you can use this to preserve scripts when loading new scene
DontDestroyOnLoad();
Source

Also in C#: