I am new on unity and I am dealing with a problem. Unity doesn't run my c# scripts in any component and in any project. Although unity reads all the values from the script, it won't execute the game as expected. On the script components it shows that the scripts are disabled, as you can see on the following screenshot. I should probably mention that the game was working fine until this problem came from nowhere. I don't think that it's a problem from the script, because this happens even on completely empty scripts. This is the script component Empty c# script with the same problem. I have tried to reinstall unity 2 times(nothing happens). I have tried to reimport all the scripts(nothing happens). I have tried to reimport all the assets(nothing happens). Any help would be really appreciated. This is the whole scene
This is the whole script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[System.Serializable]
public class Boundary
{
public float xMin, xMax, zMin, zMax;
}
public class PlayerController : MonoBehaviour
{
public float speed;
public float tilt;
public Boundary boundary;
private Rigidbody rb;
void Start()
{
rb = GetComponent<Rigidbody>();
}
public GameObject shot;
public Transform shotSpawn;
public float fireRate;
private float nextFire;
void Update()
{
if (Input.GetButton("Fire1") && Time.time > nextFire)
{
nextFire = Time.time + fireRate;
Instantiate(shot, shotSpawn.position, shotSpawn.rotation);
GetComponent<AudioSource>().Play();
}
}
private void FixedUpdate()
{
float moveHorizontal = Input.GetAxis("Horizontal");
float moveVertical = Input.GetAxis("Vertical");
Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
rb.velocity = movement * speed;
rb.position = new Vector3
(
Mathf.Clamp(rb.position.x, boundary.xMin, boundary.xMax),
0.0f,
Mathf.Clamp(rb.position.z, boundary.zMin, boundary.zMax)
);
rb.rotation = Quaternion.Euler(0.0f, 0.0f, rb.velocity.x * -tilt);
}
}