3
« on: January 11, 2016, 12:00:10 AM »
I am trying to create something similar to the follow script example that you have provided. In my scenario I am trying to update the tweens destination location via script. So rather than a true follow I just need to access and manipulate mid tween. For some reason I am getting a NuffRef though my script is quite similar to your follow.cs example. Below is the relevant code. I am getting the null reference when trying to change the end value.
Tweener shipLaneTween;
void Start () {
//Start Tween For Lane Switching
shipLaneTween = transform.DOMoveX(LM.laneArray [shipLaneDestination].x, 0.5f).SetAutoKill(false);
}
void FixedUpdate () {
if (shipLaneCurrent != shipLaneDestination) {
SwitchLane ();
}
}
public void SwitchLane(){
shipLaneTween.ChangeEndValue(LM.laneArray [shipLaneDestination].x,true).Restart();
}