Acquiring Input from Collection Proxy Collection (SOLVED)

Hey everyone! This is my first post, thanks in advance for the help!

I have a player object that I scripted with movement and collision in my main.collection. I have started building maps and decided that I would load in each map via collection proxy as the game will risk having many different locations.

The first problem I noticed was that my player no longer had collision with the tilemap groups. I assumed this was because the player object needed to be within the same collection as the tilemap. I set fourth to duplicate my player object into the new map collection to test it out.

My camera acquires focus no problem… However the player object doesn’t seem to acquire input focus when loaded this way. Copy and pasting the exact object in my main.collection works like a charm. The moment I place my player in the collection that is loaded in via the collection proxy, my input isn’t registered.

Here is the simple line for acquiring input in my player object:

Thank you so much for your help!

1 Like

Game object with proxy component should to acquire input focus
pls, look at the forum topic Can’t get input in collection proxy
and read “Input and Collection Proxies” in documentation http://www.defold.com/manuals/input/#anchor-iacp

Thanks for the quick response! I can’t believe I missed that post, I was searching everywhere! :worried:

For reference, the problem was in fact that I was not passing input to the collection proxy. The camera acquiring focus definitely threw me off. I guess I assumed both functions were of global scope.

function init(self)
msg.post(".", “acquire_input_focus”)
msg.post("/world#level", “load”)
end

1 Like