Search Unity

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

What the "protection level" is?

Discussion in 'Input System' started by MushroomsGuy, Jun 18, 2022.

  1. MushroomsGuy

    MushroomsGuy

    Joined:
    Jun 18, 2022
    Posts:
    2
    I had to put a variable (the variable name was game over) of one script (whose name was gamecontroller) into another (whose name was player). I watched a tutorial where it told me to write
    GameController.Gameover = true, but when I went back to Unity it said: 'GameController.gameover' is inaccessible due to its protection level. What does that mean? How could I solve that?
     
  2. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Usually it means one class (script) is expecting to access another class variable but it cannot because it is not public.
     
  3. Neto_Kokku

    Neto_Kokku

    Joined:
    Feb 15, 2018
    Posts:
    1,751
  4. MushroomsGuy

    MushroomsGuy

    Joined:
    Jun 18, 2022
    Posts:
    2