Pointers to Show Off-Screen Enemies

I have made this script to create a GUI Texture at every Enemy (/every tag you tell it to) and it works great so far but now I want to add an off screen indicator to show where enemies you can’t see are. (sort of like [this][1])

P.S- I dont need a real script… just “pointers” on how to do it

-heres my code-

var multiplier : float;
var style : GUIStyle;
private var list : String;
var range : int;
var TargetTags : String[];
var TargetTexture : Texture[];

function OnGUI ()
{
	for(var t = 0; t < TargetTags.Length; t ++)
	{
		var pointers : GameObject[];
		pointers = GameObject.FindGameObjectsWithTag(TargetTags[t]);
		
		list += "------------------ 

" + TargetTags[t] + "

";

		for(var pointer in pointers)
		{
			var dist = Vector3.Distance(transform.position,pointer.transform.position);
			if(dist < range)
			{
				if(pointer.renderer.isVisible)
				{
					var size = multiplier / dist;
					var rect : Vector3 = camera.WorldToScreenPoint(pointer.transform.position);
					GUI.DrawTexture(Rect(rect.x -size/2,Screen.height - rect.y - size/2,size,size),TargetTexture[t],ScaleMode.StretchToFill,true,10.0f);
				}
				
				list += pointer.name + "

";
}
}
}
GUILayout.Box(list);
list = “”;
}
[1]: How to make a Offscreen Target Indicator Arrow in Unity - YouTube

Try using something like this:

var allEnemies = GameObject.FindGameObjectsWithTag("Enemy");

to find all game objects with a certain tag, then use:

transform.LookAt

to get the arrows to automagically face the right way. As for only showing objects off camera, have a look at Renderer.OnBecameInvisible. Looks like that will do exactly what you need.