Topic: Toggle Buildings/Traffic On/Off

Hi,

I have been trying to implement this functionality in a menu.  (see pix) Got Zoom in and out going using the ZoomArea demo script.  I have looked at the Demo script and see that there is an option to toggle traffic on/off.  Just not sure how to implement using a button on the UI. 

I have dragged the Map GameObject over to the On Click () function for the button and then selected the Demo, SetTraffic() function which then creates the Demo.SetTraffic function.  (see image).  This does not present a boolean or other option to turn this on or off so this does not work for me so I am not implementing it correctly and not sure where to go from here. 

I think the Buildings toggle on/off would be a bit more involved.  I am trying to turn it on or off for the building streaming on the UI to basically declutter the map if required.  Any links to examples or posts would be greatly appreciated. 

Not trying to get anyone to do my work, just a push in the right direction would be great!

Cheers
John

Post's attachments

Attachment icon mapcontrols.jpg 459.25 kb, 34 downloads since 2022-09-17 

Re: Toggle Buildings/Traffic On/Off

Looks like I can't post the second image, but it is the UI that appears when you add the Demo script as a component to the Map GameObject in Unity.

Re: Toggle Buildings/Traffic On/Off

Hello.

To enable/disable traffic, simply set the appropriate flag (OnlineMaps.traffic).
https://infinity-code.com/doxygen/onlin … 960013083d

To enable/disable buildings, enable/disable Online Maps Buildings component.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Toggle Buildings/Traffic On/Off

Got it going.  Thank you very much for the assistance.  For noobs like me, here is the script I created:

 using UnityEngine;

namespace InfinityCode.OnlineMapsDemos
{
    [AddComponentMenu("Infinity Code/Online Maps/Demos/OverlayMaps")]
    public class OverlayMaps : MonoBehaviour
    {
        public void TrafficToggle()
        {
            OnlineMaps.instance.traffic = !OnlineMaps.instance.traffic;
        }

        public void BuildingToggle()
        {
            OnlineMapsBuildings.instance.enabled = !OnlineMapsBuildings.instance.enabled;
        }

    }
}