Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2003
    Posts
    100

    2D Unity CS1525: unexpected Symbol error in Buzzsaw_008 mp4

    I have checked the code against the buzzsaw_008_character_controller_5_horizontal_move ment.mp4 video, but I'm still getting errors. I've deleted the Library just in case, too.

    These are the 2 error messages in the console.

    Assets/Scripts/CharacterController2D.cs(140,30): error CS1525: Unexpected symbol `if'
    Line 30 is the 4th line down from the top _raycastBottomLeft; . Why is the console mentioning "if"?

    Assets/Scripts/CharacterController2D.cs(144,52): error CS1525: Unexpected symbol `abstract', expecting `identifier'
    Line 52 is the last line _velocity = force;



    Code:
    	private Vector3
    		_raycastTopLeft,
    		_raycastBottomRight,
    		_raycastBottomLeft;
    
    	public float
    		_verticalDistanceBetweenRays,
    		_horizontalDistanceBetweenRays;
    	
    	public void Awake()
    	{
    		State = new ControllerState2D();
    		_transform = transform;
    		_localScale = transform.localScale;
    		_boxCollider = GetComponent<BoxCollider2D>();
    
    		var colliderWidth = _boxCollider.size.x * Mathf.Abs(transform.localScale.x) - (2 * SkinWidth); // set up rays that define the player box collider //
    		_horizontalDistanceBetweenRays = colliderWidth / (TotalVerticalRays - 1);
    
    		var colliderHeight = _boxCollider.size.y * Mathf.Abs(transform.localScale.y) - (2 * SkinWidth);
    		_verticalDistanceBetweenRays = colliderHeight / (TotalHorizontalRays - 1);
    	}
    	
    	public void AddForce(Vector2 force)
    	{
    		_velocity = force;

  2. #2
    Join Date
    Mar 2004
    Location
    Anacortes, WA
    Posts
    4,168
    Code:
    Assets/Scripts/CharacterController2D.cs(140,30): error CS1525: Unexpected symbol `if'
    Line 30 is the 4th line down from the top _raycastBottomLeft; . Why is the console mentioning "if"?
    
    Assets/Scripts/CharacterController2D.cs(144,52): error CS1525: Unexpected symbol `abstract', expecting `identifier'
    Line 52 is the last line _velocity = force;
    Those errors are actually on lines 140 and 144. Could you please post the method that has those lines in it?
    Need any help? Feel free to PM me - or send an email directly to nelson@3dbuzz.com!

  3. #3
    Join Date
    Sep 2003
    Posts
    100
    Dang Nabit! I totally misread that console error log. I found the errors and fixed them. Sorry for the post. I wish I could erase this post!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •