ScriptableObject not running start method

using UnityEngine;
using System.Collections;

public class ControllerScript : ScriptableObject {
    private static Vector2 previousPos;
                           //firstClickedPos;

    private static bool buttonDownPrevious,
                        isBeingTouched,
                        restartNextFrame;
    private static GameObject firstTappedGO,
                              firstHoldedDownButton;
	void Start () {
        Debug.Log("f");        
        Application.LoadLevelAdditive("MainMenuScene");
	}
}

I read some articles and posts about scriptable object but obviously still can’t seem to understand it fully. So my question is how can I make it enter the Start method ?

The documentation is wonderful: Unity - Scripting API: ScriptableObject
Here we can see the three messages sent to a ScriptableObject is: OnDestroy, OnDisable, and OnEnable. There is no Start message which mean your Start function will never be called. Awake, Start and Update are part of Monobehaviour.

You will most likely want to use OnEnable which is called for a ScriptableObject when it is loaded.

EDIT: The below seems (now that I’ve tested it), to only work if you create new instances, which isn’t necessarily what you need in a ScriptableObject, at least not ideal for the way I use it… But it might work for you :slight_smile:

I believe this has changed since the accepted answer, so I’m just adding this:

You can use Awake (Awake docs) instead of Start, which is not part of ScriptableObject (ScriptableObject docs).

That should do the same as Start, pretty much, though it probably can’t run in a coroutine like Start in a MonoBehaviour can.