r/UnityHelp • u/No_Clothes8954 • Jan 29 '26
Help Understanding Interfaces
As the title says, I was wondering if someone could help explain Interfaces and their implementation.
I'm trying to make an Interface for objects that can be picked up by the player, which changes the objects location and parent and also unparents when the player lets go of the object. I've read the Microsoft documentation and watched many videos that explain Interfaces, but when it comes to implementation, the logic of how it works falls through my mind.
any help is appreciated
2
Upvotes
View all comments
Show parent comment
1
u/No_Clothes8954 Jan 29 '26
I'm wanting to be able to create an interact system that is expandable so its easier to add new interactable objects within the game without creating bloat in the player controller in the future.
How it works at the moment is that i have a sphere collider that detects if objects within its range is in the interactable mask, then grabs the first one in an array to set as the interactable object and checks the interface of that object to see how to interact with it
Right now there's only liftable objects, but I want there to be one for heavy lifetable's and interaction with doors. I know I'm gonna add a lot more as I start adding more interactions.
I'll be honest I dont know if I'm using Interfaces as I should but the more i work on them the better it feels in terms of looking at my code. I've been able to make progress since posting this, but I also cant help but feel how much easier this would be if I just stuck in all in the player controller