Online Maps does not know about Photon.
Photon does not know about Online Maps.
You need to fix this misunderstanding.
You can create GameObject or via Photon or via Online Maps.
Both methods have advantages and disadvantages.
Yes, of course you can make markers from existing GameObjects.
Example:
using UnityEngine;
public class CreateMarkerFromGameObject:MonoBehaviour
{
private GameObject sphere;
private void OnGUI()
{
if (sphere != null && GUILayout.Button("Create marker from sphere"))
{
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);
}
}
But, keep in mind that when Photon destroys GameObject, the marker will exist.
You will need to find and remove it.
Kind Regards,
Infinity Code Team.
Boost your productivity a lot and immediately using
Ultimate Editor Enhancer.
Trial and non-commerce versions available.