Below is the code that is attached to the vehicle game object. So whenever the player goes inside a vehicle in this instance the camera target “cartarget” is set to the vehicle object the player enters.
Is there a way I can disable scripts of the gameobject the camera is only targetting? so the scripts of the “cartarget variable” object?
Wish to do something like below but only for the object the camera is targetting so other vehicles have same script so don’t want to activate/deactive scripts for other cars.
At the point where you tell the camera script to target a game object, you can use something like GetComponents() on that gameobject, then turn all those components off.
You may wish to look into interfaces for this, such that you have scripts that you WANT to turn off explicitly implement an interface, such that other scripts on the car that should NOT be turned off can choose to not implement that interface, then they will keep running.