mySQL - Unity Connection
Hello. I have a database containing approximately 19,000 data (image, text, sound). 786 lesson objects in Unity as well. I want to pull 19,000 pieces of data into these lesson objects - using MYSQL - and divide them into parts, and print them as text, audio and image to my phone application. How can I do that?
28 Replies
break up the problem into smaller pieces then solve them one by one
you should never connect your game (or any application that goes to anyone) directly to a database
Unity actually kinda prevents that kinda code / action
huh? prevents care to expand on that
because I dont see how they would prevent u from adding a library and use it in your code
A huge while back in like 2019 or smth I tried to connect a MySQL database to my unity game and Unity didn't let me for security reasons or smth
After looking it up I found out it's highly discouraged to do it this way and that I should use a REST API instead
I don't fully remember it's been forever now
well no they dont prevent
but yes its not ideal
the usual route is having a middle man that deliveries the data
Yees
but unity does not prevent u from using a mysql connector no
Hm
Wasnt too sure on that point
Thanks for clarifying
the usual route is to use a webapi that is the middle man between unity and your database
so you would make httprequest based on the resources u need at the time u need then
i normally use addressable
but problem is, i really don't know if it effects to application's size
'cause the photos etc. are around 8gb
Do you ship the entire database?
well it really depends how the application works specially it being a mobile application u will have severe limitations
and throwing 8gb at its face it will certainly not like it
2/3 of those things don't necessarily belong in a database anyway
images and sounds are just binary data
Yes
yep
is there a reason you're using a database at all and not just putting the files on the filesystem?
for something like a mobile app i imagine a big database file will be hard/impossible to do differential updates on
i make an application to learn english and the lessons have some images and sounds
i don't use database but i want to
'cause in my website, i have all of those in my mysql thingie
you should use a database if it's a good solution, not just to do it
ic
so will addressable work for it?
i don't know what that is
I did something like this when I use addressable
u can use the database to structure the lessons
and know when to send certain data
instead of sending it all together
keeping the usage low
but you can also ship some of the datawith it
as in data u know needs to be always available
anything unity specific you're better off asking in $unity
addressables sounds like something u work in companion with something else telling it what to get
but I am not expert with it so yeah u better of ask on unity discord
q-q
alright guys
thanks for help <3