- Home /
How to make classes/structs public to all scripts
In one of my scripts, i created a class and two structs. I want this class and these structs to be public and accessible in all of my scripts. For Example i would create a class A and a struct B in a player.cs script, but i cant access them, in for example my camera.cs script, it would be as if they don't exist. So how would i fix that? i want them accessible across all of my scripts.
You'd make them public
. This is about as entry-level a question as it gets, so you might want to walk through a few c# tutorials online. They will probably be more educational than the answers on this forum for now.
They'd also need to either be in the same namespace
or you would need to be using
that namespace in the context where you wanted to use those objects.
Your answer
Follow this Question
Related Questions
Defining a public class in C# 1 Answer
C# ArrayList access from other script 1 Answer
Multiple Cars not working 1 Answer
Easily reference class instance 1 Answer
Getting a variable from another script 2 Answers