unity rigid body variable
Code Example - unity rigid body variable
public Rigidbody rigidbody;
get rigidbody component unity
//The Variable
Rigibody rb;
void Start()
{
rb = GetComponent<Rigidbody>();
}
unity get rigidbody
//The Variable
Rigibody rb;
void Start()
{
rb = GetComponent<Rigidbody>();
}
how to add reference to rigidbody 2d
public Rigidbody2D rb;
rigidbody2d unity
Rigidbody2D rb;
// Can use Awake
void Start()
{
// Ataches the rigedbody that is on the gameObject to rb
rb = GetComponent<Rigidbody2D>();
}