I tried installing a light fixture in a previously unused light box (so cannot use how previous light was wired as a baseline).
My light fixture has a black live wire, a white neutral wire and a green ground wire.
The box in the ceiling has 2 black wires twisted together, 2 white wire twisted together, a red wire and a bare copper wire.
I wired the black box wires to the fixture black wire, the whites to the white, the copper to the green and left the red wire alone.
When I turned the breaker back on, the light was on and flipping the switch did not turn it off.
I replaced the switch, but that did not do anything.
My best guess is I wired it wrong but I have no idea what the right configuration would be.
Edit: Connecting the black light wire to the red ceiling wire fixed the issue. Thank you!