Unity kod hatasını şöyle gösteriyor
Assets\Scrips\ArabaKontrol.cs(44,10): error CS0116: A namespace cannot directly contain members such as fields or methods
Buda Yazdığım Kod
`using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ArabaKontrol : MonoBehaviour
{
public WheelCollider onSolCol;
public WheelCollider onSagCol;
public WheelCollider arkaSolCol;
public WheelCollider arkaSagCol;
public GameObject onSol;
public GameObject onSag;
public GameObject arkaSol;
public GameObject arkaSag;
public float maxMotorGucu;
public float maxDonusAcisi;
public float motor;
void Start()
{
}
void Update()
{
}
private void FixedUpdate()
{
motor = maxMotorGucu * Input.GetAxis("Vertical");
float donus = maxDonusAcisi * Input.GetAxis("Horizontal");
onSolCol.steerAngle = onSagCol.steerAngle = donus;
arkaSagCol.motorTorque = motor;
arkaSolCol.motorTorque = motor;
SanalTeker();
}
}
void SanalTeker()
{
Quaternion rot;
Vector3 pos;
onSolCol.GetWorldPose(out pos, out rot);
onSol.transform.position = pos;
onSol.transform.position = rot;
Quaternion rot;
Vector3 pos;
onSagCol.GetWorldPose(out pos, out rot);
onSag.transform.position = pos;
onSag.transform.position = rot;
Quaternion rot;
Vector3 pos;
arkaSolCol.GetWorldPose(out pos, out rot);
arkaSol.transform.position = pos;
arkaSol.transform.position = rot;
Quaternion rot;
Vector3 pos;
arkaSagCol.GetWorldPose(out pos, out rot);
arkaSag.transform.position = pos;
arkaSag.transform.position = rot;
}
`