So when I first started unity, I did not know much about performance, so I did whatever it took to make the game. I feel like this is an experience a lot of people who first learned game development on unity may have gone through. I’m curious as to what silly things people do when they first start learning this way.
Me:
Making complicated models using only primitives in unity
I had tried to make stairs and made these intricate railings and beams that used tons of spheres and cylinders. The best part was I never marked a single one as static.
Put a child object on the unity first person character controller, with a kinematic Rigidbody and a collider so I could use on Collision Events. Then I put another child on there that was a trigger so I could use on trigger events.
GameObject.Find for everything that I did not feeling setting up references for.
Looking up whether an if, else is more effeicient than if, else if when performance was bad. And then modifying my code accordingly.
Using really long capsule colliders, when I could’ve used a raycast, but didn’t know what a raycast was.
I once had a null reference error that happened whenever an object went out of the playing field. I solved it with a generic try-catch block that simply deleted the GameObject that was out of play. Worked fine, so I promptly forgot about it.
Months later I changed some code somewhere and made a minor mistake. In some situations it would throw an error, which would be caught silently by my try-catch block, then delete every GameObject in the scene. The piece of code I was working on was many classes removed from the try-catch block. Led to one of the longest debugging sessions I can remember.
Moral of the story
Never write a try-catch block that catches every single error.
Never catch an error without logging a message to the console.
Not Unity, but PS2 from the mid 00s. In our game Mashed: Drive to Survive I added a jumbo jet flying low over one of the tracks but couldn’t work out why the framerate was affected so badly. It turned out I was somehow rendering 99 jumbo jets. My colleagues still bring it up from time to time.
that’s actually not far from what I had recently, that I wondered why in my small demo level the performance for some players was so bad and why it took forever for me to “unload” the game when i stopped playmode…turns out instead of having just " a hundred" fruit bushes I had 3 or 4 times that amount and perfectly stacked inside of each other so it never came up until I saw that there were several parent groups called “vegetation” when there should have been just one lol.