Unity3D - Using ScriptableObject for Data architecture / sharing

preview_player
Показать описание

-------

Use scriptableobjects to pass data around in your project easily. Allow designers to create custom variables and build cool new emergent systems.

Рекомендации по теме
Комментарии
Автор

This is brutal. This man makes everything so easy while the world is caotic.

franciscojaviergraciasanti
Автор

It's probably best to also make ConstReferences for each type of variable, which is the same as a FloatReference (or whatever) but doesn't let you change the value in your code (you can still set a custom value in the inspector and can still reference a normal variable). This has no bearing on the actual game and there's no such thing as a "constant" in your actual variable classes, but it means that at the reference point, you can't accidentally change the value of a variable in your code. This is useful if, for example, you have UI elements that read the players health but you want to make sure that they cannot change the players health under any circumstances. It's just an extra level of safety at the cost of a little bit of extra work.

pt
Автор

I'm currently working on a way to create scriptable objects for spaceship components the stats of which would affect speeds on different directional axes of my movement controls. I have my variables set up to be externally modified without much trouble, but I'm still having some trouble figuring out how I would set it up exactly.

andythedishwasher
Автор

love this pattern, been using it myself since watching the presentation, a much better alternative to using singletons for global access. I've still been using the default drawers so thank you for showing the property drawer code, it is so much cleaner and more usable

paulyounger
Автор

awesome stuff man... I love watching your programming tutorials because you are one of the few people on here that actually uses good OOP practices. Also - what kind of keyboard are you using? It sounds very nice.

jtms
Автор

Could you do a follow up video going into the collections and event systems that you were talking about at the end?

mana
Автор

0:50 how can I exactly serialize a property?

rekordea
Автор

ONE PROBLEM with this pattern that I can't find a solution for. Let's say you have this FloatReference in many places and you have 20 different instances of this ScriptableObject. Now, you want to know how many places a specific FloatReference is referenced. How would you do that? ("Find References In Scene" doesn't work, because you may have a lot of scenes)

behnamrasooli
Автор

Could you offload the values from the scriptable objects to a more permanent place like a database or binary save?

darkman
Автор

Thanks man, this is great stuff - a developer that knows his shit, showing us minions how not to be. Thanks again.

kusacubari
Автор

Hi,
Thanks for the video, especially for Drawer GUI example. One question, isn't it a problem that "Observed Health" is not read only but can be also modified by other scripts (Enemy in this example)? What is your opinion?

tlucz
Автор

Scriptable objects has empty inspectors and do not exist in build.
Could you please help me out?

rohitkvss
Автор

I was at unite and saw this talk, since then I have been playing with the pattern and loving it. The one scenario that has been tripping me up and causing me to tear my hair out is his implementation of the GameEvent SO. I want to write it in a way that would allow passing parameters, at first I was looking for it to be generic but now I wouldn't even mind making a new one per parameter type I want to pass. Do you have any ideas of how to make it work?

markkinsman
Автор

as much as i look into sriptable objects, i still dont understand why or when i should use them.
i mean, you can basically do the same in a script and remove the scriptable objects and have the same result?

artjom
Автор

what an awesome unite presentation, think i'll try this. ty for sharing!

salientking
Автор

Can you provide the full code for the FloatReferecneDrawer?

tylerk
Автор

I looked at ScriptableObjects in more detail when I watched the Unite 2107 talk that you referenced. After playing around with them for a little while I found one glaring and major problem which I'm yet to find a work around for: If you have multiple enemies you have to create a new float variable asset for each enemies health. As far as I am aware, this therefor means that there is no easy way to spawn enemies from a spawner. Am I wrong? I'd love to be wrong because I agree that this use of scriptable objects is really nice.

lewisheslop
Автор

What is the best method to reset the values to default?

Tymon
Автор

Hi Sir,
nice tutorial really good.keep doing sir....

vigneshsree
Автор

Hi, very good presentation ! ScriptableObject seems to be very interresting. How can you use this with an ennemy spawner for exemple (I saw some comments using an array with a list of ScriptableObject but it's seems messy in a large game. Thanks :)

Morph_SC
welcome to shbcf.ru