Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Lookat2DByScreen : MonoBehaviour
void Update ()
var pos = Camera.main.WorldToScreenPoint (transform.localPosition);
var rotation = Quaternion.LookRotation(Vector3.forward, Input.mousePosition - pos );
transform.localRotation = rotation;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment