Radar

Radar Script
Author: PsychicParrot (Jeff Murray) http://www.psychicparrotgames.com

After seeing requests for radars quite frequently in the forums, I decided to post this up for everyone to enjoy and hopefully build on :)

Don't know if it's the most efficient way to do this or whatever, but it works and it seems to work pretty well!

USAGE:

Put this script on a GameObject. Select a texture for a 'blip'. Select a texture for the radar background (radarBG) Set the map center (on screen coordinates) Set the GameObject to use as your center object (usually the player) Make sure that all enemies are tagged with 'Enemy' Watch your radar goodness in your game ;)

I included the GUI Matrix scaling line just incase ... if you want it to auto-scale (which is a good thing to do!) un-comment it and change the values to your own game screen resolution.

Enjoy! Jeff.

CSharp Version
Author: oPless A C# version of the script above (slightly modified)

Modified to allow many radar locations based on the CSharp Version
Author: Zumwalt

Updated JavaScript Version
Author: DastardlyBanana This update makes the radar location more flexible, since you can easily define its location in the inspector using one of 9 preset locations or by defining your own. We have also made the radar interact with the enemies it tracks, seeing whether or not they are aware of the player and displaying aware enemies in a different color (this is dependent on the AI script of the enemies- in our game the enemies turn red when chasing the player, but this could be changed to fit the needs of the game it is in). It is also easily possible to change the size of the radar now, based on a percentage of the screen ( so it scales with the screen).

A unity package containing the radar script, demo scene and example script for interaction with enemy AI can be found at our website: []

An example of an AI script to interact with the radar:

Updated CSharp Version
I've created a radar script that I find easy to use and is customizable. You can show up to 4 kinds of objects on the radar but it would be easy to add more blip types.

Simple CSharp Version
it supports n types of objects on radar, simple and usefull to use it: crate empty gameobject and add the script to it, fill the proprietis for the centerObject variable if you want to set it up dinamicly, in your player class scripts use something like: c# verison of script: