Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Refresh spline doesn't seem to be working
#1
hi, So I'm creating a spline and adding 2 control points, when I try to get a refernce to one of them I get a null ref exception, see code below :
The following code is run ONLY ONCE while the  left mouse button is down :
Code:
drawmousePOS_OBJ = GameObject.Find ("mousePOS");

drawmousePOS_OBJ.AddComponent<CurvySpline> ().Interpolation = CurvyInterpolation.Bezier;
drawing_spline = drawmousePOS_OBJ.GetComponent<CurvySpline> ();
drawing_spline.Add ().transform.position = v3;
drawing_spline.Add ().transform.position = v3;


drawing_spline.SetDirtyAll ();
drawing_spline.Refresh ();

drawtaxiCP0002 = GameObject.Find ("mousePOS/CP0001");
Debug.Log (drawtaxiCP0002.transform.position ); // this line creates a null ref exception
 

the spline & 2 control points are definately there.

But if i change the code so that 
Code:
drawtaxiCP0002 = GameObject.Find ("mousePOS/CP0001");

Debug.Log (drawtaxiCP0002.transform.position ); // works as expected !!

is ran  after the first time the mouse button is down it works.

It even though I'm refreshing the spline it seems like it wont refresh until update is run again.
Reply


Messages In This Thread
Refresh spline doesn't seem to be working - by dazz777 - 11-08-2019, 01:44 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: