Main camera returning null from Health script

For some reason while trying to do the camera shake I noticed I’m getting a null ref. the whole
cameraShake = Camera.mainCamera.GetComponent();
Is just not working when I try to call the cameraShake.Play(): function

If that’s the actual code, then that’s the problem. It should be Camera.main.GetComponent(). Although I think that will give an exception. What is the actual code?

You know what…I found the problem. It was head slamming into wall worthy.
I had it under
void awake()
I typed a lowercase a in the function and I kept glazing over it.

Thanks anyhow XD

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms