0
Cannot Reproduce

[bolt 1.2.3] Passing non-nullable value to nullable property

yyabb 3 years ago updated by Lazlo Bonin (Lead Developer) 2 years ago 2

I tried it on Bolt 1.2.3,  I can not passing a non-nullable value to a nullable property. In the same time, I can do it with C# code.

class with a nullable property: 
class Actor
{
    private Vector2? destination;
    public Vector2? Destination
    {
        get { return this.destination; }
        set { this.destination = value; }
    }
}
other script to set the destination:
actor.Destination = Vector2.zero;   // work for c#, not bolt
actor.Destination = null;           // work for c# and bolt
Bolt Version:
Unity Version:
Platform(s):
Scripting Backend:
.NET Version (API Compatibility Level):
Cannot Reproduce

What exactly is the error? I tried this with both Vector2.zero and null, and they both work.

I'll try removing the false-positive warning on the Set Destination node when passing null for v.1.3, but it's just a warning, not an error.


While I was at it, I added a default inspector for nullable value types, so you don't have to connect an external node, just leave the checkbox unchecked to indicate null: