0

コンソールエラーで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);
        }
    }
}

1 件の回答 1

2

クラス名に余計な空白が含まれています。

public class Car controll
                ^

この質問に回答するには、ログインする必要があります。

求めていた回答ではありませんか? のタグが付いた他の質問を参照する。