Pass-by-Reference in EventDispatcher

noillimryM
Sun, 11 Jul 2021 17:35:24 +0000
Editor Scripting

Hi everbody,

I have two questions regarding the use of the Pass-by-Reference option for the Inputs in an EventDispatcher :

1. I am not quite sure to fully understand what it is used or useful for ?

For example, I have an EventDispatcher with the following inputs :

Given that my Object input’s type is already an Object Reference (what I picked from the drop-down list), what would be the difference if I would enable the Pass-by-Reference option then ?

2. Furthermore, I did try with and without this option to see if there was any noticeable difference, and yes there is. If I enable the Pass-by-Reference I get a warning which reads :

No value will be returned by reference. Parameter 'Object'.

But even though it says that “no value will returned by reference”, on the receiving end of my EventDispatcher I can definitely retrieve the reference and cast it to whatever I need to. It works perfectly fine and in a completely similar manner whether or not the Pass-by-Reference is enabled and regardless of the warning.

Questions)

1 : In which situation and why would I want to Pass-by-Reference something that is already a reference ?

2 : What does this warning mean ? There’s definitely a value which is returned since I can use/test/cast the reference whether the Pass-by-Reference option is used or not.

I want to emphasize I did my fair share of research on the matter, but all the informations seem to be clashing between one another. Some say it’s a long time bug, some say it’s a normal warning, some say this warning doesn’t make sense, … . So it is really hard for me to wrap my head around this option and fully understand what it does and if I could actually need it.

Thanks a lot in advance !!

2 posts - 2 participants