- Home /
Question by
kemar · Jul 28, 2015 at 09:45 AM ·
collider2d
2d collider, scale, dynamic
Hi unity people,
I need to update my gameObject 2dBoxCollider when i change his sprite, i don't know how i can do that... Is there a way to do this?
Here a exemple of a method where i change the sprite.
private void inflated()
{
if (currentState != StateDiodon.inflate)
{
this.gameObject.GetComponent<SpriteRenderer>().sprite = inflatedSprite;
currentState = StateDiodon.inflate;
}
}
private void deflated()
{
if (currentState != StateDiodon.deflated)
{
this.gameObject.GetComponent<SpriteRenderer>().sprite = _deflatedSprite;
currentState = StateDiodon.deflated;
}
}
Thanks
Comment
Your answer
