This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
+1 vote

1, i create abstractScene name : player - it has Path2D as child
enter image description here

from abstractionPlayer i created 3 player by "New Inhertied Scene": black, red, yellow

Black and Red still inheritance from abstractPlayer
enter image description here

Yellow detach from abstractionPlayer by "Clear Inheritance"
enter image description here

now add 3 player to test scene
enter image description here
button "addPoint" will add data to $BlackPlayer.PlayerPath(Path2D).curve by $PlayerName.PlayerPath(Path2D).curve.addpoint(some data, doesn't matter)
enter image description here
expect:
BlackPlayer.PlayerPath.curve.get
pointcount() = 1
RedPlayer.PlayerPath.curve.get
pointcount() = 0
Yellow.PlayerPath.curve.get
point_count() =0

actual:
BlackPlayer.PlayerPath.curve.getpointcount() = 1
RedPlayer.PlayerPath.curve.getpointcount() = 1
Yellow.PlayerPath.curve.getpointcount() =0
enter image description here

Question:
1, is this bug ?
2, if not, why red had data (point) in curve while i add it only to black
3, how add data to black only without "Clear Inheritance" because if i update abstractPlayer, Yellow will not get update

Godot version 3.4.4
in Engine by (32 points)

1 Answer

+2 votes
Best answer

The reason this is happening is because BlackHairWoman and RedHairWoman both make use of the same Curve2D resource.

To change this, first open your abstract scene (Player). Select the Path2D node. In the Inspector dock click the Curve2D resource. Then click the dropdown with the word "Resource" on it. Check the checkbox labelled "Local to Scene".

This can be done for any resource, not just Curve2D. The benefit of having just one resource shared by many instances is that much less memory is used while the game runs, particularly if there are a huge number of instances. On the downside, any changes made to the resource effect all instances. By checking "Local to Scene", each instance gets its own copy of the resource in memory, which results in more memory usage, but also allows changes to individual instances.

by (180 points)
selected by

new knowledge, look like i missed somewhere in docs. Thanks

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.