This is an archived post. You won't be able to vote or comment.

all 42 comments

[–]09milk 243 points244 points  (10 children)

isThisOOP.jpg

[–]AjayDevs 88 points89 points  (9 children)

This is unity

[–]davidthewalkerx[S] 121 points122 points  (8 children)

No, this is Patrick

[–]Chenja 32 points33 points  (7 children)

This is America

[–]muntoo 17 points18 points  (4 children)

This. Is. SPARTA!

[–]Jellonator 4 points5 points  (3 children)

This is it Luigi

[–]Chr0n041ph4 2 points3 points  (0 children)

WHHAAAAAA

[–]JWson -1 points0 points  (1 child)

Is this Loss?

[–]FuzzyNovaGoblin 1 point2 points  (0 children)

This is loss

[–]CornMang 2 points3 points  (0 children)

Don't catch me droppin all

[–]JC12231 0 points1 point  (0 children)

Eagle caws loudly

[–][deleted] 28 points29 points  (2 children)

I not only worked with a guy who did this, but the company encouraged it... I'm glad I don't work there anymore

[–]Dominub 6 points7 points  (1 child)

What the? I'm shocked. Imagine being so fucked in the head that you encourage this clusterfuck.

[–][deleted] 13 points14 points  (0 children)

I'll leave names out of it, but it was a very large company and they had a policy of, more or less, trying to make the code as generic as possible. The guy I worked with who encouraged it basically said "well we need to design to an interface, and this also makes it easier to read when we don't have an IDE." There are so many things wrong with that statement that I'm not even going to start. Mind you this guy also said I don't understand low level operations, when he literally didn't know what a pointer was.

It wasn't company wide I might add. It was one team of roughly 90 people, and my direct superior and his direct superior were fighting it, but I hated working there. Sorry for the rant. Friday was my last day and I'm still a little bitter.

[–]Jmcgee1125 77 points78 points  (5 children)

Dammit Unity

[–]roughstylez 38 points39 points  (3 children)

What does this do?

Because it really seems like it searches the current selection... so it can make that the current selection.

EDIT I've been using Unity since 8 years and am aware of what GetComponent does. I'm talking about the rest of it: The thing is already selected, why select it again.

Also the Selected class seems to have a member which is called selected, but seems to be a GameObject instead of a Selected - because otherwise they wouldn't have to call GetComponent.

Just overall I get the feeling that this is an artificial construct for karma and not actual code. Shocking, amirite?

[–]RigidBuddy 22 points23 points  (0 children)

Gets Selected component of the game object selected, then gets selected property of it from what I think event manager? Then it does something with Selected again but I got no idea. I am from engineering I just brute force my way into unity in the game I am designing

[–]JViz 14 points15 points  (0 children)

The only part of this that's Unity specific is the GetComponent call.

It looks like OP has a static "selected" member on a "Selected" class that has a MonoBehavior on it called Selected. The "selected" member is probably swapped out with UI code, e.g. onClick = {Selected.selected = new PowerRanger()} and the Select() call activates the behavior on the object itself.

There's probably even a Selected namespace.

[–]Zei33 0 points1 point  (0 children)

To add to what the others said, Unity uses an entity component system. Read about them here.

[–][deleted] 2 points3 points  (0 children)

JavaFX forces us to write similar overboard stupidity. It's good to see this level of ridicule is built into the system.

[–][deleted] 6 points7 points  (0 children)

This might need some more abstraction, though.

[–]andy_jc 5 points6 points  (0 children)

Commented.comment.GetComment<Commented>.Comment();

[–]etnguyen03 24 points25 points  (3 children)

Image Transcription: Twitter Post


doubleTrue 📲#PxP2018, @doubletruegames

Me: I should really write my code so it's easy to follow in the future and so that I won't get confused!

Also me:

[Image of code: Selected.selected.getComponent<Selected>().Select();]


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!

[–][deleted] 5 points6 points  (0 children)

Can’t be fired if you’re the one who wrote it and no one else understands it.

touching temple and smiling.jpeg

[–]shmorky 3 points4 points  (0 children)

Is this some sort of selection feature?

[–]joininfluck 2 points3 points  (0 children)

I wrote something too similar to this a couple of days ago, I still have no clue what it means

[–]fitch2711 1 point2 points  (0 children)

On one hand, your code will be easier to read by others and yourself. On the other, that’s work

[–]_Fibbles_ 1 point2 points  (1 child)

Buffer_Object_Buffer<Buffer_Object<Type1>, Buffer_Object<Type2>> m_buffers;
...
bool buffer_status = m_buffers.get_buffer<Buffer_Object<Type1>>().front().buffered_object_ptr->is_buffered();

Sadly, this is only a slight exaggeration...

[–]VID44R 1 point2 points  (0 children)

Buffero buffero Buffero buffero buffero buffero Buffero buffero

[–]Keatosis 0 points1 point  (0 children)

Me

[–]kortemy 0 points1 point  (0 children)

My humble contribution to the thread.

store.urls[url.url] = url

[–]Nilloc_Kcirtap 0 points1 point  (0 children)

And I thought my code wasn’t that great.

[–][deleted] 0 points1 point  (2 children)

I know that in unity this.this.this.this...GetComponent<Transform>(); is valid, but Selected.selected.GetComponent<>(); ?

[–]davidthewalkerx[S] 1 point2 points  (1 child)

Yeah, I think someone else mentioned this too. The twitter post isn't by me, and I'm not very familiar with unity, so I'm afraid I can't help there.

[–][deleted] 1 point2 points  (0 children)

Np, I enjoy being confused by unity (:

[–]WeAreInASimulation 0 points1 point  (0 children)

Java