A "GameCamera 2D" camera type follows the player character by default, but it can be made to follow the cursor instead with a simple script.
- Create a C# script named FollowCursor.cs, and paste the contents of the script below into it
- Create a new GameObject in your scene named "CursorReference"
- Attach the new FollowCursor component to the CursorReference GameObject
- In your GameCamera 2D, uncheck Target is Player? and assign CursorReference in the new Target field
FollowCursor.cs:
using UnityEngine;
using System.Collections;
using AC;
public class FollowCursor : MonoBehaviour
{
private void Update ()
{
Vector3 mouseWorldPosition = Camera.main.ScreenToWorldPoint (Input.mousePosition);
mouseWorldPosition.z = 0f;
transform.position = mouseWorldPosition;
}
}