I tried to set up a signal that would pass an IEnumerable<Rect2> to the receiver, however when trying to do this the Enumerable was empty according to the receiver. I investigated to ensure the Enumerable was not empty upon Emit.
//Inside emitter class
[Signal]
public delegate void SelectionMade(IEnumerable<Rect2> squares);
//Inside receiver class
private void _on_GameManager_SelectionMade(IEnumerable<Rect2> squares)
{
SelectionSquares = squares;
Update();
}
After this I tried changing the type of the signal's parameters (and receiving method) and noticed inconsistent behaviour with the use of arrays.
The following is perfectly functional and results in desired behaviour with no warnings or errors.
//Inside emitter class
[Signal]
public delegate void SelectionMade(int[] squares);
//Inside receiver class
private void _on_GameManager_SelectionMade(int[] squares)
{
Console.WriteLine(squares);
Update();
}
However changing the array type from int[] to double[] results in the following errors:
//Inside emitter class
[Signal]
public delegate void SelectionMade(double[] squares);
//Inside receiver class
private void _on_GameManager_SelectionMade(double[] squares)
{
Console.WriteLine(squares);
Update();
}
E 0:00:00.880 _get_signal: Unknown type of signal parameter: 'squares' in 'GameManager'.
<C++ Source> modules/mono/csharp_script.cpp:2506 @ _get_signal()
I tried a primitive array with the following primitive types:
bool, gave the error above.
int, worked.
uint, gave the error above.
float, worked.
double, gave the error above.
ulong, gave the error above.
Steps to reproduce
I have attached a repro project, which consists of only two source files and two classes.
There is only a single signal used which is connected via the _Ready() method of the Emitter class.
Simply running the game should be enough to reproduce the issue.
To try different Array and Collection types simply change:
The signal declaration to your desired type T.
The receiver method to your desired type T.
The Emit call within Emitter to pass the correct type T.
Godot version
v3.4.5.stable.mono.official [f9ac000d5]
System information
Windows 10
Issue description
I tried to set up a signal that would pass an
IEnumerable<Rect2>
to the receiver, however when trying to do this the Enumerable was empty according to the receiver. I investigated to ensure the Enumerable was not empty upon Emit.After this I tried changing the type of the signal's parameters (and receiving method) and noticed inconsistent behaviour with the use of arrays.
The following is perfectly functional and results in desired behaviour with no warnings or errors.
However changing the array type from
int[]
todouble[]
results in the following errors:I tried a primitive array with the following primitive types:
Steps to reproduce
I have attached a repro project, which consists of only two source files and two classes.
There is only a single signal used which is connected via the
_Ready()
method of theEmitter
class.Simply running the game should be enough to reproduce the issue.
To try different Array and Collection types simply change:
T
.T
.Emit
call withinEmitter
to pass the correct typeT
.Minimal reproduction project
[Uploading Repro.zip…]()