Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Want more efficiency in your development work? Sign up to receive weekly tech and creative know-how from Unity experts.
    Dismiss Notice
  4. Build games and experiences that can load instantly and without install. Explore the Project Tiny Preview today!
    Dismiss Notice
  5. Nominations have been announced for this years Unity Awards. Celebrate the wonderful projects made by your peers this year and get voting! Vote here!
    Dismiss Notice
  6. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  7. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

BGCurve (free Bezier Spline Editor) support thread [OFFICIAL]

Discussion in 'Assets and Asset Store' started by BansheeGz, Feb 18, 2017.

?

Is BGCurve cool?

  1. Yeah...

    48 vote(s)
    88.9%
  2. Maybe..

    6 vote(s)
    11.1%
  3. Nah.

    0 vote(s)
    0.0%
  1. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    59
    Last edited: Sep 25, 2017
    LilGames likes this.
  2. JSBmanD

    JSBmanD

    Joined:
    Oct 19, 2016
    Posts:
    10
    Hi, I have created spline and now I need to launch several prefabs on it. How to do it? Docs aren't so descriptive as I can see.
     
  3. Pavulon

    Pavulon

    Joined:
    Jul 16, 2015
    Posts:
    1
    You need to attach instance of your prefabs to cursors on the spline.
    To do it:
    1. Select your curve. In the inspector window ensure you have BgCurve component which has 4 tabs: Points, Components, Fields and Settings.
    2. Go to Components tab on BgCurve component.
    3. Make sure you have Math component. If you don't have it then you can add it using the green plus button.
    4. Add Cursor component for Math component (using green plus button). Cursor allows moving along spline.
    5. For the Cursor component add Translate Object By Cursor component.
    6. Add your prefab's instance as Object To Manipulate.
    7. Repeat steps 4-6 if you want more objects which moves along spline.
    With such setup you can now manipulate cursor's distance to move the object attached to it. You can do it either from script, from animation or from additional Cursor's component called Cursor Change Linear which moves the cursor automatically.
    Yes, I was also confused at the beginning. Actually I've learned most from BGCurveDemo2 from examples directory and after getting the idea of basic concepts I used the docs as the API reference.
     
    JSBmanD likes this.
  4. kannengf

    kannengf

    Joined:
    May 2, 2017
    Posts:
    10
    I have a few spline-segments where the endpoint of one segment ist the startpoint of another spline. I want to move a object on the splines. How can i setup the objectToManipulate becomes the one of the next spline and follow the next spline? How do i access this with a script?
     
  5. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    59
    something like this should work

    Code (CSharp):
    1.     void Update()
    2.     {
    3.         BGCurve fromCurve;
    4.         BGCurve toCurve;
    5.  
    6.         //assuming both curves have BGCcCursorObjectTranslate (and BGCcCursorChangeLinear) components
    7.         var fromCurveTranslate = fromCurve.GetComponent<BGCcCursorObjectTranslate>();
    8.         var toCurveTranslate = toCurve.GetComponent<BGCcCursorObjectTranslate>();
    9.  
    10.         //if we reach the end point
    11.         if (fromCurveTranslate.Cursor.Math.GetDistance() - fromCurveTranslate.Cursor.Distance < TOLERANCE)
    12.         {
    13.             toCurveTranslate.ObjectToManipulate = fromCurveTranslate.ObjectToManipulate;
    14.             fromCurveTranslate.ObjectToManipulate = null;
    15.         }
    16.     }
    17.  
     
  6. Smaselll

    Smaselll

    Joined:
    Jul 22, 2015
    Posts:
    9
    Can't see my Curve in Canvas? Is it works with canvas components (like scroll view)?
     
  7. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    59
  8. JSBmanD

    JSBmanD

    Joined:
    Oct 19, 2016
    Posts:
    10
    I have code that disable gameobject with bgcurve. After enabling, object doesn't move. Speed is set, distance ratio is 0. I thinks that's bug.
     
  9. JSBmanD

    JSBmanD

    Joined:
    Oct 19, 2016
    Posts:
    10
    That was because of setting "Overflow Control". If set "Stop" then it won't continue. I've cycled it and set trigger at ratio 0.99 and it works. Maybe I could do this by another way?
     
  10. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    59
  11. dragonkioku119

    dragonkioku119

    Joined:
    Jul 16, 2017
    Posts:
    13
    I'm thinking about using it but I have a question. Can you programatically add points further along the spline such that you can have a shape with colliders growing outward over time? I'm making a bullet hell game and want to be able to have curvy lasers like these:
    or the ones at 3:20 in this video
    and was trying to figure out if BGCurve would be a good solution.
     
  12. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    59
    Yes, you can add, move, delete points at runtime. As for colliders, you will have to create them yourself.
    The question- is it really worth it to use BGCurve is hard to answer.
    I do not monitor splines solutions for Unity and i do not know if better tool for such task exists or not.
    Also BGCurve is limited to Bezier interpolation only.
    And ,I guess,the task itself can be accomplished by different methods as well.
    If trajectories are static and predefined, you can simply animate the splines with Unity animation tools or draw these trajectories beforehand and then simply follow them with your lasers.
    If trajectories are built at runtime with some fancy math formulas Im not sure if you can take advantage of BGCurve.
     
  13. JSBmanD

    JSBmanD

    Joined:
    Oct 19, 2016
    Posts:
    10
  14. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    59
    OverflowControl field defines how the cursor behaves when it reaches the end of the spline.
    If you chose Stop-it stops and do not move anymore. The Stop field is set to true.
    If you need it to move again- you can set Stop field to false and move cursor somewhere in the middle of the spline.
    If you set OverflowControl to any other value different from Stop- this field would never be set to true.

    Note, that you can also control the cursor behavior from script by setting Speed field of ChangeCursorLinear component (positive- move toward the end,0-stop, negative-move towards start) and you can also control the cursor position from script by setting Distance or DistanceRatio fields of Cursor component.
    I hope it makes sense.
     
    Last edited: Jul 19, 2017
    JSBmanD likes this.
  15. liam0neale

    liam0neale

    Joined:
    Apr 29, 2017
    Posts:
    3
    hi i would like to know the percentage distance my object has travelled through the spline or access the "Distance Ratio" in the Cursor is there already a script to do this?
     
  16. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    59
    Hi, DistanceRatio is percent, divided by 100.
    You can access it with
    GetComponent<BGCcCursor>().DistanceRatio
     
  17. liam0neale

    liam0neale

    Joined:
    Apr 29, 2017
    Posts:
    3
    BGCcCrusor does not show up, i am in a new script which is basically empty and have the namespace of "bansheeGz.BGSpline.Curve" what am i missing?
     
  18. JSBmanD

    JSBmanD

    Joined:
    Oct 19, 2016
    Posts:
    10
    You just need
    Code (CSharp):
    1. using BansheeGz.BGSpline.Components;
     
  19. liam0neale

    liam0neale

    Joined:
    Apr 29, 2017
    Posts:
    3
    thankyou
     
  20. dragonkioku119

    dragonkioku119

    Joined:
    Jul 16, 2017
    Posts:
    13
    Hi. Do you know a good way to make actual spirals using BG curve. Do you have a good equations for point and control placement? I've playing around with it a lot and am struggling to figure it out myself.
     
  21. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    59
    Hi,
    Can circle approximation formula help you with that?
    https://stackoverflow.com/questions/1734745/how-to-create-circle-with-bézier-curves

    For 2d spiral, you'll have to increase radius with every new point and adjust controls lengths (e.g. Incoming control's length will be lesser and outcoming control's length will be bigger). The difference will be dependant on radius delta.

    For 3d spiral you also have to place controls at some angle, which depends on radius and height deltas. I think the formula for this angle can be easily brute forced.

    You can also try to ask people at some math forums, maybe they have better ideas how to do it.
     
  22. Hoodad

    Hoodad

    Joined:
    Jan 23, 2014
    Posts:
    12
    Hi!

    This seems like a good plugin (a bit too complex for the problem it tries to solve in my taste) with a lot of functionality. However, I cannot for the love of God get it to play? I have watched the video
    , I have read the documentation at http://www.bansheegz.com/BGCurve/, I have tried calling the function GetComponent<BGCurve>().Start() and obviously I have found this thread. But still nothing that actually explains or show to make the BGCurve to animate along the spline...

    Please view this as feedback to your plugin but also feel free to help me out here.

    I have followed the instructions

    1. Select your curve. In the inspector window ensure you have BgCurve component which has 4 tabs: Points, Components, Fields and Settings.
    2. Go to Components tab on BgCurve component.
    3. Make sure you have Math component. If you don't have it then you can add it using the green plus button.
    4. Add Cursor component for Math component (using green plus button). Cursor allows moving along spline.
    5. For the Cursor component add Translate Object By Cursor component.
    6. Add your prefab's instance as Object To Manipulate.
    7. Repeat steps 4-6 if you want more objects which moves along spline.
    But again, like all other sources it does not tell you have to actually get the object to animate...

    Cheers!
     
  23. Hoodad

    Hoodad

    Joined:
    Jan 23, 2014
    Posts:
    12
    I figured out what was the problem. You had to press in your UI and add CursorChangeLinear component. Then it started to move.
     
  24. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    59
    Hoodad, hi
    I' m glad your issue is solved. We'll update our docs so it'll be easier to solve. Also there are a lot of test scenes in the examples folder and 2 demo scenes, that cover most out-of-the-box usecases, you can check them out if you have some issues.

    Could you please elaborate, why you think our plugin is complex?
    Our main objective-is to provide a fast robust and extensible core for Bezier splines.
    Our components are built on top of that core, you can delete all of them if you dont need them, the core is still going to work.
    You can also write your own components either from scratch or by extending the existing ones, so possible usecases should be unlimited if you need Bezier spline without need to worry about underlying core functions.

    For example, lets assume you want to move your object not linearly, but by some function.
    All you have to do-is to write your own class, which will change cursor position according to that function and all existing components, like move, rotate and scale will work just fine. So existing components structure may seem to be overcomplicated, but actually there is some rationale behind it.
     
  25. DungDajHjep

    DungDajHjep

    Joined:
    Mar 25, 2015
    Posts:
    39
    My script attach on gameobject you want it's self move , addtional feauture lerp velocity per point speed.
     

    Attached Files:

  26. LilGames

    LilGames

    Joined:
    Mar 30, 2015
    Posts:
    106
    How the heck to I set the size of the "ball" that represents a node? I tried scale tool on it, and it won't scale it. My scene is small and the nodes look huge.

    I found where to set the size of the small path spheres, but I need to change the size of the big ball. The green one in this example:

    node-size.png
     
    Last edited: Sep 25, 2017
  27. LilGames

    LilGames

    Joined:
    Mar 30, 2015
    Posts:
    106
    Found it! For anyone else interested, it's under "Fields"
     
  28. LilGames

    LilGames

    Joined:
    Mar 30, 2015
    Posts:
    106
    @BansheeGz
    Hi. I got up to speed fairly quickly. I have a cube following a spline now. The only thing I can't figure out is how to get the cube to orient with the spline (rotation change). In other words, imagine the cube has a "front" and it is facing forward as it follows the spline, when the spline curves, the cube should rotate to follow the curve, as if it was a road. Where is the option to turn this on?
     
  29. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    59
    JamesArndt and LilGames like this.
  30. LilGames

    LilGames

    Joined:
    Mar 30, 2015
    Posts:
    106
    Thank you. That solved it.

    I also figured out how to reset the cursor back to the beginning by changing the DistanceRatio to 0, and that I could restart BGCcCursorChangeLinear by setting Stopped to false.

    Next I will be figuring out how to only move the cursor N number of points.

    If you ever consider updting this asset, I would recommend including an easy way to make the cursor "go to point N" and include an event trigger once it reaches that point.
     
    BansheeGz likes this.
  31. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    59
    LilGames
    Thank you for your suggestions. We'll add the ability to move the cursor to a point in editor GUI in the next release.

    With code it can be done like this:
    Code (CSharp):
    1. var math = GetComponent<BGCcMath>();
    2. cursor.Distance = math.Math[0].DistanceFromEndToOrigin;
    (index 0 means "Point 1", so use index 1 for "Point 2" etc.). "Point 0"- is the first point of the spline.
    math.Math[0] refers to information about 1st section (between Point0 and Point1)

    Regarding events- they already exist and should work- component CursorChangeLinear, field PointReachedEvent. It's Unity's standard event. Point index is passed as an argument. BGCurveDemo scene has an example- SunMoonPath object uses events (it's under Director object). You could try to use these events to reset cursor's position. If you do, please, let me know if you have any issue with it.

    Another, more simple and robust solution- simply check if current Distance is more than the distance to a point- and then simply reset cursor's position to the point you need.

    By the way, if you need the cursor to go from the start to the end infinitely, you could just use CursorChangeLinear.OverflowControl=Cycle, it does not set the Stopped flag.
     
    Last edited: Sep 28, 2017
  32. BluetheFox

    BluetheFox

    Joined:
    Sep 11, 2016
    Posts:
    5
  33. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    59
  34. LilGames

    LilGames

    Joined:
    Mar 30, 2015
    Posts:
    106
    I have a tester reporting strange behaviour from CursorLinear and I suspect its from low frame-rates. I make the cursor object stop when it triggers a certain number of points on the curve, but the tester is reporting that sometimes the cursor is stopping past the point. Any advice?
     
  35. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    59
    LilGames
    Try to change line 167 of Assets\BansheeGz\BGCurve\Scripts\Cc\BGCcCursorChangeLinear.cs from
    Code (CSharp):
    1.         private void Update()
    to
    Code (CSharp):
    1.         private void FixedUpdate()
    Please, let me know if it helped or not.

    upd. and probably line 214 should be changed to
    Code (CSharp):
    1.             var newDistance = distance + currentSpeed*Time.fixedDeltaTime;
    2.  
     
    Last edited: Oct 20, 2017
    LilGames likes this.
  36. DavidSof

    DavidSof

    Joined:
    Sep 1, 2015
    Posts:
    4
    Hi ,and thanks for this awesome project

    I'm developing a game where you as a player trying to jump between flaying Box's (platform's) box's with Collider that atched to them and this box's following a spline.

    My problem basically is that the player camera jerks and hitches around with the motion of the platform's
    i'm using Ultimate FPS plugin for my player. any advice?
     
  37. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    59
    Hi,
    I may be wrong, but I think this can be related to FPS controller, cause if boxes themselves are moving smoothly, the camera should move smoothly as well unless additional forces are applied to it.
    If you could set up a simple scene which demonstrates this issue and send it to our support email support@bansheegz.com we could look into it
     
  38. DavidSof

    DavidSof

    Joined:
    Sep 1, 2015
    Posts:
    4
    Hi and Thanks for reply I just uploaded the pack

    http://www.mediafire.com/file/k35hq6g0o2qq5w0/Spline_Platform_Test.unitypackage
     
  39. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    59
    Hi, thank you for the pack. I sent you updated one by email.
    Here is what I tried:

    1) Step1. Part of the issue was our component using Update instead of FixedUpdate (more details in this message https://forum.unity.com/threads/bgc...-support-thread-official.456983/#post-3259643). We have to add an option for this, sorry for the inconvenience. I changed it in the package I sent.
    It did solve the issue with camera jittering when the player stands still, however when the player moves- the camera still jitters. Disabling vsync mitigates this issue, however, it's still noticeable. So I tried another thing (under Step2 GameObject)

    2) Step2. I removed UFPS moving platform script and Rigidbody from platform2. And the jitter is gone, well, almost. Sometimes it shakes a little bit while moving, very slightly. To make sure it's not directly related to BGCurve- I put a camera under platform - and there is no any shaking at all.

    Please, review the updated package and let me know if it was helpful or not.
    Also, I think you could try to ask UFPS support about this.
     
    DavidSof likes this.
  40. DavidSof

    DavidSof

    Joined:
    Sep 1, 2015
    Posts:
    4
    Thanks a lot ,it Solves the problem a special if i disabling vsync (otherwise i get some times a little jittering when i walks but for me in my case it's ok)
     
    BansheeGz likes this.
  41. PurpleSkyD

    PurpleSkyD

    Joined:
    Nov 2, 2017
    Posts:
    3
    Hello,

    I need to track object movement along a spline, using only their last point reached. I have been struggling with it a lot. I tried to pass through an event the point's id to another script, along with which object/cursor arrived there. I am using it for character movement in a turn based game in which I am treating each point as a space. How can I do that? Is it possible?
     
  42. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    59
    Hello,
    There are 2 events fired then point is reached
    1) Persistent (you can edit it in the inspector)
    2) Not- persistent (called PointReached)

    I attached example scene (BansheeGzSupport/support) with example script (Test.cs) which show how an object, being moved, can be retrieved by any of them.
    (Unfortunately our persistent event does not have sender attribute, so I had to add it)
     

    Attached Files:

    PurpleSkyD likes this.
  43. PurpleSkyD

    PurpleSkyD

    Joined:
    Nov 2, 2017
    Posts:
    3
    Hello again,

    Thank you for your answer. That worked well!

    But now I have another problem. Currently, I am making the cursor stops after passing some points, using the non-persistent event you provided me. But if (after it has stopped) I gave it a negative speed, the event is fired at the same point again.
    This probably happens because the cursor doesn't stop exactly at the point, but a little after it.

    As you said in a post above, I tried to check FixedUpdate and also changed deltaTime to fixedDeltaTime.
    Unfortunately, it didn't work :(
     
    Last edited: Jan 5, 2018
  44. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    59
    We fixed this issue, now BGCcCursorChangeLinear has useFixedUpdate field, which can be toggled on in the inspector.

    This is because BGCcCursorChangeLinear component was designed like this.
    It does not "understand" points the way it should to get rid of these events.
    It was designed for very simple usecases- and the truth is- it tries to solve so many things and it's so poorly designed -that it's almost unsupportable at this point.
    The only thing we could do to properly fix it at this point and make it easily extendable- is to redesign it from scratch- but we do not have enough resources to do it right now, sorry for the inconvenience.:(

    I think the right thing to do- is to write your own component, which would do exactly what you need.

    With current BGCcCursorChangeLinear - the only way to get rid of such events- is to move cursor slightly before or after the point and set a private field called currentSectionIndex to the proper section. And you can not do it in the event listener cause currentSectionIndex is updated after the event is sent (if you need to do it in the event listener-you could start a coroutine and wait till the end of the frame).
    I attached the updated BGCcCursorChangeLinear component with 2 methods added (
    MoveCursorSlightlyAfterPoint and MoveCursorSlightlyBeforePoint ) which do it.
     

    Attached Files:

    PurpleSkyD likes this.
  45. teh1archon

    teh1archon

    Joined:
    Nov 28, 2014
    Posts:
    10
    Hello, 2 question:
    1. Is there an easy way to make a run-time editor for this (at least for placing points)? If it's already in the product then I can't find it :(
    2. Can you make a demo scene for the sweep? I can't make it work for me.

    Great tool :)
     
  46. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    59
    Hello, thank you for your support!

    1. No, there is no playmode editor (only for SceneView in Unity's Editor).
    2. What's the issue with sweep?
    Assets\BansheeGz\BGCurve\Examples\BGCurveTestComponents.unity - this example scene has sweep component example.
     
  47. ChiefBreakeverything

    ChiefBreakeverything

    Joined:
    Jul 2, 2014
    Posts:
    10
    Hi! I'm loving this asset, it's really well done. I've suddenly started getting an error every time the mouse does anything in the 'Hierarchy' tab; it clogs the console up rather quickly. It also seems to be baked into the scene now, in that closing and re-opening Unity produces the same result. It's almost as though the BGCurve code-base itself has been changed? The error reads as below:

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. BansheeGz.BGSpline.Curve.BGCurvePoint.get_PositionWorld () (at Assets/BansheeGz/BGCurve/Scripts/Curve/BGCurvePoint.cs:149)
    3. BansheeGz.BGSpline.Curve.BGCurveBaseMath+SectionInfo.Reset (BGCurvePointI fromPoint, BGCurvePointI toPoint, Int32 pointsCount, Boolean skipCheck) (at Assets/BansheeGz/BGCurve/Scripts/Curve/BGCurveBaseMath.cs:1497)
    4. BansheeGz.BGSpline.Curve.BGCurveAdaptiveMath.Reset (BansheeGz.BGSpline.Curve.SectionInfo section, BGCurvePointI from, BGCurvePointI to, Int32 pointsCount) (at Assets/BansheeGz/BGCurve/Scripts/Curve/BGCurveAdaptiveMath.cs:64)
    Which when double clicked leads to the PositionWorld function in BGCurvePoint. I tried to do a bit of debugging and found out that 'curve' is returning null, but I don't know why or when it gets set. I haven't edited the code-base at all before that so it's a strange thing to have happen. I checked my version control to ensure that was the case.

    If I create a new scene and make a new BGCurve, I don't get the same error. So something has become problematic in the scene? I've been using the splines in junction with Unity's prefab applying/reverting functionality, I wonder if that has anything to do with it? Perhaps some combination of settings I'm using is creating the error?

    Any help would be greatly greatly appreciated! I'm on BGCurve 1.2
     
    Last edited: Jan 31, 2018
  48. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    59
    ChiefBreakeverything, sorry to hear you have an issue with our asset.
    It looks like one (or more) of the splines in your scene is broken (e.g. curve field of one of the point is set to null for some reason).
    It certainly can be a bug, but it can be very hard to figure out what's wrong without a way to reproduce it.
    If you could find a way to reproduce it- please, write to our support mail support@bansheegz.com it will help us a lot.

    I attached a script, which should fix this issue.
    How to apply it:
    1) Find a broken spline. It should start spamming your console as soon as you select it in the Hierarchy. (Try to select a spline and move your mouse in the SceneView- there should a huge number of messages in the console)
    2) Drag BrokenPointFix to this spline, then select another object and then select your spline again.
    3) Spamming should stop
    4) remove BrokenPointFix and save your scene

    Please, let me know if it helped or not.
     

    Attached Files:

    Last edited: Feb 1, 2018
  49. MidnightGameDeveloper

    MidnightGameDeveloper

    Joined:
    Apr 26, 2014
    Posts:
    5
    Hello I am trying to write a editor-script, that adds a prefab on the curve by instantiating the prefab, adding a Cursor, ObjectRotate and ObjectTranslate to the Curve. Everything works fine but the Cursor of the ObjectRotate and ObjectTranslate is not set correctly in the inspector, it gets always the first cursor of the gameobject.
    So for now i have to set this manually, i would appreciate any help.

    The function below is called by a Inspector-GUIButton:

    Code (CSharp):
    1.     public float distance, addDistance, speed = 0.2f;
    2.     public GameObject trackPartObj;
    3.  
    4.     public void AddTrackPart() {
    5.         GameObject newTrackPart = (GameObject)PrefabUtility.InstantiatePrefab(trackPartObj);
    6.         newTrackPart.transform.SetParent(this.transform);
    7.  
    8.         BGCcCursor nCursor = this.gameObject.AddComponent<BGCcCursor>() as BGCcCursor; //<<<NEW CURSOR ADDED
    9.         BGCcCursorObjectTranslate nTranslate = this.gameObject.AddComponent<BGCcCursorObjectTranslate>() as BGCcCursorObjectTranslate;
    10. ...
    11.  
    12.         nTranslate.ObjectToManipulate = newTrackPart.transform;
    13.         nRotate.ObjectToManipulate = newTrackPart.transform;
    14.         nTranslate.Cursor = nCursor;//<<<<SETTING THE CURSO
    15.         nLinear.Speed = speed;
    16.         distance += addDistance;
    17.         nCursor.DistanceRatio = distance;
    18.  
    19.         Debug.LogWarning ("ACHTUNG: Im Inspector Cursor manuell auswählen für (Rotate/Translate)");
    20.     }
    21.  
     
  50. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    59
    MidnightGameDeveloper, hello, you do it right.
    Since there is no way to assign the cursor while creating a component, assigning it manually is the only way to do it.