Topic: OnClick events to change Parameters etc
Hi Guys,
I am creating my first app using the excellent Online Maps asset and I have a very noob question. I have a simple 3D map within an AR environment and I want to use a couple of buttons in the Unity interface to learn the environment which will change the following attributes:
1. Toggle traffic on or off;
2. Change the map style from satelite to street map.
For these I am using the "CreateCustomStylesExample"script.
This script is to specifically change the map style. I have copied and pasted my MapBox access token and also put in the zoom level and x, y (hopefully maps to lat and long coordinates but it doesn't look right to me so that might be one error). Also in the code below I had to take out the full url to post here so I know that (link) is incorrect.
public string style1 = "(link)://a.tiles.mapbox.com/v4/mapbox.satellite/14/21.3069/-157.8583.png?access_token=obscured";
public string style2 = "https://a.tiles.mapbox.com/v4/mapbox.streets/14/21.3069/-157.8583.png?access_token=obscured";
public string mapboxAccessToken;
I also added in the following statement in the code which I was hoping would turn traffic on:
public void OnClickThing()
{
OnlineMaps.instance.traffic = true;
}
I click and drag the script to the On Click () "object" window for the button and the public functions do not appear.
I have also tried dragging that script onto On Click () and then put "style1" or "style2" in the MonoScript.name field. I do not think that is right though. Nothing happens when the buttons are pressed.
Any pointers would be very welcome!
John