Gamepad not detected at launch (SOLVED)

Hi, I’m trying to detect a gamepad at launch using Connected input binding but it doesnt’ work. It works if I plug the gamepad after launch or if I disconnect it and connect it again. I’m using a Dualshock 4 via USB.

This is what I have. Should I add something on init()?

function on_input(self, action_id, action)
	if action_id == hash("connected") then
		gamepad = true
	end
end

It looks like a standard gamepad. Maybe you have to use different action id.

I solved this. I have a main collection that automatically loads level 1. I was trying to detect the gamepad on level 1 collection. I move the detection script to the main collection and now it works. Leaving it here in case someone has the same issue.