Hello guys. I am getting the above error when I am playing my game. Everything works fine when I fire the bullets on my enemy but for some reason when the health bar on enemy gets depleted I get the error mentioned above. I have scene named 'Enemy' and within it I have instanced another scene named 'Health' which contains the ProgressBar with the Script. I have created a variable named 'hp' in Enemy Script but I m not sure that why things are not working out with the Life Bar. This is the what I am using to actually get the value of 'hp' in the value of Life Bar:
and this is my dead function in 'Enemy' Script :
As I mentioned earlier, for some reason when the health bar of my enemy is getting depleted I am getting the error invalid get instance 'hp' (on base: 'null instance') and my game freezes.