question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot access protected member `UnityEngine.Texture.Texture()`

See original GitHub issue

Environment

  • 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:closed
  • Created 5 years ago
  • Comments:22 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
treendycommented, Aug 5, 2018

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 +

2reactions
bddckrcommented, Jul 24, 2018

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found