I have a fairly complex polygon generated by an external tool. I’d like to use this polygon as a PolygonCollider2D path.
At the moment I put a binary representation of the polygon in a .bytes file in the Resources folder and set it up at runtime. Specifically I call SetPath() on the PolygonCollider2D component from the Awake() method of an attached script, and pass it an array of Vector2 that I’ve loaded from the resource.
While this does work, it feels like there should be a better way to do this. The polygon shape is known at build time, so doing this runtime processing is a waste. But I can’t find a way to load the vertices into the PolygonComponent2D directly in the editor. The path is read-only in the inspector. Does anyone know if there’s a way to do what I’m intending?