How can i ref in a lambda
I want that the you can overgive a float value in this method which by running the action will overwrite it
17 Replies
so you want
past
to be ref?
or valueno, value
i want that the user can overgive a variable
value
which will set to it, by every executing of the actioncan you not define a delegate with a ref argument in this situation?
idk i dont tried
i mean you can, it's a matter of whether that works for you
example from one of my projects
the variable is always 0
My button
i forgot to ref value in the parameter, but same problem
![No description](https://answer-overflow-discord-attachments.s3.us-east-1.amazonaws.com/1248724981773238342/image.png)
test
is 0 because you did not pass it by ref
nothing is editing it![No description](https://answer-overflow-discord-attachments.s3.us-east-1.amazonaws.com/1251599185715924993/image.png)
yes, the parameter needs to be a ref parameter too
here we go again
![No description](https://answer-overflow-discord-attachments.s3.us-east-1.amazonaws.com/1251601115426848983/image.png)
ok, so, this will not work
well, it will have to be done differently
do you read from
value
inside of Lerp
, or do you only write to iti just try rewrite it
what you can do instead is pass an
Action<float>
it won't look that great, but, it would work
yeah that could work :/
but i wanted to do that you can via parameter tell which value should set
looks like there isn't a good way