godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
88.81k stars 20.14k forks source link

Why can't I modify the CollisionShape2D node attribute value radius, AnimationPlayer node time length, etc. when I create a new scene inheritance? #95362

Closed ice-ko closed 1 month ago

ice-ko commented 1 month ago

Tested versions

Godot_v4.3-rc2

System information

Godot v4.3.rc2 - Windows 10.0.22631 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3060 Laptop GPU (NVIDIA; 32.0.15.5599) - 12th Gen Intel(R) Core(TM) i7-12700H (20 Threads)

Issue description

Are the properties of the newly created inherited scene nodes allowed to be modified in the child scene? If all node properties cannot be modified, does inheritance lose its meaning?

Steps to reproduce

no

Minimal reproduction project (MRP)

test.zip

smix8 commented 1 month ago

Resources are shared by default and e.g. a CollisionShape2D node uses a Shape2D resource which is shared across all scene instances by default.

You are not editing the CollisionShape2D node, you are editing the Shape2D resource radius which affects all other nodes that use the same resource, so all your scene instances. Same with animation resources which is why you cant e.g. change length or loop property without creating a copy.

If you dont want that you need to duplicate() the resource in script, or set to local_to_scene with the editor gui. This creates a unique copy of the resource that can have its own property values.

smix8 commented 1 month ago

Closing as this was just a knowledge-gap and the resource system is already documented.