r/badcode • • Oct 16 '20

c# Me when the

Post image
1.0k Upvotes

47 comments sorted by

118

u/healplease Oct 16 '20

when the

27

u/Gummi_Ghost Oct 17 '20

Sun goes down we'll be feelin' alright.

18

u/foop629 Oct 17 '20

Me when the when

8

u/GawkaMolley Oct 17 '20 edited Oct 17 '20

days are code And the

4

u/Bobbbay Oct 17 '20

lights are dark And the

98

u/Ahajha1177 Oct 16 '20

I found a line in some old code that was just : // This

Same energy lol

9

u/[deleted] Oct 17 '20

Maybe it was referencing “this”

6

u/TimGreller Oct 17 '20

But which one?

1

u/[deleted] Oct 18 '20

this one, duh

1

u/andiconda Oct 17 '20

This needs a "this" award

91

u/RootedCube Oct 17 '20
/*
    The Start Function
    
    This functions starts the
    It executed when is called by
    Is called fore 1st frame update, wicht
    The have
    Start th. 

    fram
    start

    how
*/

40

u/xezrunner Oct 17 '20

It properly depicts the psychological state of the developer at the time of writing

11

u/TimGreller Oct 17 '20

Reading this feels like r/ihadastroke meets programming & poetry

36

u/PaksuNaksu Oct 16 '20

You know what happens when the

48

u/[deleted] Oct 16 '20

Unity

16

u/stickcult Oct 17 '20

Yep. The epitome of bad code.

16

u/[deleted] Oct 17 '20

As in Unity itself is bad code? Or people who use Unity tend to write bad code?

48

u/stickcult Oct 17 '20

I mean Unity attracts a lot of people who want to make games but have very little programming experience, so their code generally isn't the best, but I can't judge them for that. Gotta start somewhere. But yeah, Unity itself is basically the definition of tech debt, it's pretty rough to work with sometimes.

16

u/Waterprop Oct 17 '20

Unity Asset Store is great example of this. There's a lot of great stuff there but also bad too, especially code side (there's good code too!)

Biggest thing I've seen that many people pay no attention to garbage collection at all. I get it's automatically collected but that automatic collection is NOT cheap and free.

Unity uses the Boehm–Demers–Weiser garbage collector, a stop-the-world garbage collector. Whenever Unity needs to perform garbage collection, it stops running your program code and only resumes normal execution when the garbage collector has finished all its work. This interruption can cause delays in the execution of your game that last anywhere from less than one millisecond to hundreds of milliseconds, depending on how much memory the garbage collector needs to process and on the platform the game is running on. For real-time applications like games, this can become quite a big issue, because you can’t sustain the consistent frame rate that smooth animation require when the garbage collector suspends a game’s execution. These interruptions are also known as GC spikes, because they show as spikes in the Profiler frame time graph. In the next sections you can learn more about how to write your code to avoid unnecessary garbage-collected memory allocations while running the game, so the garbage collector has less work to do.

Source

9

u/Atrufulgium Oct 17 '20

Luckily there's the bandaid of smearing out the GC over multiple frames. This way people can ignore shitty code even longer! Sigh.

7

u/xezrunner Oct 17 '20

I went into Unity knowing that it's not going to be a good time if my code is all hacks.

I'm learning a lot about performance optimization and good practices along the way. So far, everything's been going amazing!

I have a friend that tried to get into Unity (2D), but they very quickly dropped it. They expected things to just work.. Unity is a full-fledged game engine, you'll need some introduction and coding background for it to be a pleasant experience.

0

u/[deleted] Oct 17 '20

[deleted]

12

u/flapjackrl Oct 17 '20 edited Oct 24 '20

yeah it honestly just depends what you’re making though. there are fantastic unity games like night in the woods and hollow knight that take advantage of what the engine offers but obviously that is limited to one niche style. you can grow an apple tree with a good seed but the same won’t apply when you’re looking to grow an orchard of apricots.

0

u/[deleted] Oct 23 '20

[deleted]

2

u/PixxlMan Oct 27 '20

It's probably just that none of these advertise themselves as unity, and as such you don't associate unity with them

2

u/[deleted] Oct 17 '20

It really is.

14

u/ce-walalang Oct 17 '20

Image Transcription: Code


// Start is called before the first frame update
// This starts the
void Start() 

I'm a human volunteer content transcriber for Reddit and you could be too! If you'd like more information on what we do and why we do it, click here!

7

u/Ahajha1177 Oct 17 '20

Good human

6

u/MurdoMaclachlan public boolean isInt(int i) { return true; } Oct 17 '20

Good human!

3

u/ce-walalang Oct 17 '20

thank you, fellow good human :)

10

u/redditsoaddicting Oct 17 '20

That's why you don't interrupt people while they're busy.

7

u/lucidspoon Oct 17 '20

This starts the void

6

u/schroeder8 Oct 16 '20

I’m in this picture and I don’t like it

3

u/App240 Oct 17 '20

I’m in this pixture and I don’t

5

u/[deleted] Oct 17 '20

Wow that comment is very

4

u/survivalking4 Oct 17 '20

When you the

3

u/Hozerino Oct 17 '20

i hate it when i write some code that

2

u/__Adrielus__ Oct 17 '20

I do this way too much

2

u/ya_Bob_Jonez Oct 17 '20
// The do of an a have did

Me writing comments for my code ^

1

u/MasterKtos Oct 17 '20

It's best to start it while

1

u/Marcusaralius76 Oct 17 '20

They key to writing efficient code in unity is

1

u/Bassie_c Oct 17 '20

Ok, now I want to program again 😁

1

u/alexugoku Oct 17 '20

This starts the VOID.

1

u/asaf92 Oct 18 '20

Every Unity example code is always

1

u/tFischerr Oct 18 '20

ME WHEN THE

WHEN THE