Can Scriptable Object be use for this?

Hi, let say that there is a Character.

The character has a Component A, with member variable a and b.

Initially, these variables are initialized inside the components.

However, as more character got added,
the variables are supposed to be the same for all characters.
As such, the variables got refactor to a reference objects instead.

Instead of making a GameObject, thus having a need to brought it across scenes,
Is it possible to store the variables inside an Object that will be reference across all scenes?

Also, the variables must be able to get edited via Window Editor.

//////// Edit, summarize rephrase the Question

How do I create a Scriptable Object?
How do I edit it via editor?
and how do I reference the variable inside it from a component?

//////Add one more question,

With ScriptableObject, If the variable got edited during runtime,
will the change be permanent? Or will it got reset after Game Restart?

For example, there is weapon with ATK 100,
then it got upgraded to ATK110, in this case I want the change to be permanent.

If it will get reset, is it possible to make it permanent?

Definitely you can use ScriptableObject for this purpose.

You have to do three things.

  1. Implement a class from ScriptableObject and put your variables in it (public)

  2. Create an instance of the class in the project structure and fill the values in it.

  3. Reference to that object where ever you need it.

Example of implementing the class:

public class ExtraProjectSettings : ScriptableObject
{
    public string WalkableTag = "Walkable";
    public string CameraZoneTag = "Camera Zone";
    public ParticleSystem TouchCircle;
    public QualityLevel[] QualitySettings;
}

Please refer here about how to create an instance of your scriptableobject http://wiki.unity3d.com/index.php?title=CreateScriptableObjectAsset

It sounds like you might want to make a “Game Manger Script” that your other objects or charters can reference. You could then add a :

DontDestroyOnLoad (this);

In the Update of the Game Manger Script so that the variables within that script will remain constant.