Question by
Zeus104 · Jan 30, 2019 at 05:19 PM ·
scripting problemscript errorscriptingproblemscripterror
It won't let me use it on my character, and says it needs to derive from MonoBehaviour,It won't let me put this script onto my character, it says it needs to derive from MonoBehaviour
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class PlayerMobility : MonoBehaviour {
public float speed;
void FixedUpdate()
{
var MousePosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
Quaternion rot = Quaternion.LookRotation(transform.position - Input.mousePosition, Vector3.forward);
transfrom.rotation = rot;
}
}
Comment
Have you tried to :
Copy the content of the file
Delete the file
Create the file against
Paste the content of the previous file in it?
Answer by hameed-ullah-jan · Jan 31, 2019 at 05:51 AM
check the classname and script name, if they are same or not?