Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
This question was closed Dec 22, 2017 at 10:16 PM by pako for the following reason:

Problem is not reproducible or outdated

avatar image
0
Question by LookingGood · Dec 22, 2017 at 05:22 PM · variablecomponentfirst-person-controllerprotection

...FirstPersonController.m_WalkSpeed is inaccessible due to its protection level

I can't access my FirstPersonController variables despite making them public, here is the full error :

 Assets/Script/script.cs(15,67): error CS0122: `UnityStandardAssets.Characters.FirstPerson.FirstPersonController.m_WalkSpeed' is inaccessible due to its protection level

In script.cs :

 using UnityStandardAssets.Characters.FirstPerson;
 
 ...
 
 GetComponent<FirstPersonController>().m_WalkSpeed = 0f;

and in FirstPersonController.cs :

 [SerializeField] public float m_WalkSpeed;
Comment
Add comment · Show 11
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image MaxGuernseyIII · Dec 22, 2017 at 05:51 PM 0
Share

I would try closing and reopening whatever thing you are using to do the compiling, which I assume is the editor.

http://s2.quickmeme.com/img/4a/4a102f0529cd0acddfa88a8dea431001d8e671f9def8ecaa6992bc455cee56f4.jpg

avatar image LookingGood · Dec 22, 2017 at 06:51 PM 0
Share

That doesn't seem to work, the error is still here

avatar image MaxGuernseyIII LookingGood · Dec 22, 2017 at 09:04 PM 0
Share

What do you use to compile? Is it the editor?

I never compile any scripts with the editor. I do everything to do with coding in Visual Studio and use the editor for modifying assets, game objects, et cetera.

avatar image LookingGood MaxGuernseyIII · Dec 23, 2017 at 11:46 AM 0
Share

Yes I use the editor

avatar image Larry-Dietz · Dec 22, 2017 at 09:00 PM 0
Share

Are you using any kind of source control? I have seen this occur with source control, when the file is not checked out. No idea why?

Have also seen it when the .cs file is set to Read Only on the drive.

avatar image LookingGood Larry-Dietz · Dec 23, 2017 at 11:46 AM 0
Share

What's a source control ? Also the file isn't set to read only

avatar image Larry-Dietz LookingGood · Dec 23, 2017 at 06:41 PM 0
Share

If you don't know what it is, then you are most likely not using it, so that is not causing the problem you are describing.

I'll be honest. I do not have any idea what is up. The code you posted should be working just fine. I can't see any reason that this variable would not be accessible.

I am sorry :(

Show more comments
avatar image pako · Dec 22, 2017 at 10:16 PM 1
Share

@imdadddddd I set m_WalkSpeed to public and had no problem accessing it. I cannot reproduce the problem. It must be something with your setup.

avatar image LookingGood pako · Dec 23, 2017 at 11:48 AM 0
Share

Isn't there any way to find the source of this problem ? Can unity compiler give me more details ?

0 Replies

  • Sort: 

Follow this Question

Answers Answers and Comments

80 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

2D Animation does not start 1 Answer

can I set a variable for a component to null 1 Answer

Change image alpha of a raw image component stored as a variable 1 Answer

How do I find the name and value for each variable of a script component, using Unity script? 2 Answers

Using static typing for a Component 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges