Author Topic: Using WMSK as Only Part of my UI  (Read 248 times)

Connor Winslow

  • Guest
Using WMSK as Only Part of my UI
« on: June 04, 2019, 12:43:01 PM »
Hello, I just purchased the WMSK on the Unity store today and have been trying out the demos and reading the documentation. It's a very interesting tool!

My Unity application I would like to use the WMSK with is UI based and I'm currently creating widgets to display on a screen. I will be showing multiple widgets which are just UI panels inside a larger panel that show things like graphs or statistics. The one widget we wanted to have is one that shows a map of the world and our entity locations on that map. The player would be able to scroll around this map, zoom in, click the icons on the map for those entities, etc. I am able to get a map working outside of the UI, but I can't seem to figure out how to get the map to display within a widget panel in the UI and still be interactable through that widget. I have tried both making a second camera that watches the Viewport and showing that as a Render Texture in my UI, and I have also tried just reducing the second camera's viewport rect to be overtop where my widget would be. It will display the world map, but I am unable to scroll, zoom, or interact with the map in any way. Does anybody have an idea how I could integrate the functionality of the WMSK into a single UI panel?

Thanks,
Connor
« Last Edit: June 04, 2019, 01:14:38 PM by Kronnect »

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 4887
    • View Profile
Re: Using WMSK as Only Part of my UI
« Reply #1 on: June 04, 2019, 01:14:26 PM »
Hi Connor,

Thanks for purchasing WMSK.

The map assets are 3D objects (both the map and the viewport are 3D) so they cannot be added to a Canvas hierarchy but you can manually adjust the position/rotation/scale of the viewport to match the world position rectangle of your UI placeholder. You could do so with the main/2D map itself and not use a viewport at all. In fact that's how the mini-map UI element works:
Check demo scene "402 MiniMap CanvasUI" under "UI Examples". It shows a mini-map as an UI element of a Canvas - notice that mini-map is a fully working map object but configured in a way that it's mostly used to select a point of the world and make the main map fly to that position.

I'll add an option into next beta to WMSK's inspector so you can assign an UI element (ie. a UI panel) and the map will occupy that area automatically. Since you will be using the map as an UI element I understand that using a viewport does not make any sense (assuming your UI panels are flat). Alternatively you could just make space in your UI so the viewport is visible through the UI.

To download next beta releases please send me a pm with your invoice number to get access to the beta board.

Regards

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 4887
    • View Profile
Re: Using WMSK as Only Part of my UI
« Reply #2 on: June 07, 2019, 10:08:02 AM »
A new property dubbed "UI Panel" has been added to WMSK. You can drag & drop a canvas panel element and the viewport will automatically adapt its position and size to match the UI element rect.
Demo video: https://youtu.be/HNh-kRgoo_M
This feature will be available in next beta.
Regards

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 4887
    • View Profile
Re: Using WMSK as Only Part of my UI
« Reply #3 on: June 07, 2019, 11:09:31 AM »
New beta avaialble. If you don't have access to the beta board, please send me a pm with your invoice number to get access.
Thanks.