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
  Change Spline Extrusion material at runtime? linkinballzpokemon 0 1 2 hours ago
Last Post: linkinballzpokemon
  Question regarding Spline Generated Path linkinballzpokemon 9 276 07-01-2020, 06:10 PM
Last Post: _Aka_
  Converting spline collider hit point to spline position jh092 7 205 06-26-2020, 09:48 PM
Last Post: _Aka_
  Null reference when spline controller added runtime jh092 1 115 06-19-2020, 09:21 AM
Last Post: _Aka_

Forum Jump: