GridTerminalSystem.GetBlocksOfType<B>(List<A>) does not populate the list, even when B extends A
Outdated
This comes up primarily in the programmable block; despite the fact that a List of objects of type A should accept any object of type B where B extends A ('class B : A' in C# syntax), and neither IDEs nor the ingame checker detect errors on that code, the list remains empty and thus useless.
Example code:
List<IMyTerminalBlock> li = new List<IMyTerminalBlock>();
GridTerminalSystem.GetBlocksOfType<IMyReactor>(li);
GridTerminalSystem.GetBlocksOfType<IMyBatteryBlock>(li);
Expected result: A list of all batteries AND reactors on the ship.
Actual result: Empty list.
I think that `GetBlocksOfType` will always clear the list, before filling it.
Try to echo how many elements the list contain, after each method call. Something like this, to examine what happens:
BTW: Also make sure that you have ownership of the corresponding reactor- and battery-blocks.
I think that `GetBlocksOfType` will always clear the list, before filling it.
Try to echo how many elements the list contain, after each method call. Something like this, to examine what happens:
BTW: Also make sure that you have ownership of the corresponding reactor- and battery-blocks.
Hello Engineer,
Thank you for your feedback! Your topic has been added between considered issues. Please keep voting for the issue as it will help us to identify the most serious bugs.
We really appreciate your patience.
Kind Regards
Keen Software House: QA Department
Hello Engineer,
Thank you for your feedback! Your topic has been added between considered issues. Please keep voting for the issue as it will help us to identify the most serious bugs.
We really appreciate your patience.
Kind Regards
Keen Software House: QA Department
Replies have been locked on this page!