Cannot add script?!

i have a problem with a screapt i just wrote, trying out a heap method of organizing Nodes, the code is perfkt, and i have gone over it for 5 hours and still can’t findt the problem. Every Fing time i try to attach the script to my game object, i tell’s me the error " can’t add script" bla bla bla “vlass cannot be found”, but the problem is that the class i right fing there, spelled 100% correctly and i am about too throw somthing really hard, so turned to see if any one here is having the same errors or if any one can help me
Btw sorry for bad english:)

    using UnityEngine;
    using System.Collections;
    using System;
    
    public class Heat<T>  where T : IHeatitem<T>{
    	T[] Items;
    	int currentItemCount;
    	
    	public Heat(int maxHeatSize){
    		Items = new T[maxHeatSize];
    		
    	}
    	public void Add(T item){
    		item.Heatindex = currentItemCount;
    		Items[currentItemCount] = item;
    	SortUp(item);
    		currentItemCount++;
    	}
    	public T Removefirst(){
    		T firstitem = Items[0];
    		currentItemCount --;
    		Items[0] = Items[currentItemCount];
    		Items[0].Heatindex = 0;
    		SortDown (Items[0]);
    		return firstitem;
    	}
    	public void UpdateItem(T item){
    		SortUp(item);
    	}
    	
    	public int count {
    		get{
    			return currentItemCount;
    		}
    	}
    	
    	public bool Contains(T item) {
    		return Equals(Items[item.Heatindex], item);
    		
    	}
    	
    	
    	void SortDown(T item)
    	{
    		while(true)
    		{
    			int childIndexLeft = item.Heatindex * 2 + 1;
    			int childIndexRight = item.Heatindex *2 + 2;
    			
    			int swapIndex = 0;
    			
    			if(childIndexLeft < currentItemCount){
    				swapIndex = childIndexLeft;
    				if(childIndexRight < currentItemCount){
    					if(Items[childIndexLeft].CompareTo(Items[childIndexRight]) < 0 ){
    						swapIndex = childIndexRight;
    					}
    				}
    				if(item.CompareTo(Items[swapIndex]) < 0) {
    					Swap(item, Items[swapIndex]);
    				}else{
    					return;
    				}
    			}else{
    				return;
    			}
    		}
    	}
    	
    	void SortUp(T item){
    		int parentIndex = (item.Heatindex-1)/2;
    		
    		while(true){
    			T parentitem = Items[parentIndex];
    			if( item.CompareTo(parentitem) < 0){
    				Swap(item,parentitem);
    			}else{
    				break;
    			}
    			parentIndex = (item.Heatindex-1)/2;
    		}
    	}
    	void Swap(T itemA, T itemB){
    		Items[itemA.Heatindex] = itemB;
    		Items[itemB.Heatindex] = itemA;
    		
    		int itemAIndex = itemA.Heatindex;
    		itemA.Heatindex = itemB.Heatindex;
    		itemB.Heatindex = itemAIndex;
    		
    	}
    }
    
    public interface IHeatitem<T> : IComparable<T> {
    	int Heatindex{
    		get;
    		set;
    	}
    }

You cannot add a script that is not a MonoBehaviour to a game object, as it is not considered a “Component”. You have to inherit from MonoBehaviour.

You can, however, use a reference to your script inside a MonoBehaviour, so maybe that will help.