<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Infinity Code Forum — sharing markers with PUN]]></title>
		<link>https://forum.infinity-code.com/viewtopic.php?id=617</link>
		<atom:link href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=617&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in sharing markers with PUN.]]></description>
		<lastBuildDate>Wed, 02 Aug 2017 18:30:05 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: sharing markers with PUN]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=2678#p2678</link>
			<description><![CDATA[<p>Online Maps does not know about Photon.<br />Photon does not know about Online Maps.<br />You need to fix this misunderstanding.</p><p>You can create GameObject or via Photon or via Online Maps.<br />Both methods have advantages and disadvantages.</p><p>Yes, of course you can make markers from existing GameObjects.<br />Example:<br /></p><div class="codebox"><pre><code>using UnityEngine;

public class CreateMarkerFromGameObject:MonoBehaviour
{
    private GameObject sphere;

    private void OnGUI()
    {
        if (sphere != null &amp;&amp; GUILayout.Button(&quot;Create marker from sphere&quot;))
        {
            float scale = sphere.transform.localScale.x;

            OnlineMapsMarker3D marker = new OnlineMapsMarker3D(sphere);
            sphere.transform.parent = OnlineMaps.instance.transform;
            double lng, lat;
            OnlineMapsTileSetControl.instance.GetCoordsByWorldPosition(out lng, out lat, sphere.transform.position);
            marker.SetPosition(lng, lat);
            marker.scale = scale;
            OnlineMapsControlBase3D.instance.AddMarker3D(marker);
            marker.Update();

            sphere = null;
        }
    }

    private void Start()
    {
        sphere = GameObject.CreatePrimitive(PrimitiveType.Sphere);
        sphere.transform.position = OnlineMapsTileSetControl.instance.GetWorldPosition(OnlineMaps.instance.position);
        sphere.transform.localScale = new Vector3(50, 50, 50);
    }
}</code></pre></div><p>But, keep in mind that when Photon destroys GameObject, the marker will exist.<br />You will need to find and remove it.</p>]]></description>
			<author><![CDATA[null@example.com (Alex Vertax)]]></author>
			<pubDate>Wed, 02 Aug 2017 18:30:05 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=2678#p2678</guid>
		</item>
		<item>
			<title><![CDATA[sharing markers with PUN]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=2673#p2673</link>
			<description><![CDATA[<p>Trying to think of correct approach for creating/sharing OnlineMaps markers via Photon networking or similar.</p><p>At the moment I am using Photon.Instantiate to create the prefab/resource over the network. Of course OnlineMaps doesn&#039;t know about this instance of gameobject at this point. Can we dynamically create a marker and assign the already instantiated gameobject (which will happen on each client) ?</p><p>I didn&#039;t use OnlineMaps to instantiate a prefab, as I thought Photon must do it.</p><p>Otherwise do I need to create a marker in OnlineMaps, and at same time Photon.instantiate&nbsp; a separate object to handle network side of things, and link/sync both together manually somehow?</p>]]></description>
			<author><![CDATA[null@example.com (braden)]]></author>
			<pubDate>Wed, 02 Aug 2017 13:52:25 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=2673#p2673</guid>
		</item>
	</channel>
</rss>
