Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

(51,10): BCE0089: Type 'MessageTextObject' already has a definition for 'Update()'.

Discussion in 'Scripting' started by 6263osnova, Oct 15, 2014.

  1. 6263osnova

    6263osnova

    Joined:
    Oct 14, 2014
    Posts:
    31
    Code (JavaScript):
    1. var object : boolean = false;
    2. var showObjectMessage : boolean = false;
    3.  
    4. function OnTriggerEnter(other : Collider){
    5.  
    6. if(other.gameObject.name == "Object"){
    7. object = true;
    8. }
    9. }
    10. function OnTriggerExit(other : Collider){
    11. if(other.gameObject.name == "Object"){
    12. object = false;
    13. }
    14. }
    15. function OnGUI(){
    16. }
    17.  
    18. function Update (){
    19.  
    20.         if (Input.GetKeyUp (KeyCode.E))
    21.             print ("E key was released");
    22.            
    23. }
    24.    
    25. if(object)
    26. showObjectMessage = true;{
    27.  
    28. //Freeze the game and show the message
    29. Time.timeScale = 1;
    30. // Bottom-Center The Text
    31. GUI.Label(Rect(Screen.width/2 - 100, Screen.height- 100,700,100),"Nothing special");
    32. }
    33. //Unfreeze the game
    34.  
    35. function Update (){
    36.  
    37.     if (Input.GetKeyDown (KeyCode.Escape))
    38.         print ("escape key was pressed");
    39.            
    40. }  
    41. if(object)
    42. Time.timeScale = 1;
    43. showObjectMessage = false;
    44.  
    45.  
     
  2. hpjohn

    hpjohn

    Joined:
    Aug 14, 2012
    Posts:
    2,190
    You have two blocks for function Update(){...}
    one on 18, one on 35
     
  3. 6263osnova

    6263osnova

    Joined:
    Oct 14, 2014
    Posts:
    31
    deleted
    error disappeared
    thank you