I am new to unity. Everything in my project was working fine till i started working on animation component of an game object. In preview animation is working correctly but as soon as i tick play automatically or if in any script playing the animation using GetComponent"<“Animation”>"().Play, the gameplay freezes and there is no mouse movement at all. Only zoom in and out in scene works. As soon as i remove the animation component or remove that part of script everything starts working again. don’t know where i am wrong?
I suggest you to use Animator Component instead of Animation component. Make a new animation state for this animation. Can you confirm that there is no Null reference exception error?
There could be a reference missing or you could be missing a default animation in your Animation component. can you please share the screenshot of your animation component.
Thanks for the response. Actually i started making animation for the gameobject using animation tab and by default it creates an Animator component. After doing that an animation was created successfully and in preview it was working fine but then suddenly game play freezes and even after removing the Animator component situation was same. After that i just added Animation component but then this play automatically problem arose. Then i removed every script and animation component from the project to debug. I was able to restore the game play and then step by step i added scrips and animation. All the scrips were fine but there was still some problem with the Animation or Animator. So i recreated another Animator component and deleted the old one. Now it works fine. But i still don’t know what was the problem with the earlier one. And there were no Null reference exception error at runtime in the earlier case also. For the moment Problem is solved with some extra amount of work and without any understanding , which is quite frustrating.