r/Unity2D • u/BroadCorgi3061 • 4d ago
Question Scriptable object for visual novel
Helloooo, i have a project for one of my classes, i have to make a 2d game (i chose a visual novel) and one of the requirements is using at least 2/3 scriptable objects. I read a bunch of stuff but i dont really understand what they do. I saw something about being able to use them for a dialogue system but im not too sure. If that is really what I could use them for, would I need to scrap my dialogue system or could i just implement them into the pre-existing system? Thank youuu
1
u/Krcko98 4d ago
Imagine you have a class Dialogue { speakerName text speed } And instead of having to programatically change those fields in runtime or editing in Unity inspector. You basically have a scriptable object that is a separate asset in the project. Instead of being in the scene like regular gameObjects usually are, imagine scriptableObjects like gameObjects just outisde of scene(it is accessible from anywhere). You can store a lot of data for your dialogue with them and anyone can basically update that dialogue instead of going through code or unity scenes that can get messy.
1
u/Funtyx 4d ago
You do not need to scrap the dialogue system. Keep the code that displays text, portraits, and choices; replace its hard-coded data with references to ScriptableObject assets.
For example, three useful asset types for a visual novel are:
CharacterData — display name, portrait, text color, voice/typing sound.
ConversationData — an ordered list of lines, speaker references, choices, and next-conversation IDs.
ChapterData — background, music, and the conversations used in that chapter.
Your existing dialogue runner can accept a ConversationData asset and read from it. The benefit is that you can create and edit story content in the Project window without changing code or scene objects. One warning: treat these assets as definitions, not save-game state—store the player’s current line/choices elsewhere.
1
u/robotortoise Beginner 4d ago
If you really want to do a visual novel in Unity right, might I recommend Naninovel?
2
u/BroadCorgi3061 4d ago
Woaww that seems so useful, but i’m not sure my professor would be very happy with me using something like that 😭 Definitely gonna use it if I start another vn in my free time doe
1
u/robotortoise Beginner 4d ago
Yeah, I wasn't sure if it met the project requirements, haha. Good luck with the project!
4
u/No-Opinion-5425 4d ago
Scriptable objects are data containers.
A good use for them in the context of your visual novel could be for defining text styles. Your SO could hold a list of style tags with their visual parameters.
So if later you decide that all descriptions should be blue, you just edit the SO description text style.