Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error: Calling TeleportBy on a controller that is stopped
#1
Hi,

I notice whenever I open my project, or after pressing stop if it's running, I get lots of this error. It runs fine so I am not sure if it's a big deal but it's a bit annoying seeing it fill the console every time I open the project. Like I say no run-time errors at all it's only when I press stop or on loading the project. Is there something obvious I am missing that would stop this from happening? I did search the forum and Google but couldn't find anything.

Full error (latest version of Curvy and Unity):

[Curvy] Calling TeleportBy on a controller that is stopped. Please make the controller play first
UnityEngine.Debug:LogError(Object)
FluffyUnderware.DevTools.DTLog:LogError(Object) (at Assets/Plugins/DevTools/Classes/DTUtility.cs:848)
FluffyUnderware.Curvy.Controllers.CurvyController:TeleportBy(Single, MovementDirection) (at Assets/Plugins/Curvy/Controllers/CurvyController.cs:1042)
FluffyUnderware.Curvy.Examples.TrainCarManager:LateUpdate() (at Assets/Plugins/Curvy Examples/Scripts/TrainCarManager.cs:67)


Thanks
Reply
#2
Hi,
Can you please send me a reproduction case?
Thanks
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#3
(07-11-2020, 01:08 PM)_Aka_ Wrote: Hi,
Can you please send me a reproduction case?
Thanks

Hi, if you load the train-12 example scene, on the train object -> trainmanager script... the issue seems to be if you change the axle size to less than 9, then if you turn the train object or trainmanager on or off it triggers this error (this is just a quick way to reproduce the error I now get on loading the project or stopping it playing) .... it's probably something very specific that doesn't actually matter so don't want to waste your time on it but yeah something to do with the axle size it seems!
Reply
#4
I replaced the implementation of LateUpdate with this to avoid the issue:
Code:
void LateUpdate()
        {
            if (!mTrain)
                return;

            if (BackAxis.Spline == FrontAxis.Spline &&
                FrontAxis.RelativePosition > BackAxis.RelativePosition)
            {
                float carPosition = Waggon.AbsolutePosition;
                float frontAxisPosition = FrontAxis.AbsolutePosition;
                float backAxisPosition = BackAxis.AbsolutePosition;

                if (Mathf.Abs(Mathf.Abs(frontAxisPosition - backAxisPosition) - mTrain.AxisDistance) >= mTrain.Limit)
                {
                    FrontAxis.AbsolutePosition = carPosition + mTrain.AxisDistance / 2;
                    BackAxis.AbsolutePosition = carPosition - mTrain.AxisDistance / 2;
                }
            }
        }
I haven't tested it thoroughly. Will do before the next release.

Let me know if you have any question related to this.
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
#5
(07-11-2020, 08:54 PM)_Aka_ Wrote: I replaced the implementation of LateUpdate with this to avoid the issue:
Code:
void LateUpdate()
        {
            if (!mTrain)
                return;

            if (BackAxis.Spline == FrontAxis.Spline &&
                FrontAxis.RelativePosition > BackAxis.RelativePosition)
            {
                float carPosition = Waggon.AbsolutePosition;
                float frontAxisPosition = FrontAxis.AbsolutePosition;
                float backAxisPosition = BackAxis.AbsolutePosition;

                if (Mathf.Abs(Mathf.Abs(frontAxisPosition - backAxisPosition) - mTrain.AxisDistance) >= mTrain.Limit)
                {
                    FrontAxis.AbsolutePosition = carPosition + mTrain.AxisDistance / 2;
                    BackAxis.AbsolutePosition = carPosition - mTrain.AxisDistance / 2;
                }
            }
        }
I haven't tested it thoroughly. Will do before the next release.

Let me know if you have any question related to this.
Have a nice day

Hi thanks for this, seems to have fixed it and still works fine Smile
Reply
#6
You are welcome
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
  Null reference when spline controller added runtime jh092 1 187 06-19-2020, 09:21 AM
Last Post: _Aka_
  Extrusion does not match Controller position JasperBPT 3 361 05-26-2020, 10:18 PM
Last Post: _Aka_
  instantiate Spline Controller at runtime PretzelStudios 2 404 05-07-2020, 09:03 PM
Last Post: PretzelStudios
  Setting Spline to be used by Spline Controller FritsLyn 1 338 05-04-2020, 08:42 PM
Last Post: _Aka_

Forum Jump: