Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Brackets Not working

Discussion in 'Getting Started' started by Ryland21, Sep 22, 2023.

  1. Ryland21

    Ryland21

    Joined:
    Aug 21, 2022
    Posts:
    3
    Hi, I am making a 3D game in unity with guns, so I am using this tutorial:


    I am around 10:08 and we have two scripts, but when I use Visual Studio the brackets don't match up.
    These are the two scripts
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class Target : MonoBehaviour, IDamageable
    6. {
    7.     private float health = 100f;
    8.  
    9.     public void Damage(float damage);
    10.     {
    11.         health -= damage
    12.  
    13.         if (health <= 0)
    14.         {
    15.  
    16.         }
    17.  
    18.     }
    19.  
    20. }
    and
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public interface IDamageable
    6. {
    7.     public void Damage(float damage);
    8.       {
    9.  
    10.       }
    11.  
    12. }
    13.  
    Edit: Figured it out realizes i accidentally used a semicolon when i wasn't supposed to


     
    Last edited: Sep 23, 2023
  2. Deleted User

    Deleted User

    Guest

    Please, post your scripts here using code tags.