I am currently working in unity to make a few games. I am using C#. I am usually happy with the code in my game and i know how to make it 'elegant', so to speak. I am very good at coding individual elements (Say, the spaceship in Asteroids). But I am only happy with my code until I get to the point where one object needs to interact with another. It becomes a spaghetti of code after that point and i ALWAYS drop the project.. I have yet to find a graceful way of handling things. I believe I have asked in various places around the internet, but I seem to keep coming back to this.
Is there any common method of handling the interactions between objects? anything that doesn't feel hacky? This problem arose again in my latest project. It is a Unity project, a 2d sidescroller. Detecting whether or not I hit a 'spike' with my character involves checking the collision objects tag and seeing whether or not it is a 'spike'. But then all my 'death' code is contained within the Player, not the spike. The spike isn't really anything other than a mesh collider with a tag. and this feels wrong.
So stackoverflow, how do you all handle this?