Skip to content

Casting non constant enum to byte causes error #136

Open
@GlitchyDev

Description

Describe the bug in detail:
[Unknown] [UdonBehaviour] An exception occurred during Udon execution, this UdonBehaviour will be halted.
VRC.Udon.VM.UdonVMException: The VM encountered an error!
Exception Message:
An exception occurred during EXTERN to 'SystemByteArray.__Set__SystemInt32_SystemByte__SystemVoid'.
Parameter Addresses: 0x00000007, 0x00000006, 0x00000008

Cannot retrieve heap variable of type 'Int32' as type 'Byte'

This is not an expected error as in theory the enum is a int under the hood, it seems the compiler gets confused when it is not a predefined constant.

Provide steps/code to reproduce the bug:
Script to reproduce will be attached

Expected behavior:
Casting works properly from enum -> byte

Additional Information:
Workaround is to cast the enum as an int then the int as a byte, indicating this is just a minor quirk in the compiler

TestingFiles.zip

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions