Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script inheriting SplineController doesn't work the same as adding component?
#1
I'm working on a "2.5D" game where you control a character that moves along a spline. I'm new to this level of development so I'm having trouble finding information in the documentation. I did find a suggestion to create a script that inherits SplineController but it's not working the way I expected. In the inspector, all the controls of the SplineController appear. However they don't seem to apply to the character and the character doesn't snap to the spline the way they did with the component.

Code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class scrPlayerSpline : FluffyUnderware.Curvy.Controllers.SplineController
{

   // Start is called before the first frame update
   void Start()
   {
       
   }

   // Update is called once per frame
   void Update()
   {
       
   }
}

What am I missing? I've selected a spline for the controller in the inspector.
Reply
#2
Hi,
It is because your class defines the Start and Update as empty methods, so the code from the base class is never called. You should either remove these two methods, or replace them with those:

Code:
void Start () {
    base.Start();
}

void Update () {
    base.Update();
}

Don't hesitate to ask any other question if you have one
Have a nice day
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Refresh spline doesn't seem to be working dazz777 6 423 01-22-2020, 12:55 AM
Last Post: _Aka_
  make "GetCurrentControlPoint" in SplineController more accessable VampirasuGameStudio 1 83 01-08-2020, 11:12 PM
Last Post: _Aka_
  SplineController Delta after instantiate(Bug?) Marc Mitchell 5 461 11-26-2019, 08:38 PM
Last Post: _Aka_
  Change default settings when adding a point UsernameHed 3 673 07-31-2019, 11:03 AM
Last Post: _Aka_

Forum Jump: