- Home /
How to be dynamically attached to the PolygonCollider2D in on iOS
Type = Advanced, Read / Write Enabled = true importer setting of Texture in order in the iOS on the GameObject that contains the SpriteRenderer, if it were allowed to attach PolygonCollider2D dynamically, to Collider along the shape of the Sprite is there a way to other than the?
Answer by smoggach · Sep 23, 2014 at 12:58 PM
You can do this dynamically as long as your sprite renderer has a sprite. Simply call AddComponent() and it will use the correct mesh.
Thank you for me to answer.
I'm sorry, it was not enough explanation.
It is thought at the time that is not limited to iOS, to attach dynamically PolygonCollider2D, Texture2D.GetPixels () is called.
This method, I knew that there is a need to and "Type = Advanced" and "Read / Write Enabled = true" import settings of the Texture of the subject, but to write the manual Then Texture size is doubled There was.
*http://docs.unity3d.com/$$anonymous$$anual/class-TextureImporter.html*
I'd like to attach a PolygonCollider2D dynamically anyway, but I would not be avoided that the Texture size is doubled?
Your answer
Follow this Question
Related Questions
Mesh collider cost 1 Answer
Polygon Collider Auto-Created Edges Causing Problems 1 Answer
PolygonColliders act different on a build 2 Answers
Dynamically Created Edge Collider Woes 0 Answers
Tile-based approach in Unity 1 Answer