• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Glutax · Apr 01, 2020 at 02:56 PM · savingscriptable objectbest practicequests

Best Practice for creating quests and saving progress

Hello,

im trying to develop a Quest system for a singleplayer adventure like game. At the moment I've got my Quest as a Scriptable Object with an Array of an abstract Scriptable Object "Goal". Goal has one Array of Results, which are indeed Scriptable Objects.

 public class Quest : ScriptableObject
 {
     public COMPLETIONTYPE completionType;
     public Goal[] goals;
     public string title;
     public string descr;
 
 }
 
 public abstract class Goal : ScriptableObject
 {
     public Quest partOf;
     public bool Initialized;
     public bool done;
     public Result[] results;
     public virtual bool evaluateGoal() { return true; }
     public virtual void init() { }
 
     public virtual void goalToText()
     {
 
     }
 }
 

With that I can create Assets for Quests, Goals and Results and easily connect them. I think this raises some problems:

  1. I think this is abusing ScriptableObjects

  2. The parts are not reusable without instantiating

  3. If I dont instantiate every asset, i wouldnt know how to reset the save game so the player can start over.

I am kinda stuck right now and dont know what a good practice would be. Is it a bad idea to keep with the idea of scriptable Objects and instantiate them?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by mottzy · Dec 28, 2020 at 06:21 AM

Did you every come to a solution on this? I'm working on a quest system as well and it's surprisingly similar to your structure (though I haven't really considered abstractions just yet. I'm curious if you went with this approach, or found one that worked best for your needs?

Conceptually your idea makes sense. The approach I'm using is to have scriptable objects so I can have configurable quests, and then at runtime I instantiate a different type of object that has runtime information. The runtime quest tracker retains a reference to the quest object, but stores it's own data related to the quest.

The reason I did this is that I needed to track the status of goals, and it didn't make sense to store it back in the scriptable object that defines the quest. Anyway, just curious where you got!

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Glutax · Dec 28, 2020 at 08:31 PM 0
Share

I've changed Goal and Results to be normal classes instead of Scriptable Objects. That way i didnt have to worry about reference from SO to other SOs while instantiating. With a custom editor script i was still able to create the quests in Editor (even if poorly executed). Ive then saved the quests which are active through my questmanagers reference.

But I've dropped the project already some time ago.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

126 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Hero and enemies level up best practice 0 Answers

How To Save User Created Custom Object 1 Answer

How do I save a list of scriptable objects? 0 Answers

PrefabUtility does not exist? 1 Answer

save the whole the data 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges