Open Seb105 opened 5 days ago
So I thought this was an issue just with C# but it does it with GDscript too, This MRP has both examples: brokentool_v2.zip
@tool
extends Node3D
class_name ThisIsAToolGodot
@export var toggle: bool = false :
get:
return toggle
set(value):
toggle = value
toggle_set()
func toggle_set():
var root = EditorInterface.get_edited_scene_root()
var node = ThisIsNotAToolGodot.new()
root.add_child(node)
node.set_owner(root)
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
toggle_set() # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
extends Node3D
class_name ThisIsNotAToolGodot;
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
print("This is not a tool")
Tested versions
v4.3.stable.mono.official [77dcf97d8]
dotnet --info
System information
Godot v4.3.stable.mono - Windows 10.0.22631 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3070 (NVIDIA; 32.0.15.6094) - AMD Ryzen 9 5950X 16-Core Processor (32 Threads)
Issue description
When creating a node from a C# tool script, even if the created node is not a tool, it runs its _process function as if it was until the editor is restarted
I may be just misunderstanding how tools work, but I thought that nodes that are not tools should never be able run code in the editor.
Steps to reproduce
[GlobalClass, Tool] public partial class ThisIsATool : Node3D { [Export] public bool Toggle { get => _toggle; set { _toggle = value; CreateBrokenNode(); } } private bool _toggle = false; // Called when the node enters the scene tree for the first time. public override void _Ready() { }
}
Minimal reproduction project (MRP)
brokentool.zip