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?

1 Answer

1

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/Manual/class-TextureImporter.html I'd like to attach a PolygonCollider2D dynamically anyway, but I would not be avoided that the Texture size is doubled?

I'm sorry but I don't understand.