12-03-2015, 03:26 AM
Well actually I was trying to move a cube along a path through a script. Since, my script above was getting the error, I was not able to move it. Now, I did the following and its working:
1. Created the Spline in the editor.
2. Created a cube.
3. Attached the testerScript(Custom Script) and the SplineController.cs(Curvy Script) to the cube.
4. Play the Game.
testerScript(Custom Script)
----------------------------------------------------------------------
using UnityEngine;
using System.Collections;
using FluffyUnderware.DevTools;
using FluffyUnderware.Curvy.Controllers;
using FluffyUnderware.Curvy;
public class TesterScript : MonoBehaviour
{
public GameObject spline;
CurvySpline cSpline;
SplineController sController;
// Use this for initialization
void Start() {
cSpline = spline.GetComponent<FluffyUnderware.Curvy.CurvySpline>();
if (cSpline != null)
{
sController = GetComponent<SplineController>();
sController.Spline = cSpline;
sController.Speed = 20;
}
}
void Update() {
if (sController.IsInitialized) {
sController.Play();
sController.Refresh();
}
if (spline == null) { }
else
{
}
}
}
Thanks,
Siloni
1. Created the Spline in the editor.
2. Created a cube.
3. Attached the testerScript(Custom Script) and the SplineController.cs(Curvy Script) to the cube.
4. Play the Game.
testerScript(Custom Script)
----------------------------------------------------------------------
using UnityEngine;
using System.Collections;
using FluffyUnderware.DevTools;
using FluffyUnderware.Curvy.Controllers;
using FluffyUnderware.Curvy;
public class TesterScript : MonoBehaviour
{
public GameObject spline;
CurvySpline cSpline;
SplineController sController;
// Use this for initialization
void Start() {
cSpline = spline.GetComponent<FluffyUnderware.Curvy.CurvySpline>();
if (cSpline != null)
{
sController = GetComponent<SplineController>();
sController.Spline = cSpline;
sController.Speed = 20;
}
}
void Update() {
if (sController.IsInitialized) {
sController.Play();
sController.Refresh();
}
if (spline == null) { }
else
{
}
}
}
Thanks,
Siloni