all-iver / shapes2d

Shapes2D for Unity3D - Make simple art assets quickly in Unity
http://sub-c.org/Shapes2D/documentation/
MIT License
154 stars 28 forks source link

Incorrect scale of outlines and roundness, etc, when editing prefab in some cases #16

Open all-iver opened 3 years ago

all-iver commented 3 years ago

When editing a UI prefab in the scene, if you have a CanvasScaler or are using a ScreenSpace canvas with a Render Camera set, the shape's scale seems to be wrong in the prefab editing view. Using edit in isolation seems to do a bit better, and then you can provide a scene for Unity to use, but it's not a perfect solution. I believe Unity is using a world space canvas for prefab editing instead of using the canvas from the scene.

dyguests commented 3 years ago

Same probelm.

Case 1 will works fail:

  1. Instantiate a shape prefab in a Canvas(with scale 0.01)
  2. shape.SetPathWorldSegments
  3. then path is wrong,It looks 100 times magnified.

Case 2 will works fine:

  1. Instantiate a shape prefab in a Canvas(with scale 0.01)
  2. StartCoroutine and wait a frame.
  3. shape.SetPathWorldSegments
  4. then path is right.

Will the new version fix this problem? :(

all-iver commented 3 years ago

Same probelm.

Case 1 will works fail:

1. Instantiate a shape prefab in a Canvas(with scale 0.01)

2. shape.SetPathWorldSegments

3. then path is wrong,It looks 100 times magnified.

Case 2 will works fine:

1. Instantiate a shape prefab in a Canvas(with scale 0.01)

2. StartCoroutine and wait a frame.

3. shape.SetPathWorldSegments

4. then path is right.

Will the new version fix this problem? :(

Hey @dyguests, I think that's actually a different issue - this one is about in-editor and yours is at runtime. I did a test and I can see your results. If you run shape.Configure() right after instantiating and before SetPathWorldSegments(), does that fix it? I think the problem is that Configure() usually gets run from Start() but it hasn't run yet when you're trying to edit it.

Edit - made a new issue for this (#18)