<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Infinity Code Forum — Created Marker Not Auto Moving]]></title>
	<link rel="self" href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=1752&amp;type=atom" />
	<updated>2021-04-16T09:50:20Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.infinity-code.com/viewtopic.php?id=1752</id>
		<entry>
			<title type="html"><![CDATA[Re: Created Marker Not Auto Moving]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=7385#p7385" />
			<content type="html"><![CDATA[<p>Your code looks good and I don&#039;t see any obvious problem here.</p><p>OnLocationChanged is called when your GPS location or location in GPS emulation has changed.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2021-04-16T09:50:20Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=7385#p7385</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Created Marker Not Auto Moving]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=7384#p7384" />
			<content type="html"><![CDATA[<p>Alex,</p><p>As per your suggestion, I created a specific set of Map variables and assigned the Map GO to them:</p><p>&nbsp; &nbsp; [Header(&quot;Online Maps Vars&quot;)]<br />&nbsp; &nbsp; public OnlineMaps onlineMaps;<br />&nbsp; &nbsp; public OnlineMapsControlBase onlineMapsControlBase;<br />&nbsp; &nbsp; public OnlineMapsCameraOrbit onlineMapsCameraOrbit;<br />&nbsp; &nbsp; public OnlineMapsBuildings onlineMapsBuildings;<br />&nbsp; &nbsp; public OnlineMapsProvider onlineMapsProvider;<br />&nbsp; &nbsp; public OnlineMapsLocationService onlineMapsLocationService;<br />&nbsp; &nbsp; public OnlineMapsMarkerManager onlineMapsMarkerManager;<br />&nbsp; &nbsp; public OnlineMapsMarkerBase onlineMapsMarkerBase;</p><br /><p>In my manage marker script, I declared the marker:</p><p>&nbsp; &nbsp; private OnlineMapsMarker userMarker;</p><p>Then in the same script I create the marker in the Start method but it does not allow me to use the variable I created for the OnlineMapsMarkerManager so I&#039;m not sure if that causes and issues and one of the reasons the marker is not auto moving:</p><br /><p>&nbsp; &nbsp; private void Start()<br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; // Create a new marker.<br />&nbsp; &nbsp; &nbsp; &nbsp; userMarker = OnlineMapsMarkerManager.CreateItem(new Vector2(0, 0), null, &quot;Your Location&quot;);</p><p>&nbsp; &nbsp; &nbsp; &nbsp; // Get instance of LocationService.<br />&nbsp; &nbsp; &nbsp; &nbsp; //OnlineMapsLocationService locationService = OnlineMapsLocationService.instance;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; if (GlobalVariables.Instance.onlineMapsLocationService == null)<br />&nbsp; &nbsp; &nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Debug.LogError(<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;Location Service not found.\nAdd Location Service Component (Component / Infinity Code / Online Maps / Plugins / Location Service).&quot;);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return;<br />&nbsp; &nbsp; &nbsp; &nbsp; }</p><p>&nbsp; &nbsp; &nbsp; &nbsp; // Subscribe to the change location event.<br />&nbsp; &nbsp; &nbsp; &nbsp; GlobalVariables.Instance.onlineMapsLocationService.OnLocationChanged += OnLocationChanged;<br />&nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; }</p><p>&nbsp; &nbsp; <br />&nbsp; &nbsp; <br />&nbsp; &nbsp; // Get Loc info when the location has changed<br />&nbsp; &nbsp; private void OnLocationChanged(Vector2 position)<br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; // Change the position of the marker.<br />&nbsp; &nbsp; &nbsp; &nbsp; userMarker.position = position;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; // Redraw map.<br />&nbsp; &nbsp; &nbsp; &nbsp; GlobalVariables.Instance.onlineMaps.Redraw();<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; }</p><br /><p>Does the OnLocationChanged always get called or do I need something in an Update method?</p>]]></content>
			<author>
				<name><![CDATA[AppFreak]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=708</uri>
			</author>
			<updated>2021-04-15T23:49:31Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=7384#p7384</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Created Marker Not Auto Moving]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=7374#p7374" />
			<content type="html"><![CDATA[<p>I&#039;m making a few changes based on your initial comments and changing to a UIRawImage map since I am putting it on top of a map.</p><p>I&#039;ll let you know either way and send you a copy if I can&#039;t work it out.</p><p>Thanks!</p>]]></content>
			<author>
				<name><![CDATA[AppFreak]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=708</uri>
			</author>
			<updated>2021-04-12T16:36:24Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=7374#p7374</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Created Marker Not Auto Moving]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=7373#p7373" />
			<content type="html"><![CDATA[<p>Your code looks correct, so unfortunately I don&#039;t know what exactly is wrong.<br />You need to debug this.<br />Or you can email me your project (support@infinity-code.com) and I&#039;ll debug it for you.<br />To make it clear:<br />I don&#039;t need your working project.<br />I need any temporary project where the problem is appears.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2021-04-12T16:07:39Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=7373#p7373</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Created Marker Not Auto Moving]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=7372#p7372" />
			<content type="html"><![CDATA[<p>Alex Thanks for the reply. To be clear, the mini map is the only map in the scene. It overlays a UI Canvas and is looked at with a separate camera. I&#039;m using the OnlineMaps instance in all script references.</p>]]></content>
			<author>
				<name><![CDATA[AppFreak]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=708</uri>
			</author>
			<updated>2021-04-12T15:07:25Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=7372#p7372</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Created Marker Not Auto Moving]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=7371#p7371" />
			<content type="html"><![CDATA[<p>Hello.</p><p>There can be a lot of problems here, for example your marker is on the first map and OnlineMaps.instance is referring to the second map, the method is not called for some reason, or the same position is passed.</p><p>You need to make sure that your method is called and that all objects are referenced correctly.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2021-04-12T14:33:14Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=7371#p7371</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Created Marker Not Auto Moving]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=7367#p7367" />
			<content type="html"><![CDATA[<p>I have a small mini map in my app and created a marker on it:</p><p>userMarker = OnlineMapsMarkerManager.CreateItem(new Vector2(0, 0), null, &quot;Your Location&quot;);</p><p>My problem is, the marker doesn&#039;t change position on the map. I have location services on and it does initially find my location.</p><p>I subscribed to OnLocationChanged:</p><p>locationService.OnLocationChanged += OnLocationChanged;</p><p>private void OnLocationChanged(Vector2 position)<br />{<br />&nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; // Change the position of the marker.<br />&nbsp; &nbsp; userMarker.position = position;<br />&nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; // Redraw map.<br />&nbsp; &nbsp; OnlineMaps.instance.Redraw();<br />&nbsp; &nbsp; <br />}</p><br /><p>Under Location Services on the Map GO I have set:</p><p>* Update Map Position [Checked]<br />* Auto Stop on Input [UnChecked]<br />* Restore After [5 sec]<br />* Create Marker [UnChecked]</p><p>Any ideas?</p>]]></content>
			<author>
				<name><![CDATA[AppFreak]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=708</uri>
			</author>
			<updated>2021-04-12T02:56:11Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=7367#p7367</id>
		</entry>
</feed>
