in script when I type rigidbody it says it was unexpected. Why?

It’s possible that this is due to Unity 5’s changes in the GetComponent function. Where as formerly you could use short words to access Unit-specific components like RigidBodies (rigidbody), now it HAS to be GetComponent().

Probably because


was expected.