Scripts disappearing from Unity UI elements

I am using the GUI system that was introduced in Unity3d 4.6 (I’m on the most recent Unity 5 version). When I change scenes on my game all the scripts that were attached to UI elements, such as canvases and buttons, disappear and I get a “The associated script cannot be loaded” error. I use GitHub for version control and have enabled visible meta files in the editor settings version control and have set asset serialization to force text. This doesn’t just happen when I sync to GitHub, but just when I change scenes within the game. Anyone have an idea how to fix this? Thanks!

i guess your canvas is not persistent ?I am not pro but i read somewhere that when loading a scene, since your canvas is not in the other scene, you need to make your canvas stay “alive” by using DontDestroyOnLoad(your canvas).