Collections Factory Properties, HTML5 (DEF-2003)

When I creating collection by collection factory and in constructor set up properties:

local params = {}
params[hash("/player")] = { enable_input = true }; 
params[hash("/bow")] = { enable_input = true };
collectionfactory.create("#player_factory", vmath.vector3(0, 0, 0), vmath.quat(), params, nil);

In standalone build all ok. I can get property in object player for example:

-- player.script
go.property("enable_input", false)

function init(self)
    if go.get("#", "enable_input") then
    	msg.post(".", "acquire_input_focus");
    end
end

But in HTML5 version this property is no setted and go.get() returning false. Strange differents behaviour.

Hmm, that sounds strange. I just tested it with Defold 1.2.85, and it works for me (Assuming I got a similar setup of the scene):

I got a “level.collection”:

--+ Collection
   ---+ go
      ---+ test.script

test.script:

go.property("enable_input", false)
function init(self)
	print("Init: enable_input: " .. tostring(go.get("#", "enable_input")))
end

in main.script, I create my level.collection:

local params = {}
params[hash("/go")] = { enable_input = false }; 
local test = collectionfactory.create("levels#testfactory", vmath.vector3(0, 0, 0), vmath.quat(), params, nil);

What is you result when printing out the value of go.get("#", "enable_input") ?
What does you collection look like? Does the “bow” have a script too?

Also, I’m wondering if sending “enable_input” to two objects is what you want? The input focus is implemented as a stack, so only one script can have focus at a time.

Thanks for your note, i will check it (about two inputs)

About my problem: for now i have next strructure (Defolt 1.2.85)

-- game.collection
  -- object with collection factory

-- player.collection
  --player.go
    --player.script
  --bow.go
    --bow.script

in both script I do print
"print("bow/player enable: " .. tostring(go.get("#", "enable_input")) )"

In stadalone build i got:

DEBUG:SCRIPT: bow enable: true
DEBUG:SCRIPT: player enable: true

In HTML build i got:

DEBUG:SCRIPT: bow enable: true
DEBUG:SCRIPT: player enable: false

I will check different situations later (will try fix this multiple acquire_input and other)

1 Like

Now I tested with more than 1 object in the collection, and now I got the same strange behavior. Created an issue (DEF-2003)