Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

[Alpha | Free] AB Minimap: a UnityGUI minimap

Discussion in 'Assets and Asset Store' started by AssetBrewery, Sep 23, 2014.

  1. AssetBrewery

    AssetBrewery

    Joined:
    Sep 22, 2014
    Posts:
    18
    AB Minimap is a 2D minimap prototype using the new UnityGUI. The project requires Unity 4.6 RC1. I might release this on the asset store eventually. It is free for now.


    The minimap can render the map in two ways (or more if you Example sceneit). Currently it supports a sprite based rendering (non-PRO) or RenderTexture based render (PRO). Currently it has only been tested in the PRO version and only in the Web Player and the Windows build.


    • Displays a minimap that can be scaled and positioned within a screen space or a world space UnityGUI canvas
    • Supports various minimap objects (pins, marks, arrows, tooltips)
    • Can be smoothly zoomed in/out
    • Can combine different render modes in one minimap (e.g. rendering a rasterized grid through a MViewRaster view on top of rendering the scene through RenderTexture and MViewRT view)
    • Works in XZ and YZ orientation
    • Can be interacted with (pointer interaction, dragging and so on)
    • Can run at arbitrary framerates (Update/LateUpdate/FixedUpdate or custom framerate, e.g. 15 updates per second)
    • Contains a script to take a map snapshot of the current level
    screen.png


    The video is a bit outdated since it has been taken in version 0.02 (the newest version is 0.05)


    Minimap
    • Run and inspect the example scenes "Assets/Examples/Minimap/Scenes/MinimapXZ" to see how the system works.
    • Add "Minimap_XZ_SS" or "Minimap_YZ_SS" prefab in a UnityGUI screen space canvas. "Minimap_XZ_WS" can be put in the world space canvas. Again, check the example scenes.
    • Add "MMActor" script on each actor you want to represent in the minimap and assign the "MObject" you want to associate with it. "MObjects" are prefabs that appear in the minimap. It could be a pin, a circle, an arrow etc. Example objects can be found in "Prefabs/Minimap/Objects".
    Snapshot
    • Enable and check the "MapSnapshotCameraXZ" or the "MapSnapshotCameraYZ" gameobject in the example scenes.
    • If you want to take a snapshot, drag the "MapSnapshotCameraXZ" or the "MapSnapshotCameraYZ" prefab into your scene and enable it. Center the camera so it covers the whole height and press the take snapshot button. The snapshots will appear in "Assets/Textures/Minimap/Snapshots".
    • The system is getting a bit complex and there is no tutorial or documentation as of now
    • Sharing MObjects across different minimaps properly is not implemented yet
    • Example assets can be found in "Assets/Examples"
    Looking forward to comments and suggestions! Let me know if you use it anywhere.
    AssetBrewery

     
    Last edited: Nov 12, 2014
    JosephSavior and tequyla like this.
  2. AssetBrewery

    AssetBrewery

    Joined:
    Sep 22, 2014
    Posts:
    18
    ------------------------------------
    0.05b330
    ------------------------------------
    [Feature] Create new minimap window (Window/ABMinimap/Create new minimap)
    [Feature] Dynamic RenderTexture script for cameras, no need to create RenderTexture assets and assign them anymore
    [Improvement] Updated to Unity 4.6 RC1 (there are code changes for this, won't work in previous betas). This also fixed the Web Player build and no more lost references.
    [Improvement] Code cleanup, removing TODOs a minor optimizations
    [Improvement] Added simple FPS benchmarking
    [Fix] Encountered Unity UI performance problem with applying rotations. Performance drops when using rotating minimap. Improved the code to at least do this as little as possible. Waiting for Unity to fix this issue.
    [Fix] Minor fixes
    ------------------------------------
    0.04b291
    ------------------------------------
    [Feature] ABMinimap settings window (Window/ABMinimap/Settings)
    [Feature] You can now run map updates in Update, FixedUpdate, LateUpdate or custom CustomUpdate with any target framerate
    [Improvement] Global update setting allows you to run the minimap in any target framerate. Any MMapBase-inherited script can also define an override to run as often as necessary.
    [Improvement] Code optimization and cleanup
    [Improvement] Events are now part of the event system and can be put on any object as you wish
    [Improvement] Extended the event system to suport OnEnter, OnExit, dragging and other input options
    [Fix] Minor fixes
    ------------------------------------
    0.03b243
    ------------------------------------
    [Feature] Ability to take a map snapshot in any meaningful resolution that can be used for the map background in the rasterized minimap
    [Improvement] More scripts now run in the edit mode so you can see the outcome directly in the editor without running the game. Can now also be disabled in menu through Window/ABMinimap.
    [Improvement] Improved the example scenes and added descriptions
    [Improvement] RT camera can be part of the minimap hierarchy (hardcoded rotation and position)
    [Fix] Fixed arrow not being displayed in the same distance on different zoom values
    [Fix] Changed the way YZ orientation angles were calculated
    ------------------------------------
    0.02b203
    ------------------------------------
    [Feature] Map works in YZ orientation
    [Feature] Map is interactable (currently only on PointerUp is implemented)
    [Feature] Map can rotate according the forward vector of the followed actor
    [Improvement] Allows for combining multiple views and models under one controller. Current examples are using combinations of Raster (drawing grid and objects) and RT (drawing scene) under one controller.
    [Improvement] Disabling objects according to the mask, transition can be animated
    [Improvement] New editor scripts on most components. Zoom can be adjusted using a slider
    [Improvement] Raster and RT views run in edit mode to give some immediate feedback
    [Improvement] Raster has an editor tool to determine the map size
    [Improvement] Works with the world space canvas
    [Improvement] Supports varius map objects, not just pins. CircleMark and Arrow are now implemented
    [Improvement] Zoom values are unified on Raster and RT views
    [Improvement] MObjects now can have "depth" and are sorted automatically to make sure they are rendered as intended
    [Fix] Bunch of fixes from the old version
    ------------------------------------
    0.01b63 - The initial release
    ------------------------------------
    [Feature] Displays a minimap that can be scaled and positioned within a screen space canvas
    [Feature] Positions and rotates pins within the map
    [Feature] Supports smooth zooming
    [Feature] Uses Image Mask to cut out the desired area
     
    Last edited: Nov 12, 2014
  3. Breyer

    Breyer

    Joined:
    Nov 10, 2012
    Posts:
    412
    Looks very nice, there is a lot of monobehaviour missing in uGUI b21 though, maybe related to replaced psych/screen resolution to canvas scaler? (i didnt check what package contain in older unity) And what i should do to enable sprite based minimap? as i see there is only RT version and example....
     
    AssetBrewery likes this.
  4. AssetBrewery

    AssetBrewery

    Joined:
    Sep 22, 2014
    Posts:
    18
    Thank you for the comments.

    Here's an 0.03 alpha that I have tested with b21, I have also quickly added a rasterized map example. Just open the MinimapXZ scene in examples and check the bottom left map. The prefab is called "MinimapXZSS_RasterOnly".

    I am always testing the releases on a blank project so there shouldn't be any missing monobehaviours whatsoever. Please let me know if you still have any.

    There is however the problem with missing mask sprite references. I believe that's a UnityGUI bug. Because of this, the minimaps are rectangular and not cut off properly. Assign the Mask texture from the textures folder to the image component on the mask gameobject in the minimap in the scene for this to start working.

    edit: it really is an alpha with a few bugs so I would just recommend this only for checking out the raster example and the b21 compatibility, don't use it for anything else
     
    Last edited: Nov 1, 2014
  5. Breyer

    Breyer

    Joined:
    Nov 10, 2012
    Posts:
    412
    it work i was aware of mask bug only monobehaviour was a problem. as it is alpha i notice some bugs e.g. minimap and frame completely dont match each other (exactly minimap is fully under frame) i fixed its myself but this was only test then i noticed raster grid is always behind minimap. And last thing - i think ur minimap system is too complicated in structure and is unoptimized - e.g u use 2 mask for raster AND map with the same image while im sure you could limit to 1 mask. ah see my screenshot after some playing with ur structure without digging into code:

    View attachment 117177 View attachment 117178

    as you see only icons is bugged but as i said i didnt dig into code and cant set properly raster but there was previously problem ^^

    I think after code redesign it could be more simplified...

    This project look very promising and definitely have potential though ;)

    BTW what u doing to achive perfect minimap sprite since its cant be done via RT? ortho camera + something and simply do screenshot?
     
  6. AssetBrewery

    AssetBrewery

    Joined:
    Sep 22, 2014
    Posts:
    18
    I am aware of the complexity, it is one of the things I want to focus on next.

    The idea with one mask is good one. I used multiple masks because I wanted the frame not to have one but I see the benefit. I will think how to do that.

    The minimap sprite, as you say ortho cam + make RenderTexture through code and take a snapshot. I have already done the code and the editor script, just need to release it. It is coming next.

    Thank you for the comments :].
     
    Last edited: Oct 29, 2014
  7. Breyer

    Breyer

    Joined:
    Nov 10, 2012
    Posts:
    412
    EDIT: Doh! i restarted my test project and played more carefully - i was able to packed and optimise structure without rewriting code and this work rasterizer including. there is only small problem - grid move with player while i think should move with minimap but i guess this is possible only via rewrite some code. As a side note i had to add 2 MView Raster in one GO to handle both minimap and raster - there is place to rewrite this MView to handle minimap and grid as optional layer in the same time. there is unitypackage (eh unity dont allow me to send package even if it is smaller than 4mb i will try send in another way)

    BTW u have PRO version? i exported your project but i have always more than 3mb while ur package is smaller than 2mb..... and they are practically same

    EDIT nevermind i saw that ur package have more than 3mb too i dont know why i was think there is smaller than 2mb.....
     
    Last edited: Oct 29, 2014
  8. AssetBrewery

    AssetBrewery

    Joined:
    Sep 22, 2014
    Posts:
    18
    Updated to 0.03, added a script to take map snapshots among other things.

    Breyer, I have also merged the masks as you suggested. Thanks for the tip again!
     
    Last edited: Nov 12, 2014
  9. AssetBrewery

    AssetBrewery

    Joined:
    Sep 22, 2014
    Posts:
    18
    Updated to 0.04, added the settings window, arbitrary update options so the components can run at custom framerate for better performance and revamped the event system among other things. See full changelog for all the changes.

    I move this from prototype stage to alpha since many of the core features have been implemented.
     
    Last edited: Nov 12, 2014
  10. AssetBrewery

    AssetBrewery

    Joined:
    Sep 22, 2014
    Posts:
    18
    Updated to 0.05, I have added among other fixes and improvements the Create new minimap window for creating a simple minimap if you don't want to use an existing example and updated to 4.6 RC1 which solved some previous issues with the UI system (e.g. the import issues) . See full changelog for all the changes.

    Finally, also the Web Player build now works. You can now check out the example scene online.
     
  11. lost1990

    lost1990

    Joined:
    Dec 20, 2014
    Posts:
    2
    Hi,
    I have been playing around with your asset these last few days and i found it really good but the lack of documentation make it really difficult.
    I have got it to work with my project but i always got this error :
    Unsupported texture format - needs to be ARGB32, RGBA32, BGRA32, RGB24, Alpha8 or DXT
    Any idea how to fix it ?
    Also when i import your prefabs into the scene i cannot save it anymore ? really weird
    and finally i don't know why but when i import one of the prefabs the RT_Camera become the default one even if a checked the tag.
    i got around the problem by just deleting the camera with the prefab and importing the RT_camera in the default Components but it works only the first time i launch the game after that no more map texture.

    Thanks in advance
     
  12. AssetBrewery

    AssetBrewery

    Joined:
    Sep 22, 2014
    Posts:
    18
    Hi,
    Sorry for the late reply. What version of Unity do you use?

    Do you have any idea what texture is this error related to? I would suspect your mask texture not to be in one of the above mentioned formats but it could be any of the other textures as well. Also check if the mask texture has the Read/Write enabled option ticked in the Import settings.

    I am able to. What if you duplicate the prefab, does it work then?

    Are you looking for a minimap with only rasterized background then? You can check the Minimap_XZ_SS_SimpleRaster, it has only rasterized background, no RenderTexture.

    I am glad you like the asset! :)
     
  13. paulus51

    paulus51

    Joined:
    Dec 5, 2012
    Posts:
    33
    hi , i was interesting with this minmap feature but wen i imported a prefab :
    first you have to create a canvas,
    then put the prefab in it,
    but i get half screen in minimap and alot errors like this :

    " Assets/Editor/Minimap/Util/MCreateMinimap.cs(192,30): error CS0029: Cannot implicitly convert type `Sprite' to `UnityEngine.Sprite' "
    i am using 6.4.1 with the new ui system in it
    so it would be create if you compile a working prefab ;-)

    btw my project is empty accept a terrain
    hope " we" can fix it , it seems a real good minimap for alot of games ;-) keep up the good work
     
  14. AssetBrewery

    AssetBrewery

    Joined:
    Sep 22, 2014
    Posts:
    18
    Thank you for reporting this. I haven't upgraded to the project to 4.6.1 yet but the asset seems to work fine with 4.6.1f1.
    Maybe you can check out the example scenes, you can also copy and paste the minimaps from there into your scene.

    Regardless, I am not sure why do you get this error. If you can't figure it out, contact me through PM and send me the project and I will check it out.
     
  15. paulus51

    paulus51

    Joined:
    Dec 5, 2012
    Posts:
    33
    hello and thank you for the quick awnser, i have put that little project aside becouse to muts errors, but i wil make a little clean project to let you see so you can work that out i wil pm you wen i am ready ;-)
    but then you should have v 4.6.1 to work with ;-)

    ow btw wen your prefab is placed into the hierachiev you must manualy put an canvas otherwise it wont work !
     
    AssetBrewery likes this.
  16. paulus51

    paulus51

    Joined:
    Dec 5, 2012
    Posts:
    33
    oke i have taken an updated version now and installed this without any problems,

    no errors so far,

    only my character is not been followedd by the minimap (version XZ-SS )
    how do i get it follow my character,
    [edit : done ! its following my character now ]




    [edit] works so far so good !

    but small problems
    i see my self good only i miss the arrow and
    white Arrow in minimap and that raster, i dont want to see that how to change it ?




    ps, nice work done chapau !
     
    Last edited: Jan 19, 2015
  17. paulus51

    paulus51

    Joined:
    Dec 5, 2012
    Posts:
    33
    oke i did get rid of that raster in the minimap :

    edit the png file make layer not visible , save it imported back,
    click on image ( in unity ) and dont forget to sprite 2D and ui , apply done
    replace the one with raster , results in :


    [ zoomed out picture ]

    that little point in the middle is my character, so i am puzzling to get the arrow " on his head "

    or download this file , its minimap2.png renam it to : graph_paper.png to its original name or keep it that way ;-)
    link : http://www45.zippyshare.com/v/9TKOxOe3/file.html
     
  18. jotaate

    jotaate

    Joined:
    Nov 17, 2012
    Posts:
    2
    Hi! I really liked your asset. But I have some problems.
    How do I change the speed of movement of the Target (Player) on the radar.
    The speed with which the target icon (player) advances is unreal compared with the map size (the size of Snapshot). Besides the Snapshot covers not take my real map.
     
  19. AssetBrewery

    AssetBrewery

    Joined:
    Sep 22, 2014
    Posts:
    18
    Basically every object that you want to be visible in the minimap should have the MActor component applied to it. That one holds a reference to the MObject that represents it in the minimap (could be a pin, an arrow etc.).

    On the MObject gameobject, you would typically like to have the MObject there (holds the values), MObjTranslate (to move), MObjScale (to scale), MObjRotateActor (to rotate if desired) and the MPin (just a standard pin logic, if you want more advanced object like some kind of advanced arrow, you can make your own class and replace the MPin component). Check out the MObjTarget prefab. It is referenced within the scene by the First Person Controller.
     
  20. AssetBrewery

    AssetBrewery

    Joined:
    Sep 22, 2014
    Posts:
    18
    You seem to have multiple issues but basically the speed at which the target is progressing is dependent on the size of the map and the zoom level. The more you zoomed out, the slower it is going to be.

    If you are using the rasterized minimap, check if the set up correctly the map size (click on the gameobject with the MViewRaster and adjust the red handles in the scene to match the size of the level or change the map size variables in the component itself in the inspector). RenderTexture version MViewRT doesn't need this setup.

    How much you are zoomed in depends on your zoom values, the default one is set in the MViewRaster/MViewRT component and is called Zoom value. You also have the option to specify the maximum zoom out and zoom in. Maybe tweaking these variables will give you the intentional effect? If not, feel free to contact me through PM or send me the project and I will have a look at it.
     
    jotaate likes this.
  21. RIJALAB

    RIJALAB

    Joined:
    Jan 7, 2015
    Posts:
    8
    Wow.. superb Asset AssetBrewery.. Great Work !!!

    I've tried to implement minimap for my game. I've almost got all those things, but i can't get the Minimap background as my land. Only i'm getting the default "MapSnapshotXZ" image. But i want the background as Top view of my land. So how can i do that?

    Thanks in Advance..
     
  22. jotaate

    jotaate

    Joined:
    Nov 17, 2012
    Posts:
    2
    solved. it's great. thx
     
    AssetBrewery likes this.
  23. AssetBrewery

    AssetBrewery

    Joined:
    Sep 22, 2014
    Posts:
    18
    Try replacing the Source image in the Image component on the Map gameobject. It should scale accordingly to your zoom and map size.
     
  24. RIJALAB

    RIJALAB

    Joined:
    Jan 7, 2015
    Posts:
    8
    Thanks for the reply.

    Yeah, already i tried as you said. But I dont want to show the image in Minimap.

    I would like to capture current top view of my terrain from camera and to show in that circular minimap. That's what i need for my 3D game which makes more realistic view.

    So how can i replace the Source Image with Camera ? Or suggest me some ideas to do this task
     
  25. AssetBrewery

    AssetBrewery

    Joined:
    Sep 22, 2014
    Posts:
    18
    Do you have a Unity Pro? In that case you can use the RenderTexture (RT) version of the asset. Check out the Minimap_XZ_SS in the example scene. It is connected to an ortographic camera in the scene.
     
  26. RIJALAB

    RIJALAB

    Joined:
    Jan 7, 2015
    Posts:
    8
    Oh..I'm using Unity Free version. Is there any other way to do this??
     
  27. AssetBrewery

    AssetBrewery

    Joined:
    Sep 22, 2014
    Posts:
    18
    Yes but I am afraid this asset does not do this out of the box and it would require a specific setup. However it should be possible if you code it yourself (it is not an ideal solution however).

    In theory, from the top of my head:
    You need to have two cameras. First one is your standard gameplay camera. You can make a second camera and adjust the viewport size to fit the desired size on the screen. Make the camera orthographic and point it against the ground. Now you would need to make some kind of pins/arrows and place them on the actors (players, monsters, loot etc.). Set the ground to one layer and the pins/arrows to another layer. Now make your second camera render only the two layers and don't render the pins/arrows layer on the first camera. This would be the basic setup. You don't my asset for it, no UI system either, it runs through standard Unity classes/assets. This system however will have a lot of limitations and will be hard to maintain (in my opinion) but it can serve you well for a small game or just for playing around :).
     
  28. RIJALAB

    RIJALAB

    Joined:
    Jan 7, 2015
    Posts:
    8
    Mm.. thanks AssetBrewery.. I'll try my best..:)
     
    AssetBrewery likes this.
  29. RIJALAB

    RIJALAB

    Joined:
    Jan 7, 2015
    Posts:
    8
    Hey..One more Doubt..

    In MinimapYZ scene, You've showed the ExampleQuest object's location inside the circle, even it's not close enough to cube. Seems like the way it located. How to do this? I'd like to assign this to my fuel. I have also checked your hierarchy. But cannot get the clear idea.. So kindly let me know..
     
  30. AssetBrewery

    AssetBrewery

    Joined:
    Sep 22, 2014
    Posts:
    18
    Yes, it points towards the direction of the cube (the actor).

    It's a custom code of an MObject. Technically, every MObject can do whatever you want, you just need to implement it. Right now, I have implemented a MPin (hovers "on top" of the object) and a MArrowCircular (circles in a radius when the actor is outside of the mask and points to the direction of the actor).
     
  31. RIJALAB

    RIJALAB

    Joined:
    Jan 7, 2015
    Posts:
    8
    Yeah.. I checked out those scripts. But these scripts doesn't added directly to the object. whether i have to add manually or not? Give me some brief explanation
     
  32. paulus51

    paulus51

    Joined:
    Dec 5, 2012
    Posts:
    33

    hi Assetbrewery , i have added a MObject to the player for having the arrow on my minimap but stil no arrow
     
  33. AssetBrewery

    AssetBrewery

    Joined:
    Sep 22, 2014
    Posts:
    18
    Yes, you have to add the scripts manually.

    You want to add MActor on the real world object (the player, the enemy, the loot, anything that exists within the game world). This references a MObject. MObject is a "base" class for anything that exists within the minimap (the pin, the arrow, anything that replicates a game world object on the minimap really). MObject doesn't do anything by itself. On the MObject you can have other components that perform the minimap object logic (like translation, rotation, scale, drawing a pin, drawing an arrow to an object outside of the minimap etc.).

    I will try to simplify this in the next release.

    I am not sure if I understand but I think you got it wrong. The MArrowCircular is used for pointing at objects outside of the minimap range (for example, to show the way to a quest). I don't see how would it be useful on the player. What you want to have on the player's MObject (probably) is the MPin with MObjTranslate (to move it on the map), MObjScale (to scale it while zooming) and MObjRotateActor (to rotate where the player is looking). Also, don't forget to choose a sprite that looks like an arrow so you can actually see the rotation effect. You can see the MObjTarget prefab in the example, this one is used for the player in the example scene.
     
  34. RIJALAB

    RIJALAB

    Joined:
    Jan 7, 2015
    Posts:
    8
    Thanks AssetBrewery.

    Solved the problem. But still i encounter some more issues.

    • Can't able to change the image of Quest icon and ArrowQuest Icon in the minimap..
    • The ArrowQuest shows in proper direction in the minimap. But when we try to reach that QuestObject, the QuestObject suddenly comes to the center of the minimap(Player's Icon position) while we reach near to the object Not exact QuestObject position. QuestObject Icon doesn't smoothly move in that minimap. It suddenly shift its position. I've also tried both Orientation(XZ & YZ) and it doesn't help. I don't know where i did the mistake. Can you help me plz?
     
  35. AssetBrewery

    AssetBrewery

    Joined:
    Sep 22, 2014
    Posts:
    18
    You can change that through the Image component. Also these sprites are a part of the sprite atlas, you might want to check if it gets updated correctly. Otherwise I don't see why it should not work.

    Well I am not exactly sure what is going on there but the MObjQuest has two separate logic scripts: MPin and MArrowCircular. MPin is only visible when the quest object is in the visible area. MArrowCircular is only visible if the quest object is outside of the visible area. Each of them has a different icon so it might be helpful if you know which one of them doesn't work for you.
     
  36. RIJALAB

    RIJALAB

    Joined:
    Jan 7, 2015
    Posts:
    8
    Thanks !!

    Fixed the Image changing Issue.

    Now the second problem is almost solved.
     
    AssetBrewery likes this.
  37. tequyla

    tequyla

    Joined:
    Jul 22, 2012
    Posts:
    335
    Hi,

    i like it. +1 :)

    any update for unity 5.1.2f1?

    ++++
     
    AssetBrewery likes this.
  38. AssetBrewery

    AssetBrewery

    Joined:
    Sep 22, 2014
    Posts:
    18
    Hi, sorry for the late reply. I am glad you like it. I do plan to eventually move on with the project but I am currently busy with other projects.