Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Official Unity Splines

Discussion in 'World Building' started by gabrielw_unity, Oct 5, 2022.

  1. gabrielw_unity

    gabrielw_unity

    Unity Technologies

    Joined:
    Feb 19, 2018
    Posts:
    917
    upload_2022-10-5_13-52-58.png


    Welcome to the Splines discussion thread. You can use this thread to ask for help, share feedback, and have discussions about the Splines package.

    Introduction
    Splines provides a shared solution for path-based tooling, meaning:
    1. As an artist, you now have built-in ability to
      - Animate cameras, characters, particles or anything else along a path!
      - Create fences, walls, paths and other details that require placing many objects along a path
      - Easily build and modify tubes, wiring, and similar objects
    2. As an artist, you can expect same basic visuals, shortcuts, and tooling when working with any Spline-based features - no need to learn and re-learn
    3. As a tool/feature developer, you can use Splines as a base for your own solutions (for yourself, the Asset Store, etc)
    Resources
    Requirements
    • The minimum required Unity version is 2022.1
    Getting started
    1. Download Unity 2022.1 or newer through the Hub.
    2. Open your project in Unity and go to Project Settings > Package Manager
    3. Go to Window > Package Manager.
    4. Search for "Splines" and install
    5. Use "GameObject > Spline > Draw Spline Tool ..." to begin creating your first Spline
    Current state

    Splines 2.0 is the currently available release, with numerous improvements vs 1.x:
    • Ability to draw connected and disconnected branches
    • More tangent controls and modes
    • Ability to select and edit multiple spline elements simultaneously
    • Default components for Animating, Instantiating, and Extruding along a Spline
    • Improved element visuals and interaction
    • API, bug fixes, and more - see the Changelog for details
    What's next
    Splines 2.1 (coming soon) is landing soon with more artist-focused features and general polish. Future releases will be bug fixing and maintenance - no new features are currently planned.

    Feedback
    In terms of feedback, we're especially looking for:
    • Can you think of any use cases that are not covered yet?
    • Are there any workflows that are unclear or missing?
    • Is there anything that is unclear or that you don’t understand?
    • Are there any issues or unclear parts in the documentation?
    Please share your feedback in this thread.

    How to report bugs
    Ideally, we'd like any bugs reported through the built-in bug reporter tool, as that will automatically provide us with some relevant context. When reporting bugs, please:
    • Attach a (stripped) project when there are issues with X.
    • Attach X files when there are issues with X.
    Have a look at this page for more information and best practices around bug reporting.

    Once you have submitted a bug report through the bug reporter, please feel free to start a discussion about it in this thread.

    Thank you for your interest, we're looking forward to your feedback!
     
    PolyCrusher, echu33, Rowlan and 5 others like this.
  2. shikhrr

    shikhrr

    Joined:
    Nov 19, 2013
    Posts:
    49
    Any plans for spline system integration with the terrain?
     
    useraccount1 likes this.
  3. Onigiri

    Onigiri

    Joined:
    Aug 10, 2014
    Posts:
    329
    Small feedback: circle spline in create menu is not so circle. See how it looks compared to sphere collider
    upload_2022-10-6_17-42-24.png
     
    Wattosan and gabrielw_unity like this.
  4. PaulMDev

    PaulMDev

    Joined:
    Feb 19, 2019
    Posts:
    50
    I would really like being able to repeat and bend decals along a spline.
     
    shikhrr likes this.
  5. gabrielw_unity

    gabrielw_unity

    Unity Technologies

    Joined:
    Feb 19, 2018
    Posts:
    917
    That's up to the Terrain Team! :) Lots of good uses there, for sure.
     
    DevDunk and shikhrr like this.
  6. gabrielw_unity

    gabrielw_unity

    Unity Technologies

    Joined:
    Feb 19, 2018
    Posts:
    917
    Uho ... could you file a bug report? Thanks!
     
  7. gabrielw_unity

    gabrielw_unity

    Unity Technologies

    Joined:
    Feb 19, 2018
    Posts:
    917
    Sure, that could certainly be done by an Asset Store/custom solution. Spline is open to all for use, we're excited to see what everyone starts building with this :)
     
    mahdi_jeddi likes this.
  8. crawfis

    crawfis

    Joined:
    Jan 30, 2014
    Posts:
    80
    So I am in Unity 2022.1.6f1 with the package manager updated today and it does not show the Spline 2 package. Current version and only one installed is 1.01. Even tried to include preview packages.
     
  9. crawfis

    crawfis

    Joined:
    Jan 30, 2014
    Posts:
    80
    It shows up in 2022.2b by default. Note, there are compiler errors with the Samples you may have downloaded so those need deleted when upgrading.
     
    gabrielw_unity likes this.
  10. Onigiri

    Onigiri

    Joined:
    Aug 10, 2014
    Posts:
    329
    Ok, done CASE IN-19005
     
    gabrielw_unity likes this.
  11. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    3,122
    • Spline subdivision: Subdivide a spline, preferrably not the entire spline, but a range of knots
    • Knot reduction: Un-subdivide a spline and reduce the knot count
    • Convex and concave hull: Have a spline created a round a set of points (or gameobject positions) to create a closed spline area
    • Selection API: the selection API is currently closed, there's no way I could access selected knots and eg subdivide between them myself
    • Center the transform's pivot: There should be a button for that
    • Extending an existing spline is totally unclear. I only found out by accident how that works. Preferrably the tooltip on the "Add Knot" toolbar button should be extended by that information.
    Feature request:
    • new splines should be set to Auto, currently it's Bezier. nobody wants to mess with Bezier when they start with splines
     
    Last edited: Oct 14, 2022
    Lars-Steenhoff and shikhrr like this.
  12. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    3,122
    On a general note: The Splines are good, but they lack feedback from users. I toyed around with the spline widths that Jason implemented for MicroVerse. Personally I feel some simple API calls are missing. Like eg I have a spline with 2 knots, start and end knot. Then inbetween 3 spline data which define the width.

    Rough example just to visualize this:

    ex.jpg

    For one I had to figure out how to access the knots at all via script. In the Splines API t is mixed up and used as knot index and normalized value. That's rather confusing. Then I needed to get all width positions and width values. That's not possible currently, not in a straightforward way. I had to create a list of normalized t values of the spline data including the bezier knot positions at start and end, then go through that list and evaluate the positions and widths relative to [0,1] including the points that actually don't exist as bezier knot.

    That could be easily added to the spline utils. And should be. Things like that.

    In other words: Spline is good, but lacks polish. Don't stop developing it before the goal. Go the extra mile please :)
     
  13. Shizola

    Shizola

    Joined:
    Jun 29, 2014
    Posts:
    346
    Why are Unity stopping development on this before anyone's had a chance to use it on a real production? Insanity. Such a crucial tool, development should be going on indefinitely.
     
    PutridEx and sqallpl like this.
  14. PaulMDev

    PaulMDev

    Joined:
    Feb 19, 2019
    Posts:
    50
    Did they ?
     
  15. Shizola

    Shizola

    Joined:
    Jun 29, 2014
    Posts:
    346
    In the OP
    "Future releases will be bug fixing and maintenance - no new features are currently planned."

    I only knew because the MicroVerse dev has been highlighting some of its limitations.
     
    PutridEx likes this.
  16. gabrielw_unity

    gabrielw_unity

    Unity Technologies

    Joined:
    Feb 19, 2018
    Posts:
    917
    Hey folks! This is somewhat of a misunderstanding. As the starting post here says, we're actually still working on features and improvements right now, for the 2.1 release. Some of the most exciting updates, especially for artists, coming there!

    After 2.1, yes we're stepping back to let the system gain adoption, get heaps of real-world data, and figure out what comes next for Splines. That step-back also allows us to shift our team's primary feature focus to our next big ticket item, native greyboxing tools - basically the "make ProBuilder really good, make it default" that's been asked for 5 years since Karl and I joined Unity. So that's super exciting ... and yes, it should make heavy use of Splines, too!
     
  17. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    3,122
    Is there anything you can share about 2.1, ie which features will be in? Just for planning ahead.

    In that regard with ProBuilder: Will you guys implement mesh creation with spline crossings, eg a road network?
     
    gabrielw_unity likes this.
  18. gabrielw_unity

    gabrielw_unity

    Unity Technologies

    Joined:
    Feb 19, 2018
    Posts:
    917
    2.1 - sure! It's mainly artist tooling and experience items. The best one is a "direct manipulation", similar to 2D solutions, so you can click-drag on an element to move it, like you would for box collider handles/etc. For this iteration, it's always in the item's local space, and only does the move action - again, very much like 2D, very simple, designed to match expectations for folks coming from those type of apps (Figma, Photoshop, Illustrator, etc). However, this is something we're thinking will also be critical to fast, intuitive greyboxing tools, so a generic, 3D solution could land with those tools. Very excited for that.

    Visual improvements, tons of bug fixes, and many API improvements are also there. Should be finalized soon, so I can share specifics then!

    Also, a big, big focus of Splines is Asset Store or other external use, so when we say "support and maintenance", there's still room (and desire) to consider API work. Especially as we find potential blockers, ie the editor selection business you pointed out.
     
    PaulMDev and Rowlan like this.
  19. gabrielw_unity

    gabrielw_unity

    Unity Technologies

    Joined:
    Feb 19, 2018
    Posts:
    917
  20. TJHeuvel-net

    TJHeuvel-net

    Joined:
    Jul 31, 2012
    Posts:
    732
    Are there plans to release a module that allows us to morph a mesh along a spline? E.g. a cliff face which we can bend, something like what we see here?
     
    Last edited: Nov 3, 2022
    TerraUnity and luispedrofonseca like this.
  21. Shizola

    Shizola

    Joined:
    Jun 29, 2014
    Posts:
    346
    Spline package has a shortcut with the default shortcut for Toggling global / local (x). Quite annoying.
     
  22. TJHeuvel-net

    TJHeuvel-net

    Joined:
    Jul 31, 2012
    Posts:
    732
    I'm a programmer, in general i really dislike it when the names in the inspector are different from the classnames.

    upload_2022-11-3_20-18-2.png

    After i've added the Spline component i wanted to interact with this in a script, so i tried to get the Spline component. However, that doesnt exist, i should get a SplineContainer. I feel like if the name of the script is SplineContainer, it should show as SplineContainer in the inspector. When i try to disable the gizmo, i need to search for SplineContainer again in the scene view dropdown.

    Honestly i find SplineContainer quite contrary to what the rest of Unity's GameObjects and Components do. When i want a single entity to have multiple boxcolliders, i simply add a few to one GameObject. There is no need for a BoxColliderContainer. Why couldnt we just add multiple Spline components to our GameObjects?

    Happy to see the NativeSpline though!
     
    Last edited: Nov 4, 2022
    adslitw and florianBrn like this.
  23. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,344
    Is there a reason when you use "Draw Spline Tool" in 2.1 it sets up all the curve tangents to create linear interpolation between the points? Why would this possibly be a good default? The only way I can seem to fix it is to manually edit every splines in and out tangents to make it smooth. It's a spline tool, not a polygon tool, shouldn't it act like a spline tool?

     
  24. chrpetry

    chrpetry

    Joined:
    Mar 7, 2018
    Posts:
    47
    I am on Unity 2022.1.20 and can only install Splines 1.01. Is there a reason for this?
    Would like to test/implement latest Splines version if possible.

    Something on 2022.2 that is needed? Don't want to use beta for this...
     
  25. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    442
    Hi
    I have the following
    Code (CSharp):
    1.  public class X : MonoBehaviour
    2. {
    3.         [SerializeField] SplineContainer splineContainer;
    4.  
    5.         void BindEvents()
    6.         {
    7.             if (splineContainer)
    8.             {
    9.                 splineContainer.Spline.changed += OnSplineRefresh;
    10.  
    11.             }
    12.         }
    13.  
    14.         private void OnSplineRefresh()
    15.         {
    16.             // Do Stuff
    17.         }
    18.  
    19.           ......
    20. }
    BindEvents is called at some point.
    Imagine that splineContainer is set to Spline1. Then via editor, I set it to Spline2. How could I stop listening to Spline1?
    Usually, in similar patterns, I do that inside the event listener, where I compare the event sender with the current's field value, but in this case, the changed event does not let you know who is the sender.
     
  26. gabrielw_unity

    gabrielw_unity

    Unity Technologies

    Joined:
    Feb 19, 2018
    Posts:
    917
    No plans for this right now, but it's a great suggestion. We tried to hit the 3 key items first (Instantiate, Animate, Extrude), and ideally we can continue to add more as releases continue. Thanks for the suggestion!

    Regarding the name not matching - it's hard to recall, but I believe you can blame me for this. Reasons were had, but in retrospect, I agree. Might be able to change it.

    I'll defer to @karrrrl on that, I believe it has to do with ensuring data can be reliably used between parts of a branching spline.

    Thanks!!

    Hi! We followed most spline/vector network convention here (Figma, Photoshop, others) - a single click creates a linear point, or a click-drag will place the point and allow you to set the tangents on mouse release. Sorry to hear this wasn't clear to you, and it's this exact set of issues (mouse and modifier actions being totally opaque) that is really pushing the "Helper Bar" work to get done. So you'd have a dynamic info bar saying "click to do X, click drag for Y, CTRL click for z" and so forth.

    Also, check out the Tool Options overlay - you can always toggle through options (if they exist) up there. For Draw Spline Tool, one of those options is the default type, which you can change to an auto-smoothed point :) Hope that helps!
     
    TJHeuvel-net likes this.
  27. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,344
    Ok, found the tool toggle for auto vs. linear - (very not obvious, along with the click and hold method) - but when set to auto it still creates linear points by default. I would prefer to be able to set that and just click, as this gives you a smooth curve without having to think about tangents.

    Further, I'd suggest having a menu item for the default - "Draw Spline Tool", "Draw Polygon Tool", perhaps. Or linear vs curves. Either way, having to select that tool, then go to a menu making sure not to click anything, then click holding for every point is very tedious, and if you make a mistake, esc cancels spline editing and ends your spline, so your stuck with either starting over or trying to fix your linear spline to be curved (a button to reset the tangents to what would be auto would be nice, because switching their mode doesn't change the actual tangent data)..

    Note that all your references here are 2d spline editors - but in 3d your often working on a 3d topology (like terrain) where linear is not very desirable, and wild tangent deviations often don't get what you actually want (ie: Conforming roughly to the terrain).



    After setting the spline to bezier and continuous, it's still linear. I would expect switching it to bezier and continuous, I'd have some kind of continuous spline segment - instead of having to manually try to align the tangents to look continuous.

    Also, any chance those classes will be made public so we can not have SplineData<T> completely ruined when a change is made to a spline? Or have them actually work with multiple splines in a container?
     
  28. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,344
    Also it would likely make sense for code issues to get reviewed by QA engineers who have some basic understanding of code. I submitted in a bug that SplineReorderableListUtility is private because Unity employee's in this thread are suggesting I use that class to solve some of my spline issues, and QA kicked it back for not having a repro project, so I just spent time making a non-compiling project for basically no reason to prove that a class is private, when you can see that it's not public just by looking at the class definition. Having to jump through extra hoops like this is silly.

    Like that shouldn't need a repro project made for it.
     
    koirat, Rowlan and Aka_ToolBuddy like this.
  29. gabrielw_unity

    gabrielw_unity

    Unity Technologies

    Joined:
    Feb 19, 2018
    Posts:
    917
    Yup, this confusion is a result of the old "system" - basically wild west, in which every tool maker needed to choose where to put their options/etc, resulting in no predictable UX. The new Contextual Workflows system is now in place to solve that (and more), but it'll take a bit for that to be become second nature.

    Speaking of ... if you ever see a Unity-provided Tool (anything that sets mouse interaction in the Scene), and it does not show it's options in the Tool Options overlay ... please file a bug report, or 3. External pressure is great, too!

    That's a bug too, I'll check here later (not on the machine), but if you get a moment to file a bug report on that one, many thanks! :D (I firmly believe good bug reporting should have monetary compensation ... ha, I can dream eh?)

    The Tool should be simply remembering your preference (so you never need to change that Tool Option, after the first time). Again, might be a bug - I'll look into this one later today, thanks.

    Regarding "a button to reset the tangents to what would be auto would be nice, because switching their mode doesn't change the actual tangent data" - I assume you are selecting all the points, then clicking "Auto" in the inspector? That should, as it says, have the result you expect/want. Can you clarify?

    Right, for insight there - a click or click-drag style of creation (2D) generally works best for hand-placing, and in situations where you need the spline to conform to the surface below, nothing is truly useful other than a Spline modifier/system that projects a path onto that surface (often, the spline itself would be just a 2D one, in those cases, ie Terrain uses). That's a separate solution for sure, and didn't surface as a requirement in our user research (note on that, I think I mentioned before, please please jump into those in the future if you have time, super helpful for all sides!)

    Can you clarify this?
     
  30. gabrielw_unity

    gabrielw_unity

    Unity Technologies

    Joined:
    Feb 19, 2018
    Posts:
    917
    Do you have a link, title, something that I can use to check in on this? Thanks!
     
  31. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,344
    Nope, it makes no visible change to the spline when you switch between auto, continuous or linear. What I suspect is happening is it was bezier all along and the tangents are just set to the values that make them linear- so when you change the mode, it doesn't change the values, so it's still just linear. I would have expected that changing the mode would change the tangent values.

    IN-20418 - the original bug report, which lists the forum posts and quotes saying to use that utility class and me saying it was private.
    IN-23440 - the repro project I filed that does not compile because it attempts to call a function in that class.
     
    TJHeuvel-net likes this.
  32. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    3,122
    2.1 seems to be broken. I'm getting loops while painting splines:

    knots.jpg
     
  33. JoergHofmann74

    JoergHofmann74

    Joined:
    Oct 31, 2017
    Posts:
    3
    Hi guys,
    how do you get the 2.1? I have the package manager preview features enabled and are on 2022.1.20f, but there is only splines 1.01 available.
    Cheers J
     
  34. Lurking-Ninja

    Lurking-Ninja

    Joined:
    Jan 20, 2015
    Posts:
    8,752
    You can always try to add it by name, there you can specify version too.
     
  35. TomislavKlepac

    TomislavKlepac

    Joined:
    Apr 23, 2019
    Posts:
    2
    Hi,
    This package is very promising and I would like to use it in a game that is an endless runner on a procedurally generated spline.
    The general idea is that I have several splines that are pooled and activated as the player moves forward. As they are drawn from the pool their Knots are randomly modified. I'm not sure if this is the best solution.

    Anyways, the issue I'm facing here is how to modify existing splines (only position and rotation of knots). An example would be really helpful.
     
  36. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    442
    Hi @gabrielw_unity. Is the 'changed' event planned to have a sender parameter? If not, how would you recommend to solve the issue detailed in the post I quoted?

    Thanks
     
  37. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    442
    @gabrielw_unity also, when listening on the 'changed' event, the value of 'Closed' is not up to date.
    This is using Splines 1.0.1. I change the Closed value through the inspector.
    The issues seems to come from this:

    Code (CSharp):
    1.         public void ApplyProxyToProperty(SplineUIProxy proxy, SerializedProperty property)
    2.         {
    3.             ...
    4.             targetSpline?.SetDirty();
    5.             ...
    6.             EditorApplication.delayCall += () => SplineConversionUtility.UpdateEditableSplinesForTarget(property.serializedObject.targetObject);
    7.         }
    The event is called in SetDirty, while the spline seems to be updated in the delayed call