You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After porting my project from Godot 4.2.1 to 4.3 RC2 I am experiencing a warning that wasn't previously there and should not be:
Casting "Variant" to "WidgetData" is unsafe.
UNSAFE_CAST
widget_panel.gd:12
Steps to reproduce
Enable Unsafe Cast Warning in Project Settings. After attaching metadata of a custom type to an initialized object, pulling the metadata back off the object does not allow for type safety and always throws an error, no matter what is done to confirm the type. The following code, works correctly without the error in 4.2.1 stable. In 4.3 RC2 it throws an Unsafe Cast error.
extends Node2D
var only_once: bool = true
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
set_meta("data", load("res://test_resource.tres"))
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(_delta: float) -> void:
if (only_once):
if (has_meta("data")):
var test: Variant = get_meta("data")
if (test is TestResource):
var test_2: TestResource = test as TestResource
print(test_2.string_name)
only_once = false
Tested versions
Reproducible in 4.3 RC2, not reproducible in 4.2.1 stable
System information
Godot v4.3.rc2 - Windows 10.0.19045 - Vulkan (Mobile) - dedicated NVIDIA GeForce RTX 3060 Ti (NVIDIA; 31.0.15.5244) - AMD Ryzen 7 7800X3D 8-Core Processor (16 Threads)
Issue description
After porting my project from Godot 4.2.1 to 4.3 RC2 I am experiencing a warning that wasn't previously there and should not be:
Casting "Variant" to "WidgetData" is unsafe.
UNSAFE_CAST
widget_panel.gd:12
Steps to reproduce
Enable Unsafe Cast Warning in Project Settings. After attaching metadata of a custom type to an initialized object, pulling the metadata back off the object does not allow for type safety and always throws an error, no matter what is done to confirm the type. The following code, works correctly without the error in 4.2.1 stable. In 4.3 RC2 it throws an Unsafe Cast error.
Minimal reproduction project (MRP)
new-game-project.zip
The text was updated successfully, but these errors were encountered: