going crazy!!!

i just figured that i can’t use yield in a class that is derived from the object like this:

class CLabels extends Object{

  var startPoint : Vector3;
  var endPoint : Vector3;
	
  var labelRect : Rect;
	
  var rPosx : int;
  var rPosy : int;
	
  var rWidth : int;
  var rHeight : int;
	
  var target : Transform;
	
  var cam : MainCamera;
  var lineMaterial : Material;
	
  function DrawLabel(currentTarget : Transform){  		    
     
     Start();
     CalculateLinePositions();
     OnGUI();
     OnPostRender();
     MonitorRectState();
		
 } //END OF DRAW FUNCTION

  //OTHER FUNCTIONS HERE

}

basically what i was trying is to make a class that will draw label on top of selected object. it draws line from the object to the rectangle that holds information about the object. everything works fine, i should say worked fine, until i wanted to make the function that will slide the rectangle to the side when it is located on top of the object, so it doesnt obscure it. so what now? how to use coroutines?

also i am new in writing classes, i dont know if i am doing it the right way. i dont have a constructor, i dont know how to use it. also i am calling OnGUI and OnPostRender from within functions that i wrote. i dont know is that the way to do it…

thanks!

also, i noticed that when i tried to make button with image it doesnt show image on the button (that is when i am using a class) and when i do that in the script that is attached to the camera, the same thing it works…

go figure…

i mean, i guess i am doing something wrong, but i dont know what exactly…

The event functions (Start, Update, OnGUI, etc) only get called automatically when the class is derived from MonoBehaviour. You can still have functions with these names, but they will just be ordinary functions without any special behaviour.