[ARCH] Replace SendMessage anti-pattern with interfaces or C# events #15

Open
opened 2026-03-12 00:03:05 +00:00 by lavarius · 0 comments
Owner

🟠 High — Architecture

Files: Interactable.cs, InteractionManager.cs, CharacterZoneChanger.cs

SendMessage("MethodName") is used for communication between components. This has no compile-time safety — typos in the string silently break things, and it's impossible to find callers via IDE.

Fix: Replace with C# interfaces or events:

public interface IInteractable { void OnInteract(); }
public interface IZoneAware { void OnZoneChanged(ZoneType zone); }

Or use UnityEvent fields for designer-friendly wiring.

## 🟠 High — Architecture **Files:** `Interactable.cs`, `InteractionManager.cs`, `CharacterZoneChanger.cs` `SendMessage("MethodName")` is used for communication between components. This has no compile-time safety — typos in the string silently break things, and it's impossible to find callers via IDE. **Fix:** Replace with C# interfaces or events: ```csharp public interface IInteractable { void OnInteract(); } public interface IZoneAware { void OnZoneChanged(ZoneType zone); } ``` Or use `UnityEvent` fields for designer-friendly wiring.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lavarius/ProjectOverlay#15
No description provided.