- Home /
Objects on minimap replaced with icon?
I have successfully made a minimap... It is an orthographic camera with the view port scaled down to the appropriate size. My question is: How would i make it so that instead of showing the actual object it shows an icon?
here is a mock up i made for an example:
Regards
Answer by Bunny83 · Aug 05, 2014 at 12:22 AM
Simply use two cameras with different layermasks. So each object actually has both visual representations but the one is only seen by your main camera and the other only by your minimap camera. Simply place the minimap symbols (which should be a child of the actual object) on a seperate layer (you would call that layer "minimap" ;)) and let the minimap camera render only this layer. In your maincameras culling mask you should exclude the minimap layer. That's all.
how would i add the icon to the object? what if the object moved? can i do it through a script?
You simply add a child object to the object. It automatically moves along with the parent.
that seems like a quick and dirty fix to a big problem. $$anonymous$$y game is multiplayer and every object will be displayed on the $$anonymous$$imap. Adding children will be a bit expensive.
It'd be easier to have each object a tag and find the tag in the $$anonymous$$imap script and display it as the icon.. But i just dont know how to go about that.
$$anonymous$$aybe having the children only enabled when it is in the view of the $$anonymous$$imap camera?
@Yoman: That's not necessary as Unity does frustum culling anyways.
@thornekey: Why do you think adding a child object is too expensive? As the child is only visible by the $$anonymous$$imap camera there is no more overhead as you would have anyways. You want to render your scene twice (since you have two cameras). The $$anonymous$$imap representation usually is simpler (just a quad / sprite / ... for an object).
Actually rendering an icon manually in an immediate mode like in OnGUI is actually way worse for performance, as there it's impossible to batch anything. You can do the child-adding via script if you want, anyways you have to decide somehow which icon / replacement should be used for which object.
Your answer
Follow this Question
Related Questions
Problems with texture icon in Unity3D 4 Answers
Displaying Objective Points Through GUI. 2 Answers
Unity 3 scales my iPhone/iPad icons to nonstandard sizes 0 Answers
Assigning UV Map to model at runtime 0 Answers
Fit image to plane 1 Answer