0
Fixed

How to actually create a delegate in Alpha4?

Max Ivanchenko 6 months ago updated by Lazlo Bonin (Lead Developer) 3 weeks ago 3

Just testing Alpha4 - and can't create or store delegate variable like 

public event Action<string> myEvent;

if I do like this:

It works somehow in play mode! (the result is "One + two"), but if I generate code I see the error: error CS0815: Cannot assign lambda expression to an implicitly-typed variable

using just Assign node doesn't help too...

How can I score an Action in variable and use it later?

Or maybe I misunderstand delegates? sorry, but it will be nice to see examples in bolt!

Thanks!

Bolt Version:
2.0.0a4
Unity Version:
2018.3.12
Platform(s):
Scripting Backend:
.NET Version (API Compatibility Level):
Bolt 2
Working on Fix

Hi Max, thanks for the report!

I see, the issue is that var setVariable doesn't use the explicit delegate type. It should be Action<string> setVariable instead. I'll have that fixed in the next alpha.

Fixed in Alpha

Fixed for Alpha 5.