hey i’ve done some scripting i think in c# on unity and when i click play it comes up with this message
‘error CS0246: The type or namespace name `MonoBehaviour’ could not be found. Are you missing a using directive or an assembly reference?’
this is my script
public class AI_script : MonoBehaviour {
if anyone could help that would be cool
Add the following to the top of the .cs file:
using UnityEngine;
1 Like
hey thanks for before but i’m having some more Errors
when i clck play it comes up with this
Look rotation viewing is zero
UnityEngine.Quaternion:LookRotation(Vecter3,Vecter3)
Look rotation viewing vector is zero
UnityEngine.Quaternion:LookRotation(Vector3, Vector3)
UnityEngine.Quaternion:LookRotation(Vector3, Vector3)
UnityEngine.Quaternion:LookRotation(Vector3)
AI_script:ProcessMovement() (at Assets\scripts\AI_script.cs:66)
AI_script:Update() (at Assets\scripts\AI_script.cs:29)
[…..\Runtime\Export\Generated\Math.cpp line 39]
here is the script
‘transform.rotation = Quaternion.LookRotation(inputRotation);’
and these two things
Assets/scripts/AI_script.cs(65,31): error CS0120: `UnityEngine.Rigidbody.AddForce(UnityEngine.Vector3)': An object reference is required for the nonstatic field, method or property
Assets/scripts/AI_script.cs(65,31): error CS0120: `UnityEngine.Rigidbody.AddForce(UnityEngine.Vector3, UnityEngine.ForceMode)': An object reference is required for the nonstatic field, method or property
‘rigidbody.AddForce (inputMovement.normalized * moveSpeed * Time.deltaTime);’
if any help thanks
It looks like you are passing a zero vector (possibly uninitialised) to Quaternion.LookRotation. Where are you getting the value that you pass?
Is there any chance you could post the whole script, or at least the lines referred to in the error messages? It’s not really possible to say exactly what is wrong without the context in which the error occurred.