[BUG] ConstructionScript crash on spline with closed loop

True as of 4.7.5

If a construction script attempts to set Is Closed Loop to true on a spline, and the construction script then attempts to do something with the number of spline points (in my case, a ForLoop which operates on each point in turn), the editor will crash (if the construction script attempts to run the operation with True being set, the editor will crash on compile… if an editable var is used to determine the looping nature of the spline, the editor will crash if any placed actor has the flag changed to true).

Interestingly enough, this can be fixed by setting the default value of the component to be IsClosedLoop… once this is done, the value can be toggled freely,

Hi RhythmScript,

I just tested this in 4.7.6 but I couldn’t get your results. The only difference between hotfix 5 and 6 is a Mac fix that shouldn’t effect this. Could you provide some screenshots of your setup?

Hi RhythmScript,

We haven’t heard back from you in a few days, so we are marking this post as resolved for tracking purposes. If you’re still experiencing this issue, please feel free to post back here with additional information.

Cheers,

TJ

Still experiencing it, I’m just trying to diagnose WHY so I can provide more info. I was able to fix it with a workaround in the asset, but then it broke all older maps which used the asset (they would crash the engine on loading).

There’s definitely something going on with a construction script which modifies whether a spline is a closed loop when NumSplinePoints is accessed by the construction script (because that’s where the crash log is showing the exceptions)

Sounds good and I’m glad you found a workaround. Once you get more info for us just post back here to let us know.

Cheers,

TJ

So, I’ve told you how to reproduce it, and now I’m fairly certain my initial guess was correct (a spline-based actor whose construction script first modifies whether or not it is closed loop and then attempts to access num spline points).

I’ve looked for other underlying causes but found none; this is the error the Engine throws, which I think confirms my suspicions.

Assertion failed: !bClosedLoop || NumPoints == 0 || (NumPoints >= 2 && SplineInfo.Points[0].OutVal == SplineInfo.Points[NumPoints - 1].OutVal) File:D:\BuildFarm\buildmachine_++depot+UE4-Releases+4.7\Engine\Source\Runtime\Engine\Private\SplineCo
(note: removed bracket from the text here to make it play nice with AnswerHub’s formatting)

This is the relevant portion of the script, AFAICT (if I bypass Set Closed Loop, the system works).

Of note, as I said before, this works AS LONG AS the default setting for IsClosedLoop is TRUE… but ONLY if the actor is new to the level at the time. Right now, this actor works in the level I’m using, BUT if I try to open older levels (ones in which I placed the actor before enabling closed loop toggling in the ConstructionScript), those levels will crash on opening when they reach that asset… UNLESS I remove the ability to close the loop from the asset, in which case they open fine.

EDIT: Sorry, in order to get older levels to open, I have to disable the construction script’s ability to toggle bIsClosedLoop AND change the default back to not being closed loop.

Just wanted to say that this has been fixed in the source code version (complete overhaul of splines), so it will likely be in 4.9. If you can’t wait for that you can download the source code and compile the engine yourself and use that (perhaps not the best for full-on development).