Description
The manual states
"The struct passed into the function will be used to store the created node's data and the same struct will be modified when any modifications are performed on the node." ... "You can run variable_clone on your struct variable before passing it into this function to ensure a copy is made and the original struct is not referenced in the created node"
However when using it the struct is variable cloned which results in instanceVariables being incorrectly set if they are refrences to a specific struct/array.
I am not sure if this is the intended behavour or if the manual is wrong
Manual Link
https://manual.gamemaker.io/beta/en/GameMaker_Language/GML_Reference/Flex_Panels/Function_Reference/flexpanel_create_node.htm
Steps To Reproduce
var _StructObject = {
type: "Instance",
instanceObjectIndex: Obj_CraftingSlot,
instanceVariables : {
OtherObject : Obj_Test,
Array: _Array,
Struct: _Struct
}
var _NodeStruct = {
layerElements: [_StructObject],
};
var _Child = flexpanel_create_node(_NodeStruct)
flexpanel_node_insert_child(_Node,_Child,0);
will result in a debug message that it cannot variable clone an object and will result in a new struct and array being created.
Which version of GameMaker are you reporting this issue for?
IDE v2024.14.3.217 Runtime v2024.14.3.260
Which operating system(s) are you seeing the problem on?
Windows 10.0.19045.0
5b0f0766-2f3a-4abe-94d9-ad5b77d2f3ff
Description
The manual states
"The struct passed into the function will be used to store the created node's data and the same struct will be modified when any modifications are performed on the node." ... "You can run variable_clone on your struct variable before passing it into this function to ensure a copy is made and the original struct is not referenced in the created node"
However when using it the struct is variable cloned which results in instanceVariables being incorrectly set if they are refrences to a specific struct/array.
I am not sure if this is the intended behavour or if the manual is wrong
Manual Link
https://manual.gamemaker.io/beta/en/GameMaker_Language/GML_Reference/Flex_Panels/Function_Reference/flexpanel_create_node.htm
Steps To Reproduce
var _StructObject = {
type: "Instance",
instanceObjectIndex: Obj_CraftingSlot,
instanceVariables : {
OtherObject : Obj_Test,
Array: _Array,
Struct: _Struct
}
var _Child = flexpanel_create_node(_NodeStruct)
flexpanel_node_insert_child(_Node,_Child,0);
will result in a debug message that it cannot variable clone an object and will result in a new struct and array being created.
Which version of GameMaker are you reporting this issue for?
IDE v2024.14.3.217 Runtime v2024.14.3.260
Which operating system(s) are you seeing the problem on?
Windows 10.0.19045.0
5b0f0766-2f3a-4abe-94d9-ad5b77d2f3ff