Hello, i have been looking through google but nothing works, help please
i have car gameobject in hierarchy and it has Vehicle Controler.cs Standard Inputs.cs and Reset Car.cs components attached.
i made another gameobject and put as child of car gameobject.
i want to disable and enable Vehicle Controler.cs Standard Inputs.cs this guys but cant.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EnterCar : MonoBehaviour
{
public GameObject CarCam;
public GameObject ThePlayer;
public GameObject TheCar;
public int TriggerCheck;
public void OnTriggerEnter(Collider other)
{
TriggerCheck = 1;
}
public void OnTriggerExit(Collider other)
{
TriggerCheck = 0;
}
public void Update()
{
if (TriggerCheck == 1)
{
if (Input.GetButtonDown("Action"))
{
CarCam.SetActive(true);
ThePlayer.SetActive(false);
TheCar.GetComponent<VehicleController>().enabled = true; //not work
TheCar.GetComponent(VehiclePhysics).enabled = true; //not work
TheCar.GetComponent("VehiclePhysics").enabled = true; //not work
}
}
}
}