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
  Change Spline Extrusion material at runtime? linkinballzpokemon 0 1 2 hours ago
Last Post: linkinballzpokemon
  Question regarding Spline Generated Path linkinballzpokemon 9 277 07-01-2020, 06:10 PM
Last Post: _Aka_
  Converting spline collider hit point to spline position jh092 7 206 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: