簡體   English   中英

統一中找不到類型或命名空間名稱“Rigidbody2d”錯誤

[英]The type or namespace name 'Rigidbody2d' could not be found error in unity

我正在嘗試在 unity2d 中創建一個簡單的跳轉腳本。 (我是 c# 的新手)並且它說找不到 Rigidbody2d。 我有正確的拼寫和大寫字母。

using System.Collections;
using System.Collections.Generic;
 using UnityEngine;

 public class Jump : MonoBehaviour
{
  float jump;
  private Rigidbody2d rb;
  public float jumpHeight;

// Start is called before the first frame update
void Start()
{
    rb = GetComponent<Rigidbody2d>();
}

// Update is called once per frame
void Update()
{
    jump = Input.GetAxisRaw("Vertical");
    if(Input.GetKeyDown(KeyCode=Space))
    {
        rb.velocity = new Vector2(0, jump * jumpHeight);
    }
}

}`

我有正確的拼寫和大寫字母

C# 區分大小寫,它是Rigidbody2D

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM