all inherited scene have same value data

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By RyuShai

1, i create abstractScene name : player - it has Path2D as child

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

Black and Red still inheritance from abstractPlayer

Yellow detach from abstractionPlayer by “Clear Inheritance”

now add 3 player to test scene

button “addPoint” will add data to $BlackPlayer.PlayerPath(Path2D).curve by $PlayerName.PlayerPath(Path2D).curve.add_point(some data, doesn’t matter)

BlackPlayer.PlayerPath.curve.get_point_count() = 1
RedPlayer.PlayerPath.curve.get_point_count() = 0
Yellow.PlayerPath.curve.get_point_count() =0

BlackPlayer.PlayerPath.curve.get_point_count() = 1
RedPlayer.PlayerPath.curve.get_point_count() = 1
Yellow.PlayerPath.curve.get_point_count() =0
enter image description here

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

:bust_in_silhouette: Reply From: haydenv

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.

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

RyuShai | 2022-05-25 10:36