run game somthly

what are things we should consider to make the game run smoothly with good frame,What are the things we aviod in scripting and in game to make the game run smoother

That's one of those questions that can't be clearly answered since it depends on many things. However if your game runs too slow in the editor make sure you:

  • don't have a Debug.Log or print that is called every frame since it's horrible slow.
  • Avoid any search functions (FindGameObject, FindObjectOfType, ...) in Update or any other frequent running function.
  • If you have Unity pro, use the profiler to see what eats up the most cpu time.

On mobile devices:

  • keep the drawcalls low. Use shared textures and combine meshed if possible.
  • avoid creating / destroying objects (Instantiate() / Destroy()). Use object pools.
  • don't use the GUI system for heavy menus. Each GUI element will cause at least one drawcall.