I can't figure out why the location marker is not showing up. Any help would be much appreciated. Thanks.
using UnityEngine;
using UnitySlippyMap.Map;
using UnitySlippyMap.Layers;
using UnitySlippyMap.Markers;
using System.IO;
using System.Collections;
using System.Collections.Generic;
public class TileMap : MonoBehaviour {
private MapBehaviour map;
public Texture MarkerTexture;
public Texture LocationTexture;
private List<LayerBehaviour> layers;
// Use this for initialization
void Start () {
// create the map singleton
map = MapBehaviour.Instance;
map.CurrentCamera = Camera.main;
map.InputDelegate += UnitySlippyMap.Input.MapInput.BasicTouchAndKeyboard;
map.CurrentZoom = 16.0f;
//map.UpdatesCenterWithLocation = true; NOT WORKING
// Location
map.CenterWGS84 = new double[2] { 73.080740, 33.597513 };
map.UsesLocation = true;
map.InputsEnabled = true;
layers = new List<LayerBehaviour>();
// create an OSM tile layer
OSMTileLayer osmLayer = map.CreateLayer<OSMTileLayer>("OSM");
osmLayer.BaseURL = "http://a.tile.openstreetmap.org/";
layers.Add(osmLayer);
// create some test 2D markers
GameObject go = TileBehaviour.CreateTileTemplate(TileBehaviour.AnchorPoint.BottomCenter).gameObject;
go.GetComponent<Renderer>().material.mainTexture = MarkerTexture;
go.GetComponent<Renderer>().material.renderQueue = 4001;
go.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f);
go.transform.localScale /= 7.0f;
go.AddComponent<CameraFacingBillboard>().Axis = Vector3.up;
GameObject markerGO;
markerGO = Instantiate(go) as GameObject;
map.CreateMarker<MarkerBehaviour>("test marker 1", new double[2] { 73.080740, 33.597513 }, markerGO);
markerGO = Instantiate(go) as GameObject;
map.CreateMarker<MarkerBehaviour>("test marker 2", new double[2] { 73.080860, 33.597933 }, markerGO);
markerGO = Instantiate(go) as GameObject;
map.CreateMarker<MarkerBehaviour>("test marker 3", new double[2] { 73.080220, 33.597899 }, markerGO);
DestroyImmediate(go);
// create the location marker
go = TileBehaviour.CreateTileTemplate().gameObject;
go.GetComponent<Renderer>().material.mainTexture = LocationTexture;
go.GetComponent<Renderer>().material.renderQueue = 4000;
go.transform.localScale /= 27.0f;
markerGO = Instantiate(go) as GameObject;
map.SetLocationMarker<LocationMarkerBehaviour>(markerGO);
DestroyImmediate(go);
}
void OnApplicationQuit()
{
map = null;
}
// Update is called once per frame
void Update () {
}
I can't figure out why the location marker is not showing up. Any help would be much appreciated. Thanks.
using UnityEngine; using UnitySlippyMap.Map; using UnitySlippyMap.Layers; using UnitySlippyMap.Markers; using System.IO; using System.Collections; using System.Collections.Generic;
public class TileMap : MonoBehaviour {
}