Guys i have 2 codes cameraswitch and carcontroller. cameraswitch is attached to State-Driven just for switching the camera. but this input action feature somehow doesnt let function change a variable that from other scripts. when i play, i get this error :“NullReferenceException while executing ‘performed’ callbacks of ‘Bin[/Keyboard/f,/Keyboard1/f]’
UnityEngine.InputSystem.LowLevel.NativeInputRuntime/<>c__DisplayClass7_0:<set_onUpdate>b__0 (UnityEngineInternal.Input.NativeInputUpdateType,UnityEngineInternal.Input.NativeInputEventBuffer*)
UnityEngineInternal.Input.NativeInputSystem:NotifyUpdate (UnityEngineInternal.Input.NativeInputUpdateType,intptr)”
this code for action:
“binAction.performed +=_=> BindToDriverSeat();”
this is the function:
"public void BindToDriverSeat()
{
if(!surucuVar){// Sürücü koltuğuna bindir
enetoInstance = Instantiate(enetoPrefab,driverSeat.transform);
//araba düğmeleri aktifleştir
ArabaKontrolPaneli.SetActive(true);
enetoInstance.SetActive(true);
//karakter düğmelerini kapat
Player.SetActive(false);
oyuncuScript.GetComponent<ThirdPersonController>().enabled = false;
//arabada surucu olduğunu belirtsin
surucuVar = true;
kamera.camReady = true; (this is the reason of the error)
}"
it does all these actions till the kamera.camReady = true; when i remove it, error gone. but when i write it, it gives me an error. İ tried to move that code to the up and this time again same error and function didnt work entirely. not just this. whenever i try to trigger a function which changes something in another script, it does same error. also i ve tried to create input map but it also didnt work. btw camReady variable is “public”. my plan was just like player get close to the car and trigger f button and then camera switch