1. We've introduced thread tags, search within a thread and similar thread search. Read more here.
    Dismiss Notice
  2. We've released our first Timeline Experimental Preview, our new tool for creating cutscenes and more! To check it out click here.
    Dismiss Notice
  3. All Unity Pro perpetual license customers: your special offer to subscribe is ready! Click here.
    Dismiss Notice
  4. Unity 5.5 is now released.
    Dismiss Notice
  5. Check out all the fixes for 5.5 in patch releases 1 & 2.
    Dismiss Notice
  6. Unity 5.6 beta is now available for download.
    Dismiss Notice
  7. Get prepared for the Tizen Mobile App Incentive Program! Read more about the upcoming program here.
    Dismiss Notice
  8. Enter the Microsoft Developer Challenge for a chance to win prizes. Read more about it here.
    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
    Messages:
    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
    Messages:
    423
    hm. IT doesn't tell you the line number?

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

    sereda008

    Joined:
    Dec 10, 2010
    Messages:
    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