Never direct connect to a database from a game. Everyone that uses your game can read your username / password. Use a webserver + pup to encapsulate the db functions.
In the case that this isn’t a game but an application that should connect to the users local database, you should put database queries into a desperate thread. Using coroutines won’t help here since the database query is like an atomic instruction unless you use asynchronous queries which also uses a seperate thread.
Can you give a bit more details about what you actually do? Is it a game or is it just an application?
I’m more than certain that it lags because it waits for the database reply in the frame you’re in when you call the query. You should not block the game while you wait for your query result. Try putting the connection code and query code into coroutines so you don’t block your game while waiting for them.
Hi quantum_rez,
I work at android app that should connect to online database.
On PC and on unity editor it work; but if i build apk itsnt work.
How u do to work it?
Have u add uses permission in AndroidManifest?