1. Help us improve the editor usability and artist workflows. Join our discussion to provide your feedback.
    Dismiss Notice
  2. Unity 5.6 is now released.
    Dismiss Notice
  3. Check out all the fixes for 5.5 in patch releases 1 & 2.
    Dismiss Notice
  4. Get further faster with the Unity Plus Accelerator Pack, free for new Unity Plus subscribers for a limited time. Click here for more details.
    Dismiss Notice
  5. Learn how you'll soon be able to publish your games to China in four simple steps with Xiaomi. Sign up now for early access.
    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