Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Not able to access existing spline from custom script
#2
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
Reply


Messages In This Thread
RE: Not able to access existing spline from custom script - by silonighora - 12-03-2015, 03:26 AM

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_
  Adjust radius of generated mesh via script? Shackman 1 4 03-26-2024, 01:12 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_

Forum Jump: