public GameObject arrow;
public float launchForce;
public Transform shotPoint;
if (Input.GetMouseButtonDown(0))
{
shoot();
}
private void shoot()
{
GameObject newArrow = Instantiate(arrow, shotPoint.position, shotPoint.rotation);
newArrow.GetComponent<Rigidbody2D>().velocity = transform.right * launchForce;
}
当我点击左键时,程序复制箭头,我可以在场景选项卡中看到它们,但在游戏选项卡中看不到它们。
如何在游戏选项卡中显示箭头?
即2D和箭头对象有Rigidbody2D Box Collider
.
如果您在场景选项卡中看到它们,则箭头也必须创建。我猜是位置设置不正确。你看过这个吗?