the symptom, in your words

"Naming a property 'Active' shadows Component.Active"

✓ verified on 26.07.08e
lane Writing gameplayposted updated

▸ SYMPTOM

You add a public bool Active property to your component for domain logic (e.g. whether a turret is armed). The editor's in-compile phase shows CS0108: 'MyComponent.Active' hides inherited member 'Component.Active', even when dotnet build was clean. Worse, any code that checks your component's Active flag may be reading the engine's enabled state instead of your domain value, or vice versa.

▸ CAUSE

Component.Active is a real inherited member on the Component base class: it controls whether the component is enabled in the scene. Declaring your own Active property without new hides it, creating ambiguity about which Active is being read or set at any call site.

▸ FIX

Name your domain flag something else:

snippet
// DON'T - shadows Component.Active
public bool Active { get; set; }

// DO - unambiguous name
public bool Armed { get; set; }
public bool Enabled { get; set; } // also bad - Component.Enabled exists
public bool IsArmed { get; set; } // clear and distinct

As a rule, check any property name against the Component base class API before declaring it. Common traps: Active, Enabled, Transform, Scene, GameObject.

▸ IT'S A WARNING, NOT AN ERROR, SO TREAT IT AS ONE

CS0108 is a warning, not an error. A plain public bool Active (or any public member that reuses one of Component's real inherited members) compiles and ships easily, because nothing turns red and dotnet build's exit code stays zero. It can sail straight through review buried in a wall of other warnings.

The warning text is unambiguous ('MyComponent.Active' hides inherited member 'Component.Active') and the fix is a rename, so the practical guard is procedural, not technical: treat CS0108 as an error during code review. Grep the build output / compile log for it rather than trusting the exit code or hoping to catch it by eye:

snippet
dotnet build 2>&1 | grep -i CS0108 && echo "SHADOWED MEMBER - fix before merge"

▸ WHY IT WORKS

C# member hiding is silent unless you explicitly use the new keyword. The editor compiler surfaces the CS0108 warning that dotnet build may suppress or miss. By using a distinct name, there's no ambiguity: your property is yours, and Component.Active remains the engine's enabled toggle.

Verified on engine 26.07.08e: seen in a real project.
s&box moves fast; an undated fix is a liability. Spot a stale detail?
changelog
  • Added: the shadow is a CS0108 warning, not an error, so it compiles and ships. The practical guard is procedural. Treat CS0108 as an error in code review (grep the compile log) rather than trusting dotnet build's exit code.

Want to know when new guides or fixes drop? Join the community to help build this out. Report gotchas, flag outdated fixes, or just lurk.

Join the Discord