Is it more efficient to add script to walls or player?

Hello, I was wondering if it’s more efficient resource-wise to add the script to the player gameobject instead of on all 4 wall gameobjects.

Well, that depends. Think of it like a piece of string… How long is the piece of string?

That all being said, you’re often best to think of who’s responsibility is the said action rather than coming from a performance (I know you said resource-wise, but most people look at it from a performance standpoint) standpoint. It tends to cause less isuess in the long run if you think of it like that instead.

So would most people prefer to add the script to the walls for the sake of organization?

As I said, it depends.

Should it be the responsibility of the wall or the player to handle what the script does? What makes the most sense?

It’s almost like asking whether a yellow or a blue car goes faster. Without context, the answer has to be, “it depends”

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms