Skip to content

Explicit casting may not work. #115

Open
@ikuko

Description

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.

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions