Material Box

Material Box

WEB Design & Material Images

Godot - Check if variable is string

Godot

GDScript code example to check if variable is string using typeof().


Can check if variable type is string using typeof() in GDScript.
Check if return value of typeof() matches "TYPE_STRING".

var text = "lemon"

if typeof(text) == TYPE_STRING:
	print("It's a string")
else:
	push_error("Not a string")

Godot

TitleGodot - Check if variable is string

CategoryGodot

Created

Update

AuthorYousuke.U