I’m building a game in Unity which has some buyable skills in it. The bought skills are going to be stored in an external save file. Then being converted to a class called PlayerData. I want to make this class can be accessable from other scripts without typing the same class again in that script.
Is there a way to make like a global class? That can be accessed from other scripts?
>Solution :
I’m not sure exactly what you mean by
without typing the same class again in that script.
But if you mean you can’t access the class in other scripts, maybe you defined the class in another class?
Or do you mean you can’t access methods/variables directly without stating "of which instance of the class", in that case, you can use static class:
https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/static-classes-and-static-class-members