my code is
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class JumpScript: MonoBehaviour
{
// Start is called before the first frame update
IEnumerator Wait(){
yield return new WaitForSeconds (1);
}
void Start()
{}
public RigidBody rb;
// Update is called once per frame
void Update()
{
if (Input.GetKey("w")){
StartCoroutine(Wait());
}
}
}
my errors are Assets/JumpScript.cs(13,12): error CS0246: The type or namespace name 'RigidBody' could not be found (are you missing a using directive or an assembly reference?)
I'm trying to make a flappy bird sort of game as practice for unity + c#
You have capitalized "RigidBody" incorrectly, it should be "Rigidbody". Also, if you are working with 2D then you should be using "Rigidbody2D". Also, I am not 100% sure what your question here is, I assume you want help to just fix that error, so there you go, change public RigidBody rb;
to public Rigidbody2D rb;
(if you are making a 2D game you should be using Rigidbody2D).
it is Rigidbody
not RigidBody
you spell it incorrectly
if you are working with a 2D game you should use Rigidbody2D
not Rigidbody
and for 3D game, you must use Rigidbody
make sure you have imported using UnityEngine;
change public RigidBody rb;
to public Rigidbody rb;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.