As someone who is a gamedev student, here is what I’ve noticed during these years.
Unity fame came first because there was only UDK from Epic, it took roughly 3-4 years to UE4 to be finally released.
Unity doesn’t require a significant hardware machine to run, in fact, an 2006 PC can run it, at least that’s what the official site says, in fact, that’s why the college classes focused only in Unity, you could barely run UDK in the old PCs here (C2D, 2xxx Radeon and 4gb RAM). Months ago the college replaced for new ones and now they have an optional class of UE4. I also believe that because of this, you can port to entry/mid level mobiles with no problems over optimization.
The engine GUI is more friendly and simple than UDK, no wonder why UE4 “copied” it.
It supports a wide range of code languages, especially Js and C#, UDK relied on UnrealScript, according to one teacher, people said it was acutally a good point of UE4 getting rid in favor of C++.
UDK was an standalone UT3 and was known fore being more oriented for FPS, Unity can be worked out for other game modes, it does even have it’s 2D project.
Because of those things, developers that know programming have moved to Unity as sometimes they didn’t need UDK visual power, and the engine malleable for many types of games, as I believe that working with the unrealscript could end having to even do some workaround in the .uc from the core.
UDK advantage over Unity that time, and as still today, is the fact that you can do visual programming and some interesting features, this is especially great for those who can’t program like me (tried to do on my own years ago with .uc), but if you wanted something different, that’s another story.
However, I think that things may come to change, UE4 is a full flegde engine unlike UDK, and even I saw a few flash and 2D games being developed on it, played one of them and while you may think it would be hardware heavy due to the engine nature since the origins, it went fine like a charm, and as far as I recall, only the vehicle set was not introduced in the initial 4.00 release, being instead in a month later, who knows that UE4 may end being the engine choice for indies in the near future? IMO Unity compared to the UE4 is not so friendly now, especially over what i’ve stated in the paragraph above.