How to play music while the screen is off or locked?

how to play music while the screen is off or locked ? i am making musci player in unity and the problem that i have is that the music stop playing when the screen is off . if any one has a solution plz.

In the editor, go to Edit -> Project Settings -> Player. The inspector pane will now change to show the player settings. Look for the option that says "Run In Background" and check it . This option will be held in both the editor preview and in built games.

Let me know if that works for you or not :+1: