Quantcast
Channel: Questions in topic: "collider 2d"
Viewing all articles
Browse latest Browse all 148

updating collider when sprite changes

$
0
0
in my game i have a sprite that has animations the problem is that the polygon collider i have doesnt change when the sprite changes, from reading about i realized that id have to destroy and recreate the collider when sprite changes but im not 100% sure how id implement this, this is what i currently have void Update () { Destroy(gameObject.GetComponent()); gameObject.AddComponent(); } i need to some how get this to update when the sprite in the renderer changes, currently i have it where it changes every update but this is not very smooth and messes with my collisions

Viewing all articles
Browse latest Browse all 148

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>