Skip to content

Instantly share code, notes, and snippets.

@AngryAnt
Created May 30, 2011 14:02
Show Gist options
  • Select an option

  • Save AngryAnt/998938 to your computer and use it in GitHub Desktop.

Select an option

Save AngryAnt/998938 to your computer and use it in GitHub Desktop.
Explicit property type
// This:
public Rigidbody target;
void FixedUpdate ()
{
target.AddForce (transform.forward * 1.0f);
}
// Over this:
public GameObject targetGO;
private Rigidbody target;
void Start ()
{
target = targetGO.GetComponent<Rigidbody> ();
}
void FixedUpdate ()
{
target.AddForce (transform.forward * 1.0f);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment