MerlinVR / UdonSharp

An experimental compiler for compiling C# to Udon assembly
MIT License
678 stars 89 forks source link

Explicit casting may not work. #115

Open ikuko opened 3 years ago

ikuko commented 3 years ago

Describe the bug in detail: It was not cast in the generated UASM even though I explicitly instructed it to cast. It is possible to work around this by going through temporary variables, but the behavior doesn't match and it feels strange.

Provide steps/code to reproduce the bug:

public class Example : UdonSharpBehaviour
{
    private void Start()
    {
        var color32 = new Color32();
        var obj = (object)color32;

        // Udon=OK C#=OK
        var arg = (Color32)obj;
        Method(arg);

        // Udon=NG C#=OK
        Method((Color32)obj);
    }

    void Method(Color color)
    {
        Debug.Log($"{color}");
    }
}

Expected behavior: Should behave the same as C#.

Additional Information: Provide any additional information here.

MerlinVR commented 3 years ago

This is resolved in 1.0.