Search Unity

Can't set start Transform?

Discussion in 'Scripting' started by robertseadog, Sep 24, 2005.

  1. robertseadog

    robertseadog

    Joined:
    Jul 23, 2005
    Posts:
    374
    Why isn't it possible to set the start Transform of a object as a variable?

    Take this script for example:

    Code (csharp):
    1.  
    2. private var yStart = transform.position.y;
    3.  
    4. function Update () {
    5. print (yStart);
    6. }
    7.  
    8.  
    For it Unity gives me nothing but trouble:

    "System.NullReferenceExeption: Object reference not set up to an instance of an object"!

    I guess I could manually set the start position of the object, but Im lazy!
     
  2. robertseadog

    robertseadog

    Joined:
    Jul 23, 2005
    Posts:
    374
    There you go, If Unity had updated the script in my obj after I tried placing transform inside a Start function, I would have known better than to post this post.

    And If I could now delete the unnessecary post I could awoid looking like a spammer and keep some of my reputation intact. Arrhg! :cry: