Scripts stop working after closing Unity?

Sorry, if this is a silly question but I’m new to Unity and scripting. I followed a tutorial to make an interactive game object and it works fine until I close Unity/load up a different scene. The code looks like this:

using UnityEngine;
using System.Collections;

public class objectSelect : MonoBehaviour {
	public RaycastHit hit;

	// Use this for initialization
	void Start () {
	// Update is called once per frame
	void LateUpdate () {
		Ray ray = Camera.main.ScreenPointToRay (new Vector3 (Screen.width / 2, Screen.height / 2, 0));
		if (Physics.Raycast (ray, out hit, 3)) {
						if (hit.collider.gameObject.GetComponent<highlightInteract> () != null) {
								hit.collider.gameObject.GetComponent<highlightInteract> ().OnLookEnter ();


thanks in advance

Everytime you close a scene all objects are destroyed. If you want any object to stay permanently between scenes you have to use function DontDestroyOnLoad: