Conversions to list and array too permissive, causing silent bugs

Dunathan 1 year ago updated 1 year ago 5 1 duplicate

The count node uses List<String> and is counting List<GameObjects>, it doesn't fire errors and even give a "0" result.

Bolt Version:
Bolt 2 Alpha 5
Unity Version:
Scripting Backend:
.NET Version (API Compatibility Level):
.NET 4.x
Bolt 2
Satisfaction mark by Dunathan 1 year ago

Duplicates 1

Thanks for the report, I'll have it fixed in the 2.0 cycle.

Fixed (Unreleased)

Hi Duna Games,

Thanks for the report and sorry for the late reply.

This will be fixed in the next version.

Basically, Bolt 1 was very loose in automatic conversions to lists. It allowed any element type for the source enumerable and only returned elements that matched the destination element type. In this case, it was converting your List<GameObject> to a List<string>, and thus it picked only elements in the first list that were strings -- aka, none of them, hence why it returned zero as the count of the converted list.

In the next version, element type compatibility will be enforced.

So you'll be able to convert from a List<Collider> to a List<BoxCollider>, for example. But not from a List<GameObject> to a List<string>.

Hi Duna Games,

Sorry for the very late reply on this.

This is related to another issue which I just fixed, I'll merge your threads.

You`r awesome!