Practical question - What should contain the Entity class/interface.

Hello guys,
I am making a 3D multiplayer game and I am looking for Entity class best practices.

The Entity class (or interface) is going to be root for all entities in-game (NPCs, players, etc).

What are, in your opinion, required things in such structure. I mean stuff like getName(), getLocation() etc.

Thanks for answers in advantage

All depends on how you structure your game and your objects.
Don’t worry too much about abstraction until you actually need to abstract something - it can always be done later.

1 Like

I suggest avoiding inheritance entirely for something like this. It doesn’t really gain you much, and just encourages anti-patterns like if (object is SomeClass).

Just make “Entity” its own component (MonoBehaviour), and drop it on all of your entities such as Players, NPCs , etc… They can have other components that do all the other stuff.

1 Like