ผมใส่โค้ดเเล้ว Rigidbodyมันไม่ติดต้องทำยังไงครับ รบกวนผู้รู้ช่วยหน่อยนะครับผมพึ่งฝึกใช้ได้3วัน ขอบคุณครับ
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using UnityEngine;
public class contol : MonoBehaviour
{
public float jump;
Rigibody rb;
// Start is called before the first frame update
void Start()
{
rb = gameObject.GetCompanent<Rigidbody2D>
);
}
// Update is called once per frame
void Update()
{
if (input.GetButtonDown("Jump"))
{
rb.velocity = new Vector2(rb.velocity.x, jumpSpeed);
}
}
}
ใส่ Rigidbody เเล้วมันไม่ติดต้องทำยังไงครับ(จริงจัง)
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using UnityEngine;
public class contol : MonoBehaviour
{
public float jump;
Rigibody rb;
// Start is called before the first frame update
void Start()
{
rb = gameObject.GetCompanent<Rigidbody2D>);
}
// Update is called once per frame
void Update()
{
if (input.GetButtonDown("Jump"))
{
rb.velocity = new Vector2(rb.velocity.x, jumpSpeed);
}
}
}