When trying to disable a 0169 (unused variable) warning in Unity, I’m getting the message:
I’m not sure why it’s even disabled globally or how to remove the global warning but what’s very strange is that the very next warning right after it is:
And this is how I am using it:
#pragma warning disable 0169
public event Action ValueChanged;
#pragma warning restore 0169
First part:
Make sure you’re not globally disabling it somewhere. This includes in any 3rd party assets you may have brought into your project.
Second part:
You’ve disabled warning 0169, not warning 0067. So warning 0067 is being propagated.
Unused events have a different warning from unused fields.
Thing is… an unused field is common in Unity, because it could be actually used in serialization and reflectively, so the compiler doesn’t know any better.
But an used event… what’s the event there for?
1 Like
How can I make sure it’s not getting disabled globally? I tried to Ctrl + F the entire solution searching for “nowarn” but nothing came up.