public class FakeSceneManager : MonoBehaviour
{
public static void ChangeFakeScene(GameObject newFakeScene)
{
currentFakeScene.SetActive(false);
currentFakeScene = newFakeScene;
currentFakeScene.SetActive(true);
}
}
this is a class that is attached to a gameobject in my scene and it contains some stuff that i wont show because its to long, it also contains this static method called ChangeFakeScene
in another script i can access this method by using:
Classes do not need to be static to access their static members, in this case a static method. Static variables and methods always belong to their class, not instances of the class. A static class simply cannot have instances, and therefore can’t have instance members. From your code above, I can tell that FakeSceneManager has at least two static variables (or maybe properties), currentFakeScene and mapFakeScene. If either of those is not static, then this code would not compile. You can think of static members (variables and methods) as belonging to their class, or as being shared between all instances of the class. The second idea is less accurate, but might be easier to understand at first.