0 votes
extends Node2D

enum Check {
    right,
    left,
    down,
    up
}

var my_enum : Check

that does not work: the identifier Check is not a valid type (not a script, or class)
(Check) var my_enum

Godot version 3.3.2
in Engine by (143 points)

1 Answer

0 votes

Think the easy solution here is to just not type the myenum value. You can still use the enum, just set it to the myenum wherever. Example below.

enum Check { right, left, down, up }

var my_check_enum

func _ready() :
my_check_enum = Check.right

func somethingelse -> void:
my_check_enum = Check.up

by (162 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.