Hi I am relatively new to unity and have recently run into a error code that i do not know the meaning of here it is
Assets\Dashing.cs(36,12): error CS0122: ‘WASD.dashing’ is inaccessible due to its protection level
Hi I am relatively new to unity and have recently run into a error code that i do not know the meaning of here it is
Assets\Dashing.cs(36,12): error CS0122: ‘WASD.dashing’ is inaccessible due to its protection level
Hello @FreshWind1020,
WASD is the name of your script, Dashing is the name of a function in your script, “not accessible” means the function is defined with an access specifiers that doesn’t allow other scripts to call it, for example: “private” or “protected” (not putting any access specifiers by default makes the function private)
What you need to do is change the prototype of your function to be public:
void Dashing() {
///
}
Should be:
public void Dashing() {
///
}
Hey! Can you send a screenshot please? However this is not a unity error, this is a C# one. Protection level is the following: private: can only be accesed in the class, and not objects. Protected: Can be accesed by sub classes (classes derived) and objects of the class or sub class. Public is can be accesed anywhere. No offence but if you don’t know this, you should learn it first.
thank you so much cyber_cats you are most likely the most helpful person on this whole discussion board
– FreshWind1020I wouldn't say that ^^' but thanks you are welcome
– Cyber_Cats