<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Infinity Code Forum — uGUICustomMarkerEngineExample Crashing on Type Cast]]></title>
	<link rel="self" href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=349&amp;type=atom" />
	<updated>2016-12-28T17:37:34Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.infinity-code.com/viewtopic.php?id=349</id>
		<entry>
			<title type="html"><![CDATA[Re: uGUICustomMarkerEngineExample Crashing on Type Cast]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1586#p1586" />
			<content type="html"><![CDATA[<p>Hi Alex, </p><p>Thanks for the response. My issue was that the Prefab was not a UI Element. I have it working now!</p>]]></content>
			<author>
				<name><![CDATA[junctioniv]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=320</uri>
			</author>
			<updated>2016-12-28T17:37:34Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1586#p1586</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: uGUICustomMarkerEngineExample Crashing on Type Cast]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1554#p1554" />
			<content type="html"><![CDATA[<p>Hello</p><p>Using this example, you need to specify two fields:<br />Marker Container - GameObject, which will contain markers. It must be a Canvas or child GameObject.<br />Marker Prefab - UI element that will be drawn as a marker.</p><p>So there you have one of two problems:<br />Marker Container is not canvas or child GameObject.<br />Marker Prefab is not UI element.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2016-12-21T08:22:40Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1554#p1554</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[uGUICustomMarkerEngineExample Crashing on Type Cast]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1551#p1551" />
			<content type="html"><![CDATA[<p>I am trying to use the uGUICustomMarkerEngineExample but the script crashes from a null reference exception.&nbsp; In the AddMarkerAddMarker(double lng, double lat, string text) function the following code is causing this error:<br /></p><div class="codebox"><pre><code>public static uGUICustomMarkerExample AddMarker(double lng, double lat, string text)
{
     GameObject markerGameObject = Instantiate(_instance.markerPrefab) as GameObject;
     (markerGameObject.transform as RectTransform).SetParent(_instance.markerContainer);
     ...
}</code></pre></div><p>Casting markerGameObject.transform as RectTransform dynamically returns null and then calling .SetParent(...) on a null value crashed the script.</p><p>I tried attaching this script to the map object in the Demo Scene and set the markerPrefab and the markerContainer in the editor.<br />I also noted that markerGameObject.transform is a non-null Transform object prior to the cast. Is there any reason why this cast is returning null?</p><p>Tested this issue using Unity 5.4.1f1 and OnlineMaps versions 2.5.1.1 and 2.5.1.2</p>]]></content>
			<author>
				<name><![CDATA[junctioniv]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=320</uri>
			</author>
			<updated>2016-12-20T21:45:21Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1551#p1551</id>
		</entry>
</feed>
