I cannot set a position when creating an object with factory

Hi, I’m trying to display a text message when you mouse over an image.
I can manage to display a text message at the position set in the prefab object, but cannot display it at the position specified in factory.create().

The code below is “main.script”.

function on_input(self, action_id, action)
		if action_id == nil then
		if self.explanation == nil and action.x > 600 and action.x < 700 and action.y > 350 and action.y < 400 then
			local p = vmath.vector3(action.x, action.y, 0)
			self.explanation = factory.create("#testfactory",p)

		elseif self.explanation ~= nil then
			print("explanation:",self.explanation)
			go.delete(self.explanation)
			self.explanation = nil
		end
	elseif action_id == hash("touch") and action.pressed then
		print("Touch!")
	end
end

Thanks for your help!

Check you Z position maybe? Setting it to 0 might be putting it directly behind everything.

Thank you for your attention!
I tried with 1 and 100 at z position, but nothing changes…

You may also need to convert your coordinates from screen to world. Action x and y are where the mouse is on the screen, not where it is in game.

This is the first time I’ve heard “converting to world”, and I’m not sure I understand it correctly.
It’s a visual novel and I don’t use render camera.
So I don’t think I need to convert it probably.

I place whatever coordinates in the factory.create(), the text message doesn’t move from the prefab position.
So I don’t think it’s something to do with the coordinates I put but something else.

It’s hard to say what’s wrong. Perhaps you could share a small example project where we can try ourselves?

Hi, I just solved this.
I set gui to the go so I send a message to set the position of the gui to the script (gui_script) of the gui.
I think the position you specify in factory.create() is just the position of the go, so I need to specifically set a position for the gui in the go.
Thank you for all your help!
test_20240603.zip (900.1 KB)