0 votes

I have at problem with Labels not Updating after its properties is set.. If I add the Inventory-Instance to world Before loading new data in, then I have no problem.. but if I add the Instance after new data is set.. It will only show my old and first data? Am I using AddChild wrong or is it an Engine bug??

Note: this is a test scene, and in my big project, I have to add the Instance after loading new data.

Note : If I add the Instance to the world, remove it, set new data, and then adding it to world again .. then i works too?

//This is the buggy code

 inventory = new Inventory<Item>(20);


        inventory.Add(JsonItemLoader.ItemCreator<Item_Material>.CreateItem('F', "Lumber", AllLibraries.material_Library.AllMaterials) as Item, 20);
        inventory.Add(JsonItemLoader.ItemCreator<Item_Material>.CreateItem('F', "Lumber", AllLibraries.material_Library.AllMaterials) as Item, 40);
        inventory.Add(JsonItemLoader.ItemCreator<Item_Material>.CreateItem('F', "ScrapBar", AllLibraries.material_Library.AllMaterials) as Item, 40);
        inventory.Add(JsonItemLoader.ItemCreator<Item_Material>.CreateItem('F', "ScrapBar", AllLibraries.material_Library.AllMaterials) as Item, 40);
        inventory.Add(JsonItemLoader.ItemCreator<Item_Material>.CreateItem('F', "Scrap", AllLibraries.material_Library.AllMaterials) as Item, 65);
        inventory.Add(JsonItemLoader.ItemCreator<Item_Material>.CreateItem('F', "Scrap", AllLibraries.material_Library.AllMaterials) as Item, 65);
        inventory.Add(JsonItemLoader.ItemCreator<Item_Material>.CreateItem('F', "Scrap", AllLibraries.material_Library.AllMaterials) as Item, 65);
        inventory.Add(JsonItemLoader.ItemCreator<Item_Material>.CreateItem('F', "Scrap", AllLibraries.material_Library.AllMaterials) as Item, 65);


        inventory.Add(JsonItemLoader.ItemCreator<Item_Material>.CreateItem('F', "Scrap", AllLibraries.material_Library.AllMaterials) as Item, 88);

        AddChild(inventory.Instance);
asked Jul 24, 2019 in Engine by ronn1067 (18 points)

Please log in or register to answer this question.

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 How to use this Q&A? before posting your first questions.