Vectrosity Line Width Issue

Issue: Lines drawn using the Vectrosity plugin appear at different sizes depending on the size of the Unity Editor’s Scene Panel.

Environment: Windows 7 64-bit; Unity 3.5.2; Vectrosity 2.0.

Details: I create and draw a Vectrosity.VectorLine as follows:

float lineWidth = 12.0f;
VectorLine vectorLine = new VectorLine("Tongue", linePointsArray, color, material, lineWidth , LineType.Continuous, Joins.Weld);
vectorLine.Draw3D(drawSpaceTransform);

It works just fine, except that the lineWidth doesn’t take into account the resolution of the viewing area. This is illustrated in these images:

Pink Tongue is correct here:

Pink Tongue is too large here:

My thinking is that I can use Screen.currentResolution to dynamically change the width; however when resizing the Unity Editor Scene Panel, Screen.currentResolution is unaffected.

I’ve also searched through the Vectrosity documentation and have been unable to find clues there.

Thanks in advance for your help! :slight_smile:

The width of lines in Vectrosity is always measured in pixels. You can use Screen.width if you want to make the line width based on the resolution.

–Eric

Thanks for your reply!

To clarify: Both of the provided screenshots have the same Screen.width. The only difference between the two is that the Unity Game Panel has been resized to be much smaller in the bottom image; however Screen.width returns the same value during runtime regardless of Game Panel’s size. It would be ideal to see the tongue appear correctly in the editor regardless of the Game Panel size.

So I will refine my question to be: Is their a way to detect the Game Panel’s size via script during runtime?

Screen.width. There was at least one version of Unity where a bug made Screen.width return an incorrect value in the editor if used in Start, but that was fixed some time ago.

–Eric

Ohhh ok. Thank you very much sir. =)