hi
i am passing an array into a function by reference
i am not again returning the array via the return node
the array is a variable / global variable as opposed to a local variable
the array is not updated after the function call, but in the function call
i would have expected the array as (non local) variable to be updated without necessarily explicitly passing the array back after the function via a return node
why is this so
thanks
Everynone
(Everynone)
February 6, 2025, 8:24am
2
Your expectations are correct and this Prints True
:
What are you doing differently?
the array is not updated after the function call, but in the function call
How do you update it?
i save it in the function to be able to work on it in the function and to better structure it
i suppose i am either doing something wrong or i mess it up because i am adding 1 degree of ‘distance’
i need to pass back the variables via the return node for it to work
i think that 1 instance / case of saving it as local variable first is enough to ‘crash’ the intented purpose
see if you can perhaps suggest a better approach
i am also using set array element to write to the array
Everynone
(Everynone)
February 6, 2025, 8:35am
4
You mean this?
You’ve manually created a new local variable? If you create a copy, you will work on the copy.
Function inputs automatically become variables that are already accessible in the function’s scope:
No need to create additional ones.
In UE5.5 this is much, much clearer now, we get icons:
->f
is the automatically created one - use that
V.
is a manually created local var
This does not matter if you’re working with references, but does matter when working with basic types.
yes i suppose i have created copies
the reason for saving it in the function is so that i can pass different variables into the function, ie reuse the function b
but more importantly to keep the function itself tidy
i did recently move to 5.5 and the icons did initially take me back but i have begun to grasp their meaning
Everynone
(Everynone)
February 6, 2025, 8:43am
6
No need to do any of this:
Give it a go.
yes i just re read your post
will look for the variables in function scope
how do you actually access it (the function input variables)
i am used to looking under (global) variables and local variables
and i dont see it there
must you right click or something
i see i can source them with right click
will be great if there is a function variables tab or slot like there is one for local variables and global variables
yes this is what tripped me
i prefer working from the variable tabs not so much right click
but your approach is a lot better than my so i suppose i have no choice right now other than right click
Everynone
(Everynone)
February 6, 2025, 9:00am
12
I never thought of that but… yeah, I’d wholeheartedly welcome that! It’s a great idea.
Tell us how to improve our tools!
Feature request it. #remindmein1year
lol
your approach is far better but it is slow to implement
i cant drag variables over variables anymore or replace variables etc
i absolutely need to locate the variable first via right click
Everynone
(Everynone)
February 6, 2025, 9:14am
14
Yup, local variable drag-replace never worked too well, tbh.
system
(system)
Closed
March 8, 2025, 9:15am
15
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.