Skip to main content
Discovery icon for Official Unity Discord Discord server

Official Unity Discord

32,909 Online
140,022 Members
# 💻┃unity-talk5 people

suppressing warnings for unused scripts

Move unused reference code outside the Assets folder or suppress specific compiler warnings using pragma directives.

  • Compiler warnings in C# can be suppressed across an entire file using pragma directives
  • Disabling specific warning codes is preferable to blanket suppression to avoid missing critical edge-case warnings
  • Storing non-build reference code directly in the Assets folder triggers unwanted compiler warnings and pollutes autocomplete
  • Placing reference code outside the Assets folder, such as in an untracked local root folder, prevents the compiler from inspecting it
  • Local directories can be excluded via global gitignore or git info exclude without altering project repository tracking
Summarized from recent messages, might be inaccurate

More conversations

Talk, Play, &
Hang Out

Find your space to hang out, discuss the latest updates with the party chat, and see who's down to join your next match.
Get App