-
-
Notifications
You must be signed in to change notification settings - Fork 270
Open
Labels
c: coreCore componentsCore componentsquality-of-lifeNo new functionality, but improves ergonomics/internalsNo new functionality, but improves ergonomics/internals
Description
When duplicating a node of a known sub-node type such as
let original = Sprite2D.new_alloc();
let duplicate = original_node.duplicate().unwrap(); //will be of type Gd<Node>
let cast_duplicate = duplicate.cast::<Sprite2D>();
//You can now do Sprite2D stuff with your duplicate herethe duplicate will be a Gd<Node> instead of the same type as the original. If you intend to do anything with the duplicate it will require down-casting to the type of the original. I suggest adding turbofish support for duplicate in order to reduce the number of required casts.
Example of suggestion:
let original = Sprite2D.new_alloc();
let my_duplicate = original_node.duplicate::<Sprite2D>();
//You can now do Sprite2D stuff with your duplicate hereMetadata
Metadata
Assignees
Labels
c: coreCore componentsCore componentsquality-of-lifeNo new functionality, but improves ergonomics/internalsNo new functionality, but improves ergonomics/internals