🤑 Indie game store🙌 Free games😂 Fun games😨 Horror games
👷 Game development🎨 Assets📚 Comics
🎉 Sales🎁 Bundles

antares88

2
Posts
3
Following
A member registered 346 days ago

Recent community posts

With Camera.main it works like a charm :D

Thanks for the hint and for the asset!

Hey,
looks great but I'm experiencing an issue. I attached a Screenshake script to my Main Camera, and when there is an explosion ingame I call my gamecontroller, which invokes Camera.current.Shake();

On 2/3 of the explosions it works, but sometimes it doesn't and I get the following error:

NullReferenceException: Object reference not set to an instance of an object
ScreenshakeCameraExtentions.Shake (UnityEngine.Camera cam) (at Assets/Clavian/Screenshake/ScreenshakeCameraExtentions.cs:9)
GameController.Explosion () (at Assets/Scripts/GameController.cs:51)
DestroyByContact.OnTriggerEnter (UnityEngine.Collider other) (at Assets/Scripts/DestroyByContact.cs:34)

Line 9 of ScreenshakeCameraExtentions does this:

Screenshake shake = cam.transform.GetComponent<Screenshake>();

Any idea why it's failing to get the Screenshake component?