Rotate the camera together with a marker

Back
Tags:
Tileset
Camera
Example of rotation of the camera together with a marker.
Requirement: Tileset Control
Allow Camera Control - ON
Usage instructions:
Add this script to map GameObject and start the scene.
When you rotate the marker, the camera will rotate in the opposite direction to the marker kept the original direction.
RotateMapInsteadMarkerExample.cs
/*         INFINITY CODE         */
/*   https://infinity-code.com   */

using UnityEngine;

namespace InfinityCode.OnlineMapsExamples
{
    /// <summary>
    /// Example of rotation of the camera together with a marker.
    /// </summary>
    [AddComponentMenu("Infinity Code/Online Maps/Examples (API Usage)/RotateMapInsteadMarkerExample")]
    public class RotateMapInsteadMarkerExample : MonoBehaviour
    {
        private OnlineMapsMarker marker;
        private OnlineMapsCameraOrbit cameraOrbit;

        private void Start()
        {
            cameraOrbit = OnlineMapsCameraOrbit.instance;

            // Create a new marker.
            marker = OnlineMapsMarkerManager.CreateItem(new Vector2(), "Player");

            // Subscribe to UpdateBefore event.
            OnlineMaps.instance.OnUpdateBefore += OnUpdateBefore;
        }

        private void OnUpdateBefore()
        {
            // Update camera rotation
            cameraOrbit.rotation = new Vector2(30, marker.rotation * 360);
        }
    }
}