C
C#2mo ago
安 Eon

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
Jimmacle
Jimmacle2mo ago
break up the problem into smaller pieces then solve them one by one
Waffles from Human Resources
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
leowest
leowest2mo ago
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
Waffles from Human Resources
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
leowest
leowest2mo ago
well no they dont prevent but yes its not ideal the usual route is having a middle man that deliveries the data
leowest
leowest2mo ago
but unity does not prevent u from using a mysql connector no
Waffles from Human Resources
Hm Wasnt too sure on that point Thanks for clarifying
leowest
leowest2mo ago
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
安 Eon
安 Eon2mo ago
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
Waffles from Human Resources
Do you ship the entire database?
leowest
leowest2mo ago
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
Jimmacle
Jimmacle2mo ago
2/3 of those things don't necessarily belong in a database anyway images and sounds are just binary data
安 Eon
安 Eon2mo ago
Yes
leowest
leowest2mo ago
yep
Jimmacle
Jimmacle2mo ago
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
安 Eon
安 Eon2mo ago
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
Jimmacle
Jimmacle2mo ago
you should use a database if it's a good solution, not just to do it
安 Eon
安 Eon2mo ago
ic so will addressable work for it?
Jimmacle
Jimmacle2mo ago
i don't know what that is
安 Eon
安 Eon2mo ago
I did something like this when I use addressable
No description
leowest
leowest2mo ago
u can use the database to structure the lessons
安 Eon
安 Eon2mo ago
No description
leowest
leowest2mo ago
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
Jimmacle
Jimmacle2mo ago
anything unity specific you're better off asking in $unity
leowest
leowest2mo ago
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
安 Eon
安 Eon2mo ago
q-q alright guys thanks for help <3