Spline mesh component array > get ref?

hello there,

i am trying to get a spline mesh component from an array by index number.
like this with a float array:


and now with the spline mesh component array:


why i cant get a reference? :open_mouth:

so, to ‘get a copy’ doesnt mean ‘spawn a new component’ ?


This is still a reference, don’t worry! Get a copy of a reference doesn’t need optimization, it works well!

And also you cannot get a reference to a reference, it doesn’t exist in C++ , so while you get a copy, you are directly getting a reference to the object and this last one is completely outside of the array… But the object is always the same.

You can get as many references of an object as you want, they are all different references but the object is always the same.

Hope it helps!

No it doesn’t , the engine is well designed, you can get a real copy of a “primitive” like integers because it is not dangerous to do so(copy vs references performance on primitives are not too scary, unless they are not many!)

But when we do such operations on objects (maybe giant objects) the difference exists!

A good programming design is to not allow clients to copy those objects and give a system and methods to the clients to safely do operations on the objects.

UnrealEngine do so… You can bet!

Nice to help!

ok. thanks for your help mate! :slight_smile: