Instatiate object not running the start and update functions

I'm using the function Instantiate() to make a new object from a Prefab. Once I use the Instantiate function the new object has the script but for some reason the start and the update functions don't run. How do I make sure that the Start and Update functions run properly?

Here's the code:

//Code that calls instantiate

using UnityEngine;
using System.Collections;

public class PlayerStateActing : PlayerState {

    // Use this for initialization
    void Start () {
        Debug.Log("In PlayerStateActing");

        GameObject basicShot = (GameObject)Instantiate(Application.BasicShotPrefab);
        Fireball fireball = (Fireball)basicShot.GetComponent(typeof(Fireball));
        fireball.source = Player;
        fireball.target = Player.target;
        fireball.BeginTravel();

        Player.timeBeforeAction = 30f;
        Player.PlayerState = typeof(PlayerStateWaiting);

    }

    // Update is called once per frame
    void Update () {

    }
}

The Fireball Script:

using UnityEngine;
using System.Collections;

public class Fireball : MonoBehaviour {

    public Player source;
    public Player target;
    bool traveling;
    float speed = 1f;
    bool firstTime = true;

    // Use this for initialization
    void Start () {
        traveling = false;
        Debug.Log("In Fireball Start");
    }

    // Update is called once per frame
    void Update () {

        if (firstTime)
        {
            Debug.Log("In Fireball Update");
            firstTime = false;
        }

        if (traveling)
        {

            Vector3 direction = (target.transform.position - transform.position);
            float distanceRemaining = direction.magnitude;

            if (distanceRemaining < speed * Time.deltaTime)
            {
                Execute();
            }
            else
            {
                direction.Normalize();
                transform.position += direction * speed * Time.deltaTime;
            }
        }
    }

    void Execute()
    {
        if (target != null)
            target.health -= 25;

        Destroy(this);
    }

    public void BeginTravel()
    {
        if (source == null || target == null)
            return;

        Debug.Log(source.transform.position);
        Debug.Log(target.transform.position);

        transform.position = source.transform.position;
        GlobalUtility.ShowFireball(this);

        traveling = true;
    }
}

Make sure the object is active and the script is enabled. I'm guessing the script probably isn't enabled.

Hi There,
Problem has probably been solved since the initial post, but I just wanted to add that I encountered the same issue with one of my own script : the start function was suddenly not called anymore from that given script. After an hour of random experiments, I finally removed the script from my prefab, and added it again.
And it worked again, even if I don’t really know why (Unity Bug?)

Hope that will help someone :slight_smile:
Best