Follow

What is CS0108?

Symptoms

  • When trying to enter play mode, I am receiving the error below:
warning CS0108: `___' hides inherited member `___'. Use the new keyword 
if hiding was intended

Cause

The CS0108 warning is displayed when a variable was declared with the same name as a variable in a base class, but does not use the new keyword.

 

Errors displayed in this example:

warning CS0108: `PixelPerfect.camera' hides inherited member 
`UnityEngine.Component.camera'. Use the new keyword if hiding was
intended

Resolution

To remove the CS0108 warning, you will need to either add the new keyword to the variable being declared:

 

Alternatively, you can change the variable's identifier to avoid confusion with collaborators as in this example:

More Information

https://msdn.microsoft.com/en-us/library/3s8070fc.aspx

 

Was this article helpful?
2 out of 2 found this helpful
Have more questions? Submit a request

1 Comments

  • 0
    Avatar
    Élisson Michael

    Thanks, that was exactly what i was looking for.

Please sign in to leave a comment.