Search Unity

Vectrosity - Fast and Easy Line Drawing

Discussion in 'Assets and Asset Store' started by Eric5h5, Sep 26, 2014.

  1. Ghopper21

    Ghopper21

    Joined:
    Aug 24, 2012
    Posts:
    170
    I'm using VectorManager.ObjectSetup to draw shapes in my scene and it's working great. I set the width by passing the width parameter to the VectorLine constructor, with this VectorLine passed to ObjectSetup.

    I'd like to make it so that the line width draws entirely "inside" the shape, rather than both inside and outside the shape, i.e. half of width of the line inside and half of the width outside. Is this possible? If so, how? Thanks!
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,208
    You could try having the points making up the line be slightly scaled down from the original shape.

    --Eric
     
    Ghopper21 likes this.
  3. rahuxx

    rahuxx

    Joined:
    May 8, 2009
    Posts:
    537
    Can you provide one example of this?
     
  4. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,208
    Use SetColor in a loop.

    --Eric
     
  5. Ghopper21

    Ghopper21

    Joined:
    Aug 24, 2012
    Posts:
    170
    Thanks for the previous answer, Eric.

    Now I'm having a problem with VectorManager.ObjectSetup where the material is not showing up correctly.

    Here's my code:

    Code (CSharp):
    1.  
    2.         void DrawOutline( float width, Material material )
    3.         {
    4.             if ( outline != null )
    5.             {
    6.                 Destroy( outline );
    7.             }
    8.  
    9.             if ( width <= 0f || material == null )
    10.             {
    11.                 return;
    12.             }
    13.  
    14.             outline = new GameObject( "Outline" );
    15.             outline.transform.SetParent( transform );
    16.             outline.transform.localScale = Vector3.one;
    17.             outline.transform.localPosition = Vector3.zero;
    18.             outline.transform.localRotation = Quaternion.identity;
    19.  
    20.             var lineName = string.Format( "Outline: {0} -- {1}", Ikon.name, this.name );
    21.             var vectorLine = new VectorLine( lineName, OutlinePoints, width, LineType.Continuous, Joins.Weld );
    22.             vectorLine.material = material;
    23.             VectorManager.ObjectSetup( outline, vectorLine, Visibility.Dynamic, Brightness.Fog );
    24.         }
    25.  
    The `OutlinePoints` above are points using local positions. I want the `outline` game object to be a child game object.

    I'm using width = 2f.

    Here's the material I'm passing in and using for the VectorLine.



    Here's what's showing up:



    See the line around the central dark blue triangle? That's the vector line being created as a child game object of the triangle. The shape and size are correct.

    But the material isn't. Instead of using the material along the length of the line, it seems to have rotated the material and tiled it, thus the dashed line effect.

    Can you help me figure out what's going on? Thanks!
     
  6. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,208
    It looks to me more like it's slightly bigger than the triangle, and it's the result of pixel artifacts. In any case, directly manipulating VectorLine transforms generally interferes with Vectrosity, and I discourage anyone from doing that. Instead use VectorLine.drawTransform.

    --Eric
     
  7. Ghopper21

    Ghopper21

    Joined:
    Aug 24, 2012
    Posts:
    170
    Thanks for the quick reply Eric. I don't see where I'm directly manipulating the VectorLine transform -- or do you mean because I'm using ObjectSetup on a child game object? Sorry, not understanding...
     
  8. Ghopper21

    Ghopper21

    Joined:
    Aug 24, 2012
    Posts:
    170
    I changed the points passed to the VectorLine constructor back to world points, then did

    vectorLine.drawTransform = transform

    The shape is no longer in the right place, but I assume that's because my transforms are off somehow.

    Visually, this is what I get (a different shape obviously, but same material):



    Seems like the same problem with the texture.
     
  9. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,208
    Sorry, I misread your code; you're not directly manipulating the VectorLine transform. As for the texture, it's too hard to tell when it's that thin. Try making it much wider just for the sake of figuring things out.

    --Eric
     
  10. Ghopper21

    Ghopper21

    Joined:
    Aug 24, 2012
    Posts:
    170
    Ack -- that was it. Making it (much) thicker gave the expected result. In case you are wondering why I didn't try that first -- it was because I had the same width that looked fine at the same width but with a different material/shader, and I wrongly assumed the width scale would be the same for this material/shader.

    Thanks again for the quick help.
     
  11. Ghopper21

    Ghopper21

    Joined:
    Aug 24, 2012
    Posts:
    170
    A new question.

    With the ObjectSetup above (with Visibility.Dynamic and Brightness.None), the width of the line doesn't adjust when the camera zooms in and out. For instance with camera closer:



    And camera further away, with no other changes:



    Clearly the widths of the vector lines are not scaling. Is this the intended behavior -- as opposed to the widths of the lines adjusting as with the positions based on the camera?
     
  12. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,208
    Yes, see some of the posts above. Line width is measured in pixels.

    --Eric
     
  13. Ippokratis

    Ippokratis

    Joined:
    Oct 13, 2008
    Posts:
    1,519
    Hi Eric,
    I am starting a new project that uses Vectrosity.
    I need a way to create curves in a vector program (e.g inkscape) and import them into Vectrosity.
    The curves are similar to this link
    http://clinicalgate.com/wp-content/uploads/2015/02/B9780323066129000043_f04-15-9780323066129.jpg
    Creating a svg parser seems difficult at this point. Is there some ready solution that covers this specific user case ?
    If not, do you have any suggestion that might work as a shortcut ?
    Kind regards,
    -Ippokratis
     
  14. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,208
    I don't know of any solution or shortcuts, sorry.

    --Eric
     
  15. Ippokratis

    Ippokratis

    Joined:
    Oct 13, 2008
    Posts:
    1,519
    Ok, I have a small hack :

    -Created a curve, saved as svg.
    svg.png
    - In blender, imported svg, renders correctly.
    - Alt-c convert curve to mesh.
    - Save as blend, import in Unity, sees it as a mesh, does not render ( anticipated ).
    - The vertices of the mesh can now be used as a points array.

    verts.png
    It is ok for the curves I want to convert.

    Kind regards,
    -Ippokratis
     
  16. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,208
    Good idea; I didn't realize Blender could import SVG files.

    --Eric
     
  17. Xorxor

    Xorxor

    Joined:
    Oct 15, 2014
    Posts:
    24
    I'm trying to add points to a line with custom widths, but when I set the width of a given point it is overwritten in the next frame:

    void LateUpdate()
    {
    line.points3.Add(lineSource.transform.position);
    line.SetWidth(Random.Range(4f, 20f), line.points3.Count - 1);
    line.Draw();
    }

    Any ideas on how to make the width I set permanent? Thanks!
     
  18. Xorxor

    Xorxor

    Joined:
    Oct 15, 2014
    Posts:
    24
    Setting the current color seems to be permanent:

    line.points3.Add(lineSource.transform.position);
    int index = line.points3.Count - 10;
    line.SetWidth(Random.Range(4f, 20f), index);
    line.SetColor(Random.ColorHSV(hueMin: 0.4f, hueMax: 0.6f), index);
    line.Draw();
     
  19. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,208
    The line segment widths aren't kept when resizing a line. The reason the colors are is because they're stored in the vertex colors of the mesh. I'd suggest keeping a list of line segment widths, and applying that with SetWidths after adding points.

    --Eric
     
  20. Xorxor

    Xorxor

    Joined:
    Oct 15, 2014
    Posts:
    24
    Ok. Thanks Eric.
     
  21. Xorxor

    Xorxor

    Joined:
    Oct 15, 2014
    Posts:
    24
    Is there an efficient way to draw the same line two or more times with a different transform applied each time?
     
  22. Xorxor

    Xorxor

    Joined:
    Oct 15, 2014
    Posts:
    24
    Here's what I'm doing now. Any way to improve this off the top of your head?

    Code (csharp):
    1.  
    2. void Start () {
    3.         // Create new lines
    4.         line0 = new VectorLine("Line", new List<Vector3>(), lineTexture, lineWidth, LineType.Continuous, Joins.Fill);
    5.         line1 = new VectorLine("Line", new List<Vector3>(), lineTexture, lineWidth, LineType.Continuous, Joins.Fill);
    6.        
    7.         line0.material = lineMaterial;
    8.         line1.material = lineMaterial;
    9.  
    10.         GameObject g1 = new GameObject("Line Transform");
    11.         g1.transform.Rotate(new Vector3(0f, 90f, 0f));
    12.         line1.drawTransform = g1.transform;
    13. }
    14.  
    15. void LateUpdate () {
    16.         line0.points3.Clear();
    17.         for (int i = 0; i < 512; i++)
    18.         {
    19.             line0.points3.Add(new Vector3(data[i], i/512, 0f));
    20.         }
    21.         line0.Draw3D();
    22.  
    23.         line1.points3 = line0.points3;
    24.         line1.Draw3D();
    25. }
    26.  
     
  23. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,208
    If there are always 512 points, then instead of clearing and re-adding points, just assign them. Also you need to use floating-point for the Y coordinate math to work correctly, since otherwise the result will always be 0.

    Code (csharp):
    1. line0.points3[i] = new Vector3(data[i], i/512.0f, 0f);
    --Eric
     
  24. Twig314159

    Twig314159

    Joined:
    Mar 18, 2013
    Posts:
    2
    What kind of performance should I be seeing with Vectrosity?

    At the moment, I have a bunch of game objects, each game object has a VectorLine associated with it. Each VectorLine is composed of 5 points. Here's a snippet:

    Code (CSharp):
    1. mVectorLine = new VectorLine( "Box2D", points.ToList(), 1.0f, LineType.Continuous );
    2. VectorManager.ObjectSetup( gameObject, mVectorLine, Visibility.Always, Brightness.None, false );
    When I have about 300 of these game objects (and 300 corresponding VectorLines) I get a framerate around 40. The Unity profiler says that about 30% of my frame time is spent within VectorLine.Draw.

    Ideally I'd like my game to be able to support hundreds, if not close to a 1000 objects, each drawn with a VectorLine. Is that too much for Vectrosity? Do you have any suggestions for increasing performance?

    Thanks,
    Twig
     
  25. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,208
    I instantiated a 20 x 20 grid of the bouncy cube from the Simple3DObject demo (which is 24 points), so 400 objects total. The profiler says 2.7ms for drawing, 1.3ms for canvas rendering, and a total of about another 1ms for physics and stuff, which comes out to around 5ms or ~200fps. Doing a 32 x 32 grid for 1024 objects uses a total of 13ms, or 77fps. What sort of CPU are you using? Note that having many separate objects is not great for performance (in general); ideally you would have as few lines as possible, even if the total number of points is the same. For example, 1024 objects x 24 points = 24,576 points. As mentioned, that was 13ms. But if I do two objects of 16,000 points each, for 32,000 points, it's 7ms. So that's actually quite a few more points but almost half the time.

    --Eric
     
  26. Twig314159

    Twig314159

    Joined:
    Mar 18, 2013
    Posts:
    2
    So, I tried the same thing you did: A 20x20 grid of bouncy cubes in the Simple3DObject demo. I get a total frame time of about 21.9 ms, for a framerate ~45fps.

    As for my CPU, my machine is more than 5 years old at this point, so it's definitely dated. :) It's an Intel Core 2 Quad CPU 2.8 GHz.

    During gameplay I'll definitely be able to merge lines so I don't have quite so many different objects. I was doing some testing because I wanted to get an idea of what my worst case scenario looked like.

    Thanks for your input!
    Twig
     
  27. dob449

    dob449

    Joined:
    Oct 24, 2015
    Posts:
    2
    I rewrote the SelectionBox2 example into C sharp in the Vectrosity demos package and it worked fine.

    Then I tried running the same code in the project I want to use Vectrosity in but when I run it, rather than showing the animated selection box with a dashed line, the box just has a solid line. I did of course copy over the same texture file (dash.psd) to the other project, and dragged in the texture so it can be accessed from the script.

    I have this as a separate scene in the new project - and I have tried everything I can think of but have had no success. Is there some setting somewhere that could be causing this?

    Thanks

    dob
     
    Last edited: Jun 12, 2016
  28. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,208
    Not that I know of. Try creating a package with the required elements rather than copying over files.

    --Eric
     
  29. dob449

    dob449

    Joined:
    Oct 24, 2015
    Posts:
    2
    I think I have the required elements.

    Steps taken:
    -Created a new Unity project (2D)
    -Imported the source package, Vectrosity5Source
    -Created new scene
    -Copied over the script and the texture to the Asset folder
    -Dragged the dash.psd texture over to the script variable
    Result:
    Draws a square with dashed line as required.

    Then I did the same steps with my existing project
    Result:
    Draws a square with continuous line (not dashed).

    I don't really know what it could be - I'm not using any other plugins. There seems to be something - a setting, code, or something else in the project that makes it incompatible with Vectrosity.

    As you've been working on this project for years I imagined you would have seen everything by now. But unless you have something I could try, I don't have any other option but to return Vectorsity which would be disappointing as it does seem quite nice.

    dob
     
  30. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,208
    As I said, try creating a package with the required files (then importing that into the new project) instead of copying over files. Manually managing files outside Unity is strongly discouraged and tends to break stuff.

    Haha, no. :) There are an infinite number of things people can come up with that I never considered, and defensive programming can only cover a finite number of situations.

    --Eric
     
  31. nabrown3

    nabrown3

    Joined:
    May 29, 2015
    Posts:
    10
    Hey! I'm working with Vectrosity to paint links between steps in a graph visualizer. My issue is lag! When I paint hundreds of vectorlines I begin to see a lot of lag even when no new links are being drawn/erased. I'm using Draw() not DrawAuto3d() so it seems like the vectorlines shouldn't be causing any lag when not being added or removed from the scene. Any ideas on what might be causing this lag? Note that when the links aren't drawn there is no lag. Also this is all within the Unity UI.

    PlanVizScreenshot.png
     
    Last edited: Jun 14, 2016
  32. dittytwo

    dittytwo

    Joined:
    Apr 30, 2015
    Posts:
    9
    Hi Eric
    Love the product and have used it a lot, we are heavily using playmaker on our current project as it solves a lot of non coding peoples issues with coding... so my question are you planning to help/add support for vectrosity and Playmaker or not even thinking about it.
    cheers
    D2
     
  33. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,208
    What does the profiler say? If you use Draw, then there is no CPU usage from Vectrosity after the lines are drawn, but only if you use it once. If you're calling Draw every frame, that's a different matter. Although from what I can see in your screenshot, it's not actually very many lines and shouldn't cause any noticeable lag regardless.

    That's not on the roadmap at the moment, sorry.

    --Eric
     
  34. nabrown3

    nabrown3

    Joined:
    May 29, 2015
    Posts:
    10
    First off, thanks for the quick response! Really appreciate it. Here is a screenshot of my profiling. So it looks like when all vectorlines are loaded and displaying there isn't much lag, however a lag spike is experienced whenever any UI element is hovered over / interacted with / etc. The following screenshot of my profiler shows two spikes that occurred when I hover over a UI button while all the vectorlines are rendered. The majority of the lag is attributed to Canvas.RenderOverlays. Any ideas?

    profilerscreenshot.png
     
  35. nabrown3

    nabrown3

    Joined:
    May 29, 2015
    Posts:
    10
    I'm wondering if it stems from the fact that the lines are being rendered in a ScrollRect.
     
  36. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,208
    If those are separate VectorLine objects, try using a single VectorLine using LineType.Discrete instead.

    --Eric
     
  37. nabrown3

    nabrown3

    Joined:
    May 29, 2015
    Posts:
    10
    That did the trick! I'm guessing the underlying issue was just having a bunch of objects nested under a ScrollRect. Thanks again for your help!
     
  38. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,208
    Version 5.3 is out now on my site, and is being submitted to the asset store:

    Vectrosity 5.3

    Additions:
    • VectorLine.SetEndCapIndex, which can be used to have the front or back end caps appear somewhere other than at the front and back of the line. e.g., if a line has some transparent segments at the front/back and some visible segments in the middle, SetEndCapIndex could be used to make the end caps match up with the visible segments (in which case SetEndCapColor should be used to make the end caps visible).

    Changes:
    • If adding points to a line and custom per-segment line widths have been used, the custom line widths are retained instead of being reset to the line's default width.
    • VectorManager.ObjectSetup can be called subsequently with the same VectorLine using any Visibility value, rather than just Visibility.None. e.g., starting with Visibility.Static and later switching to Visibility.Dynamic will work.
    • In cases where an existing line would be parented to the VectorCanvas, if any one of a line's parent objects is already a canvas, then it stays on that canvas. The previous behavior was to only check if the root object was a canvas.
    • The LineManager object no longer persists through scene changes. This shouldn't require any code changes.

    Fixes:
    • Setting a VectorLine's end cap to the same value it was previously no longer adds triangles, and changing the end cap to a different one works properly.
    • The GetPoint functions work correctly with lines that are using a .drawTransform which is rotated or scaled.
    • Fixed visual glitch when setting VectorLine.drawStart to a value > 0 while using Joins.Fill.
    • Using Visibility.Dynamic with ObjectSetup on an object that's been in the scene for longer than a frame (i.e., later than Awake or Start) works correctly if the object is currently visible in a camera.

    (Also a small change to one of the demo scripts to prevent a warning in Unity 5.4.)

    --Eric
     
    Tinjaw and schmosef like this.
  39. hurleybird

    hurleybird

    Joined:
    Mar 4, 2013
    Posts:
    80
    Is it possible to specify, for example, a pair of transforms instead of a pair of Vector3s so that lines won't need to be redrawn all the time when the intended behaviour is to follow GameObjects around?
     
  40. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,208
    You can use VectorLine.rectTransform.SetParent to parent a line to an object, but keep in mind that this may interfere with Vectrosity and cause unwanted behavior unless you're sure you understand what you're doing. I don't quite understand what you mean by "a pair of transforms" since objects can only have one parent.

    --Eric
     
  41. hurleybird

    hurleybird

    Joined:
    Mar 4, 2013
    Posts:
    80
    Sorry, I mean if I want one end of a line to follow one transform(.position), and the other to follow another. Is there a way to define a line with Transforms rather than Vector3s?
     
  42. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,208
    That would only work if the two transforms always maintained the exact same distance. However, redrawing a line segment between two points is such a trivial thing that there's no point "optimizing" it like this.

    --Eric
     
  43. hurleybird

    hurleybird

    Joined:
    Mar 4, 2013
    Posts:
    80
    The issue there for me is that it resets the animation, although that would work for static and/or solid lines. Ah well, will probably just need to use particles then.
     
  44. Deep_Ak

    Deep_Ak

    Joined:
    Jun 24, 2015
    Posts:
    29
    Just bought vectrosity today! The first asset i've bought on asset store and i'm certainly satisfied just by reading the manual. A perfectly written manual indeed. Thank you for this!

    Just to save some time, i'm having a problem with unity's line renderer, In my mobile game I have a ball that instantiates upon clicking the screen and you can drag and a dotted line appears showing it's direction, if I stretch the line further away from the ball the dotted line comes perfectly, but if I drag it close to the ball, the line disappears at places, would this be solved with vectrosity? By using SetLine or something else?

    Also, I'd like to make a trail behind the ball when it's shot, how would I get a smooth trail with vectrosity?
    Thanks again!
     
  45. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,208
    One of the demos (the Path demo) has a trail behind an object, so that's one way. As for the dotted line, typically what you'd do is create a VectorLine object then update the points list as necessary (and redraw the updated line). The SelectionBox demo is similar to that, aside from having a rectangle instead of connecting two points. But the principle is the same.

    --Eric
     
    Deep_Ak likes this.
  46. Deep_Ak

    Deep_Ak

    Joined:
    Jun 24, 2015
    Posts:
    29
    Thanks for the quick reply, will try it now!
     
  47. Deep_Ak

    Deep_Ak

    Joined:
    Jun 24, 2015
    Posts:
    29
    Hi Eric, I got my dotted line on point, it worked like a charm. But my trail behind the ball is a solid line, when the ball bounces off at 90 degrees (like "L"), the path of the trail is not L shaped, rather it has a weird curve to it, how do I fix this?
    And also, i'd like the line to start deleting from the end of the trail while the ball is moving, how would I go about it? Delete the points ?
    Thanks in advance.
     
  48. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,208
    It's hard to answer that without knowing what you're doing exactly. I'd suggest first looking at the Path demo again and see what differences there might be between what you're doing and the demo, since that has a dotted line at all times. As far as line shape, Vectrosity only draws what you tell it, so you might want to examine the contents of the points list and see if your code is doing what you think it's doing. Regarding deleting from the end, yes, delete the relevant points from the list using standard List functions (e.g. RemoveAt).

    --Eric
     
  49. tbg10101_

    tbg10101_

    Joined:
    Mar 13, 2011
    Posts:
    147
    Here is an odd issue.

    I am drawing lines then setting active to false when the line is not needed to save draw calls. The lines are then activated again when needed. I set the points every frame, even when they are not active.

    The oddness I am seeing is that upon setting active to true, the lines are drawn in the place where they were deactivated for a single frame. Then, in subsequent frames they are drawn in the correct places.

    Here is a video of the issue:


    Code:
    Code (CSharp):
    1.     //lines
    2.     private VectorLine planeIndicator;
    3.     private VectorLine yIndicator;
    4.  
    5.     private void Start () {
    6.         planeIndicator = new VectorLine("On-Plane Indicator " + name, new List<Vector3>(12 + (int)(3.1415f * radius * 2.0f)), 2, LineType.Continuous);
    7.         yIndicator = new VectorLine("Y-Axis Indicator " + name, new List<Vector3>(2), 2);
    8.     }
    9.  
    10.     private void LateUpdate () {
    11.         //set these to true when needed below
    12.         planeIndicator.active = false;
    13.         yIndicator.active = false;
    14.  
    15.         Profiler.BeginSample("Y Indicator");
    16.         MovePlanner mp = MovePlanner.instance;
    17.  
    18.         yIndicator.points3[0] = transform.position;
    19.         yIndicator.points3[1] = new Vector3(transform.position.x, 0, transform.position.z);
    20.  
    21.         if (mp.isVisible) {//show the y indicator if the move planner is nearby
    22.             if ((mp.targetLocation - transform.position).sqrMagnitude < contextLinesRangSquared) {
    23.                 //yIndicator.points3[0] = transform.position;
    24.                 yIndicator.points3[1] = new Vector3(transform.position.x, mp.targetLocation.y, transform.position.z);
    25.  
    26.                 yIndicator.active = true;
    27.             }
    28.         } else if (selectionConsideration) {//show the y indicator if being considered for selection
    29.             yIndicator.active = true;
    30.         }
    31.         Profiler.EndSample();
    32.      
    33.         //show the plane indicator if being considered for selection or is selected (and is visible)
    34.         Profiler.BeginSample("Plane Indicator");
    35.         planeIndicator.MakeCircle(transform.position, Vector3.up, radius * (float)WorldMoveAndScale.instance.worldScale);
    36.  
    37.         if (selected || selectionConsideration) {
    38.             if (IsVisibleFrom() && nearGraphicsVisible) {
    39.                 planeIndicator.active = (Camera.main.transform.position - transform.position).sqrMagnitude < planeIndicatorRangeSquared;
    40.             }
    41.         }
    42.         Profiler.EndSample();
    43.  
    44.         //draw lines (only drawn if active)
    45.         Profiler.BeginSample("Draw Lines");
    46.         yIndicator.Draw3D();
    47.         planeIndicator.Draw3D();
    48.         Profiler.EndSample();
    49.     }
    Deets on my setup:
    • I am using Unity 5.4b21.
    • I am using Vectrosity 5.3.
    • I am using VR.
     
    Last edited: Jun 22, 2016
  50. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,208
    I'm not able to duplicate that here with my own code, but I see you're using LateUpdate, which is probably conflicting with the LateUpdate used for Draw3D. If you can change your code to Update, I expect the problem will go away.

    --Eric
     
unityunity