0

So I have a simple problem:

public class Foo : MonoBehaviour {
    //Here is a variable that can be editable in the inspector
    public float A = 0f;
}

And in the inspector, I set A to 4.0.

And now, in another class:

public class Goop : MonoBehaviour {
    void start () {
        GameObject Foom = GameObject.Find("FooManager");
        Foo Foolee = Foom.AddComponent<Foom_Manage> ();

        print (Foolee.A);
    }
}

Now, instead of writing to the console the correct number, 4.0, it writes the original number 0 to the console, the number I used just as a placeholder. How can I use AddComponent to successfully get variable A to equal 4.0?

Demandooda
  • 122
  • 1
  • 14

0 Answers0