コンソールエラーで5行目に ;
や {}
が不足してると書かれてると思うのですが、public classには必要ないはず。
どこに {}
をつけるのですか。
また、"Top level statement must precede namespace and type declarations." と書かれていますがどういう意味ですか。
試したこと
MonoBehaviour
の後に ;
を付けたらエラーが消えたので、{}
も5行目のいろんなところに試したけどエラーがついたまま。
コード
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Car controll: MonoBehaviour
{
float Speed = 0;
float LimitSpeed = 70f;
// Start is called before the first frame update
// Update is called once per frame
void FIxedUpdate()
{
Rigidbody rb = this.GetComponent<Rigidbody>();
Vector3 force = new Vector3(10f, 0.0f, 0.0f);
rb.AddForce(force, ForceMode.Force);
if (rb.velocity.magnitude > LimitSpeed)
{
rb.velocity = new Vector3(rb.velocity.x / 1.1f, rb.velocity.y, rb.velocity.z / 1.1f);
}
}
}