Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Not able to access existing spline from custom script
#1
Hi,
I am new to Curvy and need help in accessing one existing CurvySpline from a custom script. 
So, I have created one CurvySpline name "XYZ". And then created one cube and attached the below script to this cube. When I run the scene, I expect the cube to move along the spline. 
In the below script, I dragged the curvy gameObject into the public variable "spline". But I am getting the error "NullReferenceException: Object reference not set to an instance of an object
TesterScript+<Start>c__Iterator35.MoveNext () (at Assets/Scripts/TesterScript.cs:11)



However, In the editor if I just add the SplineController script to the cube, then it starts moving along the spline without any issues. So, not sure what am I doing wrong. 
Can you please help me !!!



using UnityEngine;
using System.Collections;
using FluffyUnderware.DevTools;

public class TesterScript : FluffyUnderware.Curvy.Controllers.SplineController
{
    public FluffyUnderware.Curvy.CurvySpline spline;
    // Use this for initialization
    IEnumerator Start()
    {
            while (!spline.IsInitialized)
                yield return 0;
    }
    void Update () {
        if (spline && spline.IsInitialized)
        {
            Debug.Log(spline.name);
            Spline = spline;
            Speed = 20;
        }
    }
}


Regards,
Siloni
Reply


Messages In This Thread
Not able to access existing spline from custom script - by silonighora - 12-02-2015, 05:34 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Spline Spots from 2 samples. BitBlit 8 916 06-30-2026, 11:49 AM
Last Post: _Aka_
  Best way to duplicate a spline with an offset Kapistijn 8 2,299 04-12-2026, 03:18 PM
Last Post: _Aka_
Smile Constant speed along a spline? tfishell 1 939 11-13-2025, 11:32 AM
Last Post: _Aka_
  SplineController Ignores Follow-Up and Chooses Wrong Spline Josenildo 7 5,059 07-29-2025, 09:15 PM
Last Post: _Aka_

Forum Jump: