Skip to content

Instantly share code, notes, and snippets.

@ThinhHB
Created June 1, 2016 06:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ThinhHB/b8d199590884fc4b2ae28b0e3d89ecd3 to your computer and use it in GitHub Desktop.
Save ThinhHB/b8d199590884fc4b2ae28b0e3d89ecd3 to your computer and use it in GitHub Desktop.
// DO
Rigidbody _myRigidbody;
Transform _myTransform;
void Awake()
{
_myRigidbody = GetComponent<Rigidbody>();
_myTransform = transform;
}
void Update()
{
_rigidbody.velocity = ...
_myTransform.position = ...
}
// DONT
void Update()
{
GetComponent<Rigidbody>().AddForce()...
transform.position = ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment