Is there anyway to make icons appear on targets if there in view using GUI or can you only use flares? I want to make a way to have an icon get displayed on ships visible when looking through a filter and need to know if that is supported with GUI or only by flares.
Joshua
2
It's definitely possible. There's a script on the wiki here. I never got that script working for me, for some reason it started acting up and slowing my game down if I had too many. But it's enough to give you a working example.
Edit:
here's the way I made it work for myself, probably easier for you then the script on the wiki.
To have a GUITexture follow an in-game object, use
theTextureObject.position = Camera.main.WorldToViewportPoint(theObjectYouWantItToFollow.transform.position);
The only problem is that now it will also show up if the object is right behind you, so use
if(Camera.main.transform.InverseTransformPoint(theObjectYouWantItToFollow.transform.position).z >0)
To check if the object is in front of your camera or not. If it's not, disable the texture, or place it somewhere off-screen.