Spline fence mesh end point problem

i got this fence spline, in the end of the spline it makes this weird loop

First index in ForLoop I think can be empty - it will be zero anyway, but better set 0.

But last index should be Get Number Of Spline Points -1.

Instead you can use First index 1, and Last Index Get Number Of Spline Points.

If not, you will have ForLoop error

first index is now 0, and -1 on get number of spline points. it did not remove the loop, changing last index to 2 removes loop but it removes the end pole ( i also tried first index 1 and last index without -1 that messed up the spline)

heres setting with -2 last index

is this the way it should be or can there be like “end pole” added? its mesh i created myself so its ok if i have to make a separate mesh wheres only pole if thats the way to go.

ah alright, i will do that, it makes sense. code is just from some random tutorial from youtube when i started to play with splines… im gonna check out that component and mesh tomorrow that sounds nice option. thanks for help!

I think best way would be to create end mesh, like a single pole from fence. With fence sets this is mostly done like this (with separate pole as end) even if this is placed manually in editor, not procedurally.

I don’t know why this strange shape is created, but for sure with additional end mesh will be perfect.

Other matter - I don’t know why you code this. This can be good for bigger procedural script, but as I remember (I did it few months ago), you can use spline component, set mesh and drag it where you need this fence.

I did it with this simple wall mesh:

In your fence type, you need this end pole.