Multiple scripts for handling collisions on an object, or all into one giant script?

Hello, I’d like some advice from some experienced programmers, please.

The current project I am working on has some complicated stuff going on during collisions, depending on what is being collided with. I already have quite a big mess of code in the script that I have that handles collisions on this object and now I need to add more logic for collision with a different kind of object.

I was thinking of writing a separate script to handle collision with this object for the sake of readability. Would having two different scripts for collision have a significant performance impact? Will I run into obscure logic bugs by having two different scripts, if they happen to modify the same variables? In other words, is this a good idea or not?

Unless you have lots of collisions every single frame, you shouldn’t notice any performance impact. I think you’re even more likely to have logic bugs with one monster script. For me, separate, smaller scripts make it easier to check for correctness, including modifying the same variables.