Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

CS0116

Discussion in 'Scripting' started by Actionjaxon777, Apr 19, 2021.

  1. Actionjaxon777

    Actionjaxon777

    Joined:
    Feb 25, 2021
    Posts:
    8
    Not sure whats wrong but it keeps saying its the brackets. Help would be appreciated! (line 8)
    Code (CSharp):
    1. using UnityEngine;
    2.  
    3. namespace Photon
    4. {
    5.     public class MonoBehaviour : Monobehaviour{
    6.     }
    7.  
    8.     {
    9. }
     
  2. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,186
    I mean...count your brackets. The number of { and } must match. That's a good start. And you should follow what was written in your other post. Honestly, I think you need to start with some basic tutorials.
     
    SaltwaterAssembly likes this.
  3. Actionjaxon777

    Actionjaxon777

    Joined:
    Feb 25, 2021
    Posts:
    8
    all it is, is some corrupt code im trying to fix. this is my first day on here and i have no clue how to match them right.
    https://imgur.com/a/26BsbmL
     
  4. bobisgod234

    bobisgod234

    Joined:
    Nov 15, 2016
    Posts:
    1,042
    You use opening brackets to denote the start/end of a namespace/class/method. Look at your example, you have an opening bracket on line 8 for nothing at all. Delete the bracket on line 8.

    On top of that, you failed to follow the advice given to you in your other thread. You cannot call your MonoBehaviour "MonoBehaviour". Rename your class to something else.

    What are you trying to do with your script?

    I would suggest doing some tutorials here: https://unity.com/learn
     
  5. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,186
    Which is my point for you needing to start with tutorials. Your first day of coding is best spent learning basics. And people are giving you advice that you aren't following.
     
  6. Actionjaxon777

    Actionjaxon777

    Joined:
    Feb 25, 2021
    Posts:
    8
    it’s a corrupt script so i really can’t change much except what’s corrupt. the can only change the “Monobehaviour : Monobehavior” to “PhotonMonobehaviour : PhotonMonobehaviour” and when i fix those brackets it gives me another error for “using UnityEngine;”
    Code (CSharp):
    1. using UnityEngine;
    2.  
    3. namespace Photon
    4.  {
    5.      public class Photon.MonoBehaviour : Photon.Monobehaviour{
    6.      }
    7.  
     
    Last edited: Apr 19, 2021
  7. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,186
    You've been told what is corrupt. What does it being a concept script have to do with anything? I can no longer help you unfortunately. Good luck.
     
    SaltwaterAssembly likes this.
  8. SaltwaterAssembly

    SaltwaterAssembly

    Joined:
    Mar 8, 2016
    Posts:
    95
    The only thing corrupt about your script is that stray {
     
  9. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,893
  10. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,520
    I tell you what, CS0116 has absolutely NOTHING to do with what's wrong, so don't even consider that number, just put it right out of your mind.

    Remember: NOBODY memorizes error codes. The error code is absolutely the least useful part of the error. It serves no purpose at all.

    The important parts of an error message are:
    - the description of the error itself
    - the file it occurred in
    - the line number and character position.

    All of that information is in the actual error message and you must pay attention to it. Learn how to identify it instantly.

    How to understand compiler and other errors and even fix them yourself:

    https://forum.unity.com/threads/ass...3-syntax-error-expected.1039702/#post-6730855

    How to report your problem productively in the Unity3D forums:

    http://plbm.com/?p=220
     
  11. Actionjaxon777

    Actionjaxon777

    Joined:
    Feb 25, 2021
    Posts:
    8
    how tf am i supposed to follow it if i dont understand it.
     
  12. Actionjaxon777

    Actionjaxon777

    Joined:
    Feb 25, 2021
    Posts:
    8
    Assets\Scripts\Assembly-CSharp\Photon\MonoBehaviour.cs(6,3): error CS1513: } expected
     
  13. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    I'd recommend getting a C# book or following some C# tutorials completely unrelated to Unity. Get a basic understanding of the language, and then come back to Unity. Every problem you're having is a basic C# syntax issue, which really has nothing to do with Unity itself. If you don't know the C# language syntax, you're not going to be able to write any code, so you've got to learn it first.

    I'd also recommend not working on a network multiplayer game as a first project. These are extremely difficult, large, and complicated projects even for experienced game developers. If you were studying to become an architect, would you make your first project a 110 floor city skyscraper? How successful do you think such a beginner architect would be? Because that is essentially what you're trying to do here.
     
    Last edited: Apr 19, 2021
    Lurking-Ninja and Brathnann like this.
  14. I recommend this course, excellent for C# beginners.