- Home /
Problem Unsolvable
how can I establish a safe SQLite connection
Hello, I'm using SQLite to store prefab data for Players, Characters, Enemies Items and basic Events. The Build platform is for a Standalone Windows project. I'm trying to achieve on the fly database loading when a character is instantiated but im running into a few problems when it comes to building the game.
When i set up a new connection the it defaults to the project folder,
MYUnityGame\Data.db
when i build the game Data.db isn't transferred obviously, so i have to move it manually to the executable location and it will work. but there is a problem, the .db format can be edited directly with a text editor such as notepad++. this presents a serious problem for game integrity as you can force characters to start at maximum level by the values.
heres a pic of the database editor window for unity, and data.db in notepad++
so far i have found little information on fixing this within SQLite. so i thought i could change the connection directory to inside the Assets folder since unity encrypts it.using this
MYUnityGame\Assets\Data.db
assuming that unity would handle the request and return the connection. I was wrong. this works in the editor and only in the editor, when the game is built the compiler can't find the assets folder and thus can't find data.db. I thought about Resources.Load but the database isn't a unityEngine.Object unless i make wrapper class, but i don't think SQLite will understand it anyway since it requires a file directory.
Is there a way i can tell the compiler where the database is in Unity Assets Archive and have unity retrieve it? if not how do i prevent people from editing the database via text editors? (googled already you can't encrypt databases, the answer is no).
if the answer is SQLite is a no no. can you list some alternative API or would it be better for me to create my own?
please comment if you need more information and any help regarding this issue is greatly appreciated.
Any data you keep locally can be edited. No matter what you do there is always a way of "hacking" or cheating at singleplayer games. Whether it's via a memory editor, just changing the save files or decompiling the project and replacing the DLLs with your own.
Ins$$anonymous$$d of spending a stupid amount of time implementing security that will just get broken anyway, why not just work on the game itself? If people want to hack, who cares? No one else gets affected.
If you have a multiplayer game and are worried about client side hacking, you're doing something wrong :P
I understand that, heck they probably made something that decompresses any unity game by now, but with a text editor? Isn't that a bit ridiculous? You're right though I think I'll worry about later if at all. could just change the file type to .DLL
Follow this Question
Related Questions
Looking for step-by-step manual how to configure SQL Lite on Unity 2017 ( or other database) 1 Answer
Unity/C# - Is it possible to connect an Azure (cloud) database, to a Unity game, via EnityFramework? 1 Answer
Hiding the SQLite file 0 Answers
Best Way To Store Credentials and Data Online? 1 Answer
VR Highscore with database (SQLite) 1 Answer