Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Refresh spline doesn't seem to be working
#2
Hi,

As a general rule, the GameObject.Find method is an expensive one that should be avoided. In your case, you can avoid using it by doing this:

drawtaxiCP0002 = drawing_spline.Add ();
drawtaxiCP0002 .transform.position = v3;

instead of this:

drawing_spline.Add ().transform.position = v3;
drawtaxiCP0002 = GameObject.Find ("mousePOS/CP0001");

The reason why you had the null reference in the first place is probably because the newly created control point does not get renamed to CP0001 until the next editor update. We can go further in the path of the reasons and solutions regarding that point, but I think there is no need since there is the solution I gave above that avoid calling the Find method altogether.

If my solution does not work please let me know

Have a nice day
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply


Messages In This Thread
RE: Refresh spline doesn't seem to be working - by _Aka_ - 11-08-2019, 05:03 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Curvy Line Renderer for UI Spline? gekido 3 6 04-04-2024, 12:56 PM
Last Post: _Aka_
  Get position of all control points for a spline gekido 1 6 03-28-2024, 10:08 PM
Last Post: _Aka_
Bug Changing spline connection in inspector causes splines to revert to defaults lacota 3 6 03-18-2024, 07:55 PM
Last Post: _Aka_
  GO can't fit end of the spline GameDeveloperek4123 3 14 03-04-2024, 11:06 AM
Last Post: _Aka_

Forum Jump: