Cannot access protected member `UnityEngine.Texture.Texture()`
See original GitHub issueEnvironment
- VRTK imported from the Unity Asset Store.
- VRTK Version: 3.2.1
- Version of Unity3D: 2018.1.0f2
- Hardware used: HTC Vive
- SDK used: SteamVR
Steps to reproduce
- Import VRTK to the assets
Expected behavior
- No error should come up.
Current behavior
- I am getting two errors:
Assets/VRTK/Scripts/Interactions/Highlighters/VRTK_MaterialColorSwapHighlighter.cs(146,66): error CS1540: Cannot access protected member `UnityEngine.Texture.Texture()' via a qualifier of type `UnityEngine.Texture'. The qualifier must be of type `VRTK.Highlighters.VRTK_MaterialColorSwapHighlighter' or derived from it
Assets/VRTK/Scripts/Interactions/Highlighters/VRTK_MaterialColorSwapHighlighter.cs(146,66): error CS0122: `UnityEngine.Texture.Texture()' is inaccessible due to its protection level
Issue Analytics
- State:
- Created 5 years ago
- Comments:22 (1 by maintainers)
Top Results From Across the Web
UnityEngine.Texture Inaccessible due to protection level
Our code instantiates a Texture object, which is now not allowed. Any... ... Texture class reduces its constructor from public to protected.
Read more >Spine Unity code compile error on 2018.1 beta
Graphics: Texture is now abstract. The line with new Texture() now does not work because the constructor is now protected . Here's a...
Read more >Solved android build error of Affectiva Emotion SDK for Unity
1 → Assets/Affdex/Plugins/Scripts/VideoFileInput.cs(46,24): error CS1540: Cannot access protected member `UnityEngine.Texture.Texture()' via a qualifier of ...
Read more >c# - Cannot access protected member in base class
A protected member of a base class is accessible in a derived class only if the access occurs through the derived class type....
Read more >`UnityEngine.Texture.Texture()' is inaccessible due to its ...
Cannot access protected member `UnityEngine.Texture.Texture()' via a qualifier of type `UnityEngine.Texture'. `UnityEngine.Texture.Texture()' is inaccessible ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I had the same issue… using this latest version with 2018.2.2f adjusting the line in question to this: “renderer.material.SetTexture(”_MainTex", new Texture2D(0,0));" fixed the issue for me : )
I will keep an eye open for an update to VRTK that works with 2018.2 +
That would mean you continue to use the VRTK version that is over a year old. Instead follow best practices to get the latest VRTK by getting it from the GitHub branch.