Search Unity

Error CS1513 } expected

Discussion in 'Windows' started by SmellyDogs, Sep 16, 2013.

  1. SmellyDogs

    SmellyDogs

    Joined:
    Jul 16, 2013
    Posts:
    387
    This error is unique to when I build for the Windows Store platform.
    Unity bug?
     
  2. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,433
    No, programmer bug. You have a missing } somewhere.
     
    Halabadushkeys likes this.
  3. SmellyDogs

    SmellyDogs

    Joined:
    Jul 16, 2013
    Posts:
    387
    Most definately NOT a programmer bug. The same code runs fine for PC/Web builds, but when its targets to Windows store it fails.
     
  4. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    2,075
    Can you show the code?
     
  5. SmellyDogs

    SmellyDogs

    Joined:
    Jul 16, 2013
    Posts:
    387
    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4.  
    5. public class Tank : MonoBehaviour
    6. {  
    7.     public Transform turret;
    8.    
    9.     private EntityUpdate update;
    10.     private float height = 1.1f;
    11.     private bool firing = false;
    12.     private Vector3 enemyPos;
    13.    
    14.     // Use this for initialization
    15.     void Start ()
    16.     {
    17.  
    18.     }
    19.    
    20.     // Update is called once per frame
    21.     void Update ()
    22.     {
    23.         if (update == null) return;
    24.                        
    25.         Vector3 pos = new Vector3(update.Position.x, update.Position.y, update.Position.z);
    26.                
    27.         Vector3 lerp = Vector3.Lerp(transform.parent.position,
    28.                                     pos,
    29.                                     Time.deltaTime);
    30.        
    31.         float y = Terrain.activeTerrain.SampleHeight(lerp) + height;
    32.        
    33.         //RaycastHit hit;
    34.         //if (Physics.Raycast(transform.position, -transform.up, out hit))
    35.         //{
    36.         // 
    37.         //}
    38.  
    39.         transform.parent.position = new Vector3(lerp.x, y, lerp.z);
    40.        
    41.         Vector3 a = new Vector3(transform.parent.position.x, update.Position.y, transform.parent.position.z);
    42.         Vector3 b = new Vector3(update.Position.x, update.Position.y, update.Position.z);
    43.        
    44.         Vector3 target = a - b;
    45.                
    46.         transform.parent.forward = Vector3.RotateTowards(transform.parent.forward, target, 0.1f, Time.deltaTime);  
    47.  
    48.         Quaternion q = Quaternion.AngleAxis(update.WeaponRotation, Vector3.up);
    49. turret.transform.forward = q * Vector3.forward;
    50.     }
    51.    
    52.    
    53.     public void EntityUpdate(EntityUpdate update)
    54.     {
    55.         this.update = update;
    56.        
    57.         if (update.Update_Type == EntityUpdateType.Fire)
    58.         {
    59.             firing = true;
    60.         }
    61.     }  
    62. }
    63.  
    64.  
    The error is on this line:

    Quaternion q = Quaternion.AngleAxis(update.WeaponRotation, Vector3.up);
     
  6. SmellyDogs

    SmellyDogs

    Joined:
    Jul 16, 2013
    Posts:
    387
    Sorry can't edit my post for some reason but error is on line 47.
    I am using MonoDevelop that comes with Unity btw.
     
  7. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    2,075
    So what throws the error - MonoDevelop or Unity Editor?
     
  8. SmellyDogs

    SmellyDogs

    Joined:
    Jul 16, 2013
    Posts:
    387
    The error comes in the Editor console when I run a build. It lets me run the game in editor just not letting me build it.
     
  9. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    2,075
    Hmph, any chance for a repro project, from the source file, I don't see nothing :/
     
  10. SmellyDogs

    SmellyDogs

    Joined:
    Jul 16, 2013
    Posts:
    387
    There are a lot of scripts and assets, I can try to strip it down. Where do I send it to?
     
  11. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    7,038
  12. Phil-AV

    Phil-AV

    Joined:
    Jul 9, 2012
    Posts:
    57
    I've got a niggling suspicion that there's a #define going wrong somewhere, hence why it only complains when building for that particular platform.
     
  13. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    518
    I have the same issue, did you find any solution?

    [EDIT:] found it for me!
    I work on a Windows and a Mac PC to build for different plattforms. To do so I simply copy the project from one pc to the other. However, Monodevelop somehow gone crazy on the line endings. I didn't found out what exactly was the problem, but if you delete all line endings close to the line given in the error message the code will compile.
     
    Last edited: Apr 10, 2014
  14. Diego2160

    Diego2160

    Joined:
    Apr 27, 2019
    Posts:
    2
    alguem me ajuda, ta falando que esta tendo um erro CS1513
     
  15. Diego2160

    Diego2160

    Joined:
    Apr 27, 2019
    Posts:
    2
    esse é o comando
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class PlayerMoviment : MonoBehaviour
    6. {
    7. // Vetor responsavel pelo movimento
    8. Vector3 movement;
    9. // Responsavel pela transicao da animacao
    10. Animator anim;
    11. // Responsavel pela fisica do objeto
    12. Rigidbody playerRigidbody;
    13. // floor mask
    14. int floorMask;
    15. // Inf para raycast
    16. float camRayLenght = 100f;
    17. void Awake()
    18. {
    19.    
    20.      floorMask = LayerMask.GetMask("Floor");
    21.  
    22.      anim = GetComponent <Animator> ();
    23.      playerRigidbody = GetComponent <Rigidbody> ();
    24.  
    25.   }
    26.  
    27. void FixedUpdate ()
    28. {
    29.      float h = Input.GetAxiaRaw ("Horizontal");
    30.      float v = Input.GetAxiaRaw ("Vertical");
    31.  
    32.      Move (h,v);
    33.      Turning(h,v);
    34.      Animation(h,v);
    35.  
    36. }
    37.  
    38.  
    39. void Move (float h, float v)
    40. {
    41.      movement.Set(h,0f,v);
    42.  
    43.      movement = movement.normalized * speed * Time.deltaTime;
    44.  
    45.      playerRigidbody.MovePosition (transform.position + movement);
    46.  
    47. }
    48.  
    49.  
    50. void Turning()
    51. {
    52.     Ray camRay = Camera.main.ScreenPointToRay(Input.mousePosition);
    53.  
    54.     RaycastHit floorHit;
    55.  
    56.     if(Physics.Raycast(camRay,out floorHit,camRayLength,floorMask))
    57.     {
    58.         Vector3 playerToMouse = floorHit.point - transform.position;
    59.         playerToMouse.Y = 0f;
    60.  
    61.         Quaternion newRotation = Quaternion.LookRotation(playerToMouse);
    62.         playerRigidbody.MoveRotation(newRotation);
    63.    
    64.    
    65.     }
    66.  
    67.  
    68. }
    69.  
    70. void Animating(float h, float v)
    71. {
    72.      bool walking = h != 0f || v!=0f;
    73.      anim.SetBool("IsWalking", walking);
    74.  
    75. }
     
  16. SirMoneeN

    SirMoneeN

    Joined:
    May 10, 2019
    Posts:
    1
    Thanks i found the missing } thanks to you
     
  17. galbr143

    galbr143

    Joined:
    Jun 25, 2019
    Posts:
    1


    Hi. I have the same problem and i am using visual studio with unity and the problem is with the code i wrote in visual studio and i dont find the problem. please help.




    upload_2019-6-25_17-36-54.png
     
  18. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    7,038
    You have double opening brace after Start method.
     
  19. maxrendu84

    maxrendu84

    Joined:
    Sep 8, 2019
    Posts:
    1
    when I put "}" where I am asked to, it tells me to put it two spaces further.
     
  20. Areax-games

    Areax-games

    Joined:
    Oct 1, 2019
    Posts:
    1
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class Char : MonoBehaviour
    6.  
    7. {
    8.     private float move;
    9.     private float moveSpeed = 3.5f;
    10.     Rigidbody2D rb;
    11.     SpriteRenderer sprite;
    12.     Animator animationPlayer;
    13.     private bool Jumping;
    14.     private float jumpSpeed = 5f;
    15.     public Transform feetPosition;
    16.     public float sizeRadius;
    17.     public LayerMask whatIsGround;
    18.     public bool isGrounded;
    19.  
    20.     // Start is called before the first frame update
    21.     void Start()
    22.     {
    23.         rb = GetComponent<Rigidbody2D>();
    24.         sprite = GetComponent<SpriteRenderer>();
    25.         animationPlayer = GetComponent<Animator>();
    26.     }
    27.  
    28.  
    29.     void Update()
    30.     {
    31.         {
    32.             //Reconhecer o chão
    33.             isGrounded = Physics2D.OverlapCircle(feetPosition.position, sizeRadius, whatIsGround);
    34.             move = Input.GetAxis("Horizontal");
    35.             if (move < 0)
    36.  
    37.                 sprite.flipX = true;
    38.  
    39.             else if (move > 0)
    40.  
    41.                 sprite.flipX = false;
    42.  
    43.             if (Input.GetButtonDown("Jump") && isGrounded == true)
    44.  
    45.                 Jumping = true;
    46.  
    47.  
    48.  
    49.             if (isGrounded)
    50.                 animationPlayer.SetBool("Walking", true);
    51.             else
    52.             animationPlayer.SetBool("Walking", false);
    53.             animationPlayer.SetBool("JumpingV", false);
    54.             animationPlayer.SetBool("FallingV", false);
    55.             animationPlayer.SetBool("JumpingH", false);
    56.             animationPlayer.SetBool("FallingH", false);
    57.             if (rb.velocity.x != 0 && move != 0)
    58.             {
    59.                 animationPlayer.SetBool("Walking", true);
    60.             }
    61.             else
    62.             {
    63.                 animationPlayer.SetBool("Walking", false);
    64.             }
    65.        
    66.         }
    67.         else
    68.         {
    69.             if (rb.velocity.x == 0)
    70.            
    71.                 if (rb.velocity.y > 0)
    72.                 animationPlayer.SetBool("JumpingV", true);
    73.                 animationPlayer.SetBool("FallingV", false);
    74.                 animationPlayer.SetBool("JumpingH", false);
    75.                 animationPlayer.SetBool("FallingH", false);
    76.  
    77.             if (rb.velocity.y < 0)
    78.             {
    79.                 animationPlayer.SetBool("JumpingV", false);
    80.                 animationPlayer.SetBool("FallingV", true);
    81.                 animationPlayer.SetBool("JumpingH", false);
    82.                 animationPlayer.SetBool("FallingH", false);
    83.             }
    84.         }
    85.         else
    86.         {
    87.             if (rb.velocity.y > 0)
    88.             {
    89.                 animationPlayer.SetBool("JumpingV", false);
    90.                 animationPlayer.SetBool("FallingV", false);
    91.                 animationPlayer.SetBool("JumpingH", true);
    92.                 animationPlayer.SetBool("FallingH", false);
    93.             }
    94.             if (rb.velocity.y < 0)
    95.             {
    96.                 animationPlayer.SetBool("JumpingV", false);
    97.                 animationPlayer.SetBool("FallingV", false);
    98.                 animationPlayer.SetBool("JumpingH", false);
    99.                 animationPlayer.SetBool("FallingH", true);
    100.     }  }   }
    101.  
    102.  
    103.     void FixedUpdate()
    104.     {
    105.         rb.velocity = new Vector2(move * moveSpeed, rb.velocity.y);
    106.  
    107.         //Pulo personagem
    108.         if (Jumping)
    109.         {
    110.             //rb.addForce(new Vector2(0f, jumpSpeed), ForceMode2D.Impulse);
    111.             rb.velocity = Vector2.up * jumpSpeed;
    112.  
    113.             Jumping = false;
    114.         }
    115.    }  }
    116.  
    117.  
    I Have same problem, on lines - 66 ande 84, please, help me!!
     
  21. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    6,712
    You have two { brackets after Update. And you have 2 sometimes 3 brackets on the same line sometimes, I would advise against that for this very reason, hard to track down. It's easy to fix these types of errors. Delete (copy) everything in the class, and get it working. Then add one method back at time, basic troubleshooting steps.
     
    vletsy likes this.
  22. vletsy

    vletsy

    Joined:
    Oct 13, 2019
    Posts:
    1
    Can Somebody help me i am struggeling for like 4 hours with this problem. My Console gives me 6 error's
    2 with the code: CS1513
    2 with the code: CS1002
    1 with this code: CS1525
    and 1 with this code: CS1026

    But i can't find any problems also visual studio and notepad++ can't find any problems.
    please help me i am an beginner and yeah please help me!

    (edit): And they say weird numbers also like (26,12) is that the line where the mistake is?
    one of the sense: Assets\Joystick.cs(26,12): error CS1525: Invalid expression term ','
     
    Last edited: Oct 13, 2019
  23. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    6,712
    Sorry no, not without seeing your code. But as a beginner, I might suggest following my previous post.
     
  24. lingingicey

    lingingicey

    Joined:
    Oct 5, 2019
    Posts:
    1
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class PlayerController : MonoBehaviour
    6. {
    7.  
    8.     [HideInInspector]
    9.     public playerDirection direction;
    10.  
    11.     [HideInInspector]
    12.     public float step_Length = 0.2f;
    13.  
    14.     [HideInInspector]
    15.     public float movement_Frequency = 0.1f;
    16.  
    17.     private float counter;
    18.     private bool move;
    19.  
    20.     [SerializeField]
    21.     private GameObject tailPrefab;
    22.  
    23.     private List<Vector3> delta_Position;
    24.  
    25.     private List<Rigidbody> nodes;
    26.  
    27.     private Rigidbody main_Body;
    28.     private Rigidbody head_Body;
    29.     private Transform tr;
    30.  
    31.     private bool create_Node_At_Tail;
    32.  
    33.     void Awake()
    34.     {
    35.         tr = transform;
    36.         main_Body = GetComponent<Rigidbody>();
    37.  
    38.         //InitSnakeNodes();
    39.         //InitPlayer();
    40.  
    41.     }
    42.  
    43.     // Update is called once per frame
    44.     void Update()
    45.     {
    46.  
    47.     }
    48.  
    49.  
    50.  
    51.     void InitSnakeNodes()
    52.     {
    53.         nodes new List<Rigidbody>();
    54.  
    55.         nodes.Add(tr.GetChild(0).GetComponent<Rigidbody>());
    56.         nodes.Add(tr.GetChild(1).GetComponent<Rigidbody>());
    57.         nodes.Add(tr.GetChild(2).GetComponent<Rigidbody>());
    58.     }
    59.  
    60. } // class
    61.  
    How can I fix this I have a CS1002 Error. THanks in advance.
     
  25. KCrystian

    KCrystian

    Joined:
    Oct 29, 2019
    Posts:
    4
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. namespace KartGame.KartSystems
    6. {
    7.     /// <summary>
    8.     /// A basic keyboard implementation of the IInput interface for all the input information a kart needs.
    9.     /// </summary>
    10.     public class KeyboardInput : MonoBehaviour, IInput
    11.     {
    12.         public float Acceleration
    13.         {
    14.             get { return m_Acceleration; }
    15.         }
    16.         public float Steering
    17.         {
    18.             get { return m_Steering; }
    19.         }
    20.         public bool BoostPressed
    21.         {
    22.             get { return m_BoostPressed; }
    23.         }
    24.         public bool FirePressed
    25.         {
    26.             get { return m_FirePressed; }
    27.         }
    28.         public bool HopPressed
    29.         {
    30.             get { return m_HopPressed; }
    31.         }
    32.         public bool HopHeld
    33.         {
    34.             get { return m_HopHeld; }
    35.         }
    36.  
    37.         float m_Acceleration;
    38.         float m_Steering;
    39.         bool m_HopPressed;
    40.         bool m_HopHeld;
    41.         bool m_BoostPressed;
    42.         bool m_FirePressed;
    43.  
    44.         bool m_FixedUpdateHappened;
    45.  
    46.         void Update ()
    47.         {
    48.             if (Input.GetKey (KeyCode.UpArrow))
    49.                 m_Acceleration = 1f;
    50.             else if (Input.GetKey (KeyCode.DownArrow))
    51.                 m_Acceleration = -1f;
    52.             else
    53.                 m_Acceleration = 0f;
    54.  
    55.             if (Input.GetKey (KeyCode.LeftArrow) && !Input.GetKey (KeyCode.RightArrow))
    56.                 m_Steering = -1f;
    57.             else if (!Input.GetKey (KeyCode.LeftArrow) && Input.GetKey (KeyCode.RightArrow))
    58.                 m_Steering = 1f;
    59.             else
    60.                 m_Steering = 0f;
    61.  
    62.             m_HopHeld = Input.GetKey (KeyCode.Space);
    63.  
    64.             if (m_FixedUpdateHappened)
    65.             {
    66.                 m_FixedUpdateHappened = false;
    67.  
    68.                 m_HopPressed = false;
    69.                 m_BoostPressed = false;
    70.                 m_FirePressed = false;
    71.             }
    72.  
    73.             m_HopPressed |= Input.GetKeyDown (KeyCode.Space);
    74.             m_BoostPressed |= Input.GetKeyDown (KeyCode.LeftShift);
    75.             m_FirePressed |= Input.GetKeyDown (KeyCode.LeftControl);
    76.      
    77.  
    78.         void FixedUpdate ()
    79.         {
    80.             m_FixedUpdateHappened = true;}
     
  26. KCrystian

    KCrystian

    Joined:
    Oct 29, 2019
    Posts:
    4
    Hello everyone, I'm having trouble with the code above ^, (80,43): error CS1513: } expected comes up.
     
  27. unity_l0zItqiLRq614A

    unity_l0zItqiLRq614A

    Joined:
    Nov 22, 2019
    Posts:
    1
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class Player : MonoBehaviour
    6. {
    7.     public float speed;
    8.     public int jumpForce;
    9.     public int health;
    10.     public Transform groundCheck;
    11.  
    12.     private bool invunarable = false;
    13.     private bool grounded = false;
    14.     private bool jumping = false;
    15.     private bool facingRight = true;
    16.  
    17.     private SpriteRenderer sprite;
    18.     private Rigidbody2D rb2d;
    19.     private Animator anim;
    20.  
    21.  
    22.     // Start is called before the first frame update
    23.     void Start() {
    24.         sprite = GetComponent<SpriteRenderer> ();
    25.         rb2d = GetComponent<Rigidbody2D> ();
    26.         anim = GetComponent<Animator> ();
    27.      
    28.     }
    29.  
    30.     // Update is called once per frame
    31.     void Update() {
    32.  
    33.     }
    34.  
    35.     void FixedUpdate () {
    36.  
    37.  
    38.         float move = Input.GetAxis("Horizontal");
    39.         rb2d.velocity = new Vector2(move * speed, rb2d.velocity.y);
    40.  
    41.     }
    Where is the error? In Unity appears Assets \ Script \ Player.cs (41,6): errorCS1513:} expected
     
  28. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    6,712
    @unity_l0zItqiLRq614A Yes, a quick inspection shows that you are missing the } at the very end of the file. They always come in two's, so you go through and match them up. The very last one that you currently have matches the opening bracket for FixedUpdate, so you need the closing one for the entire class.
     
  29. lancastergames48

    lancastergames48

    Joined:
    Feb 22, 2019
    Posts:
    3
    please help i have been going over my errors code's and haven't been able to find a solution.
    Assets\MotionController.cs(24,10): error CS1513: } expected
    Assets\MotionController.cs(28,18): error CS1513: } expected
    Assets\MotionController.cs(32,22): error CS1513: } expected

    Code (CSharp):
    1.  
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using UnityEngine;
    5.  
    6. public class MotionController : PlayerMotor
    7. {
    8. public float moveTime;
    9.  
    10.     // Start is called before the first frame update
    11.     void Start()
    12.     {
    13.         PlayerMotor;
    14.         moveTime = travelSpeed*Time.deltaTime;
    15.      
    16.     }
    17.  
    18.     // Update is called once per frame
    19.     void Update()
    20.     {
    21.        //"w" to move forward
    22.         if (Input.GetKey(KeyCode.W));
    23.         {
    24.         transform.Translate (Vector3.forward*moveTime);
    25.         }
    26.         //"s" to move back
    27.             else(Input.GetKey(KeyCode.S));
    28.                 {
    29.                     transform.Translate((Vector3.back)*moveTime);
    30.                 }
    31.                 //"d" to move right
    32.                 else(Input.GetKey(KeyCode.D));
    33.                     {
    34.                         transform.Translate ((Vector3.right)*moveTime);
    35.                     }
    36.                     //"a" to move left
    37.                     else (Input.GetKey(KeyCode.A));
    38.                         {
    39.                             transform.Translate ((Vector3.left)*moveTime);
    40.                         }
    41.      
    42.     }
    43. }
    i have tried if, switch, else if, else, input.getaxis, i keep getting these same errors on the same lines.
     
  30. Fasticboss

    Fasticboss

    Joined:
    Nov 24, 2019
    Posts:
    2
    Can any on help me im having a problem

    heres my code

    "
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;

    public class PlayerControl : MonoBehaviour




    public float moveSpeed;
    // public Rigidbody theRB;
    public float jumpForce;
    public CharacterController controller;

    private Vecter3 moveDirection;


    // Start is called before the first frame update
    void Start() {
    // theRB = GetComponent<Rigidbody>();
    controler = GetComponent<CharacterController>();
    }

    // Update is called once per frame
    void Update() {
    // theRB.velocity = new Vecter3(Input.Getxis("Horizontal") * moveSpeed, theRB.velocity.y, Input.GetAxis("Vertical") * movespeed);

    // if(Input.GetButtonDown("jump"))
    // {
    // theRB.velocity = new Vector3(theRB.velocity.x, jumpForce, theRB.velocity.z);
    // }

    moveDirection = new Vecter3(Input.Getxis("Horizontal") * moveSpeed, 0f, Input.GetAxis("Vertical") * movespeed);

    if(Input.GetButtonDown("jump")) {
    moveDirection.y = jumpForce;
    }
    controller.Move(moveDirection);
    }
    "

    heres my error messages

    "
    Assets\PlayerController.cs(5,43): error CS1514: { expected
    "
    Assets\PlayerController.cs(5,43): error CS1513: } expected
    "
     
  31. lancastergames48

    lancastergames48

    Joined:
    Feb 22, 2019
    Posts:
    3
    Please "insertCode" but it looks like a set of missing brackets but its a little jumbled without the line annotations.
     
  32. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    6,712
    Simply remove all the methods until you have just the class definition. Then add your methods back in, one at a time. Basic troubleshooting for any issue. When the error shows the line number (5,43 means line 5), please tell US the line that it is pointing to so we don't have to guess.
     
    pimgames likes this.
  33. pwm_123

    pwm_123

    Joined:
    Jan 25, 2020
    Posts:
    1
    i have the same problem and no matter what i try the error wont go away someone plz help
     

    Attached Files:

  34. pimgames

    pimgames

    Joined:
    Jan 4, 2020
    Posts:
    1
    alguem me ajuda!
    codigo:

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. [RequireComponent(typeof(Rigidbody))]
    6. public class PlayerMotor : MonoBehaviour {
    7.  
    8.    [Header("System")]
    9.    public Camera cam;
    10.  
    11.    //Privates
    12.    private Vector3 velocity = Vector3.zero;
    13.    private Vector3 rotation = Vector3.zero;
    14.    private Vector3 cameraRotation = Vector3.zero;
    15.    private Rigidbody rb;
    16.  
    17.     void Start() {
    18.         rb = GetComponent<Rigidbody> ();
    19.     }
    20.  
    21.     public void Move(Vector3 _velocity)
    22.     {
    23.         velocity = _velocity;
    24.     }
    25.  
    26.     public void Rotate(Vector3 _rotation){
    27.         rotation = _rotation;
    28.     }
    29.  
    30.     public void RotationCamera(Vector3 _cameraRotation){
    31.         cameraRotation = _cameraRotation;
    32.     }
    33.  
    34.     void FixedUpdate(){
    35.         PlayRotation ();
    36.         PlayMoviment ();
    37.     }
    38.  
    39.     void PlayRotation(){
    40.          rb.MoveRotation (rb.rotation * Quartenion.Euler (rotation));
    41.          if (cam != null) {
    42.              cam.transform.Rotate (-cameraRotation);
    43.          }
    44.     }
    45.  
    46.     void PlayMoviment(){
    47.         if (velocity != Vector3.zero) {
    48.         rb.MovePosition (rb.position + velocity * Time.fixedDeltaTime);
    49.     }
    50. }
    51.  
    52.  
    53. erro:
    54. PlayerMotor.cs(50,2): error CS1513: } expected
     
unityunity