Factory problem (SOLVED)

I have a problem with factory and can’t verify why the factory.create can’t find instance of a factory.
I have a game object:


instantiated in main.collection and I’m trying to create those two factories like that in light.script:

go.property("is_fire", false)
go.property("core_color", vmath.vector4(2, 1.8, 0.1, 1))
go.property("glow_color", vmath.vector4(2, 0.6, 0.1, 0.9))

function init(self)
	self.core = factory.create("core", go.get_position())
	self.glow = factory.create("#glow", go.get_position())
	msg.post(self.core, "tint", { color = self.core_color} )
	msg.post(self.glow, "tint", { color = self.glow_color} )
	if self.is_fire then
		msg.post(self.core, "fire", { isCore = true })
		msg.post(self.glow, "fire", { isCore = false })
	end
end

and gets:

ERROR:SCRIPT: /environment/lights/light.script:6: The component could not be found
stack traceback:
[C]: in function ‘create’
/environment/lights/light.script:6: in function </environment/lights/light.script:5>

Maybe do you see any mistakes? Or what am I conceptually making wrong?

Looks like you are missing a # before core in the first factory.create call! :slight_smile:

5 Likes

Yep, sometimes I’m amazed how those smalls mistakes are getting me stuck and desperately looking for a help :stuck_out_tongue: thank you very much! :wink:

3 Likes