+1 vote

I just found what I think it’s a bug and I would like someone to corroborate this.

I have a custom resource with a variable:

export (Array) var test0 = [null]
export (Array) var test1
var test2 = [null]
export (String) var name = ""

Then I have a node with the following function:

func set_pages():

    var page1 = c_resource.new()
    page1.test0.resize(13)
    page1.name = str("Chest_Inventory_Tab",inv_pages.size())
    inv_pages.append(page1)

    var page2 = c_resource.new()
    page2.test0.resize(4)
    page2.name = str("Chest_Inventory_Tab",inv_pages.size())
    inv_pages.append(page2)

This function generates an array with 2 resources I would expect the first Resource in inv_pages to have an array with a size of 13 and the second resource inside inv_pages to have an array with size 4.

The 2 new resources have their variable name properly set but the array variable test0 has a size of 4 on every resource.

Using test1, which doesn’t have a preset value, doesn’t have this problem and the same goes for test2 which has a value but it’s not an export variable.

in Engine by (404 points)
edited by

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 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.