Unity is not recognising MonoBehaviour,Unity not recognising MonoBehaviour
I'm working on a procedural solar system visualisation, and I'm trying to make planets as prefabs, but when I try to save them, I get this error:
You are trying to replace or create a Prefab from the instance 'OrbitingBody' that contains the script 'orbit', which does not derive from MonoBehaviour.
This is my script (orbit.cs), could anyone point out to me what is wrong with it here?
public class orbit : MonoBehaviour
{
//Assign a GameObject in the Inspector to rotate around
public GameObject target;
public float orbitalRadius = 100f;
public Vector3 axis = Vector3.up;
public float orbitVel = 1f;
void Start()
{
Vector3 transforms = transform.position;
transforms.x = orbitalRadius;
transform.position = transforms;
}
void Update()
{
// Spin the object around the target at 20 degrees/second.
transform.RotateAround(target.transform.position, axis, orbitVel * Time.deltaTime);
}
}
,
Now, even when I create a completely blank script (add component -> new script) it says that monobehaviour is missing.
What am I doing wrong here?
Your answer
Follow this Question
Related Questions
prefab/instantiate problem. C#,Instanciate/Prefab problem. 0 Answers
Prefab works in one scene, but then not the other? 0 Answers
Instantiating A Prefab on my Character Troubles,Instantiating a Prefab 2 Answers
unity 2018.3 prefab overwriting issue 1 Answer
Can you configure prefabs in code? 0 Answers