Search Unity

  1. Check out our Unite Austin 2017 YouTube playlist to catch up on what you missed. More videos coming soon.
    Dismiss Notice
  2. Unity 2017.2 is now released.
    Dismiss Notice
  3. The Unity Gear Store is here to help you look great at your next meetup, user group or conference. With all new Unity apparel, stickers and more!
    Dismiss Notice
  4. Introducing the Unity Essentials Packs! Find out more.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice
  6. Unity 2017.3 beta is now available for download.
    Dismiss Notice

MissingFieldException: Field 'System.Single.transform' not found.

Discussion in 'Scripting' started by sereda008, Apr 28, 2012.

  1. sereda008

    sereda008

    Joined:
    Dec 10, 2010
    Posts:
    130
    Hallo. I am getting this error for some reason, but do not know why. What I wish to do is to rotate a door on its hinges, as though something is banging it from the other side. Here is the code which I have used:

    Code (csharp):
    1. Function Update ()
    2. {
    3. // Most other code. Things have been defined before this.
    4.  
    5. //When and how the door should move.
    6. if (MonsterIsAttacking == true)
    7. {
    8.  
    9. DoorStageCheck = DoorStage;
    10.  
    11. DoorRand = (Random.Range (0.0, 10.0));
    12. if (DoorStage == true)
    13. {
    14. //TheDoorThatMoves = DoorRand;
    15. TheDoorThatMoves.transform.Rotate(0, 0, TheDoorThatMoves,  Space.Self);
    16. DoorStage = false;
    17. }
    18.  
    19. else
    20. {
    21. TheDoorThatMoves.transform.Rotate(0, 0, -TheDoorThatMoves,  Space.Self);
    22. DoorStage = true;
    23. }
    24.  
    25. }
    26.  
    27. }


    But for some reason, this error occurs each frame:


    Any ideas?

    Edit... Actually... The more I think about it, the more an animation appears suitable... Lets see...
     
    Last edited: Apr 28, 2012
  2. Tobias J.

    Tobias J.

    Joined:
    Feb 21, 2012
    Posts:
    423
    hm. IT doesn't tell you the line number?

    Have your assigned a gameobject to "TheDoorThatMoves"?
     
  3. sereda008

    sereda008

    Joined:
    Dec 10, 2010
    Posts:
    130
    Hey... It appears that TheDoorThatMoves is an integer! Now this is a surprise. Lets see... Hmm... The more I think about this, the more cheap it appears... Indeed, perhaps an animation would have been better. Anyway, thanks for the help :)
     
    Last edited: Apr 28, 2012