On Habré there are many articles for newbies about
Unity , but I don’t want to repeat myself, but I want to share my experience in developing the first game and, more specifically, to tell about what I stumbled over. This will give a chance to all of you, dear developers, to protect yourself in the future from unplanned work and loss of time. I hope this material will be read by the developers of
Unity itself in order to improve their product.
Attention , under the cut screenshots
16+ !
Since most of us are technical people, I will sort it out on the shelves, fad and try to present the material as briefly, concisely and without water.
Task
I wanted to write something New Year, simple both in understanding and in management. As a result of the discussion with the target audience (my child), it was decided that the game would be like this:
')
- 2D (since it's more convenient to play 2D games on the phone)
- One finger control (sometimes a maximum of two)
- Killing time (just poking so as not to strain the brain)
- System of achievements (so that it was at least a little interesting to continue)
- Cartoon
- Pleasant music
- Without Internet
- Android (ease of installation of test apk files)
This all resulted in the idea of
" Satan Santa shoots deer that prevent him from taking his bag .
"
And then it all started ...
1. Third-party android library
Problem: I spent two days finding the right SDK, JDK, NDK and making Unity work with them. On my machine to Unity, sdk from the android studio was already present, but it didn’t work with them, I had to search for something else, install, try, search again ... two days ...
Proposal for improvement: it would be nice if the necessary sdk of the latest versions were installed automatically when Unity was installed, and if anyone needs to lower or upgrade - then let this someone set up his own, with pens.

2. Vector graphics
Problem: Unity out of the box does not understand
SVG . Even any small JS frameworks like Paper.js simply work elegantly with a vector, and such an elephant as Unity does not.
Solution: installed a beta package, which, like reading SVG, but in the end - convert it to raster. Acceptable, but embarrassing, Unity!
3. 2D platform
Problem: as seen in the screenshot, there is earth, and there is a snowball on it. And this is also
Mesh and
Polygon Collider . That is, it is a surface that interacts with objects and which can be modified in the editor. So in the current version of Unity there are no standard tools that can be used to simulate this.
Decision:- You can draw a raster with alpha (minus - edit it well, quite inconvenient)
- You can buy a plugin that does it (minus spending money)
- You can write the plugin yourself (minus - long to understand, long to write)
I chose a long, but free path;) If anyone needs such a plugin - write, share, tell you how to use, I don’t mind :)
By the way, I watched the demo of the new Unity beta, it seems like such a thing will come out of the box! Thank you for this, friends!
Yes, I would also add a socket to quickly create 2D primitives, circles there, small squares ... otherwise they simply do not exist, well, or it is necessary to go into the asset stor, search.
4. Rotation & Quaternion
Problem: a very complex system of 3d positioning and turns, unnecessary in 2D games.
Solution: it is just necessary to understand and accept, because the 2D game is a 3D game, with the coordinate Z = 0. But it would be nice to simplify this system in 2D mode, comrades;)
I killed a lot of time and almost broke my brain, trying to turn an object in the right direction to the desired angle, relative to another object, when in another engine I just wrote
player.a = 45; And many obvious methods in the current version are depricated.
5. Debag
Problem: for us, beginners, the debug option is available only as output of a variable value to the console using the
print () method. Full bryaki - the lot of those who pay. Here correct me if I am mistaken, but I couldn’t set up Visual Studio for debugging at all, although I did find a video that shows that you don’t need to set anything up, it should work. Concluded that debug is available in paid versions.
Solution: I just use
print () ... and I understand that debugging a complex project will be a decisive factor in purchasing a paid version of Unity. Marketers company sad Respect: (
Resolved! Thanks to the
Leopotam hint
, I installed an additional package for the studio, the
“Attach to Unity debugger” button appeared.
6. Tap and Click, Swipe and Mov
Problem: despite the convenience of the built-in user input system, there is a lack of simplicity in processing ordinary single tapes, clicks and swipes. I would like to use one method that returns the coordinates of a single click / tap for different types of devices: touch and desktop with a mouse, for example.
Solution: I had to write my class interlayer and wrap the necessary events.
Perhaps leave another comment regarding the management system. Many thanks to the developers of Unity for the universal Input, but for touch devices I would like universal controls too. For example, slide up - zabayndit on Jump, visualize the cross and buttons, as on the joystick, well, in that spirit. This can be bought with paid packages or, again, write yourself, spending time on bicycles.
7. Confusion with coordinates
Problem: it is impossible for an object to assign click coordinates and see it in the right place, and this is a bit unclear.
Solution: You must first read the documentation, understand and use various methods for mapping coordinates:
WorldToScreenPoint ()
ScreenToViewportPoint ()
transform.TransformPoint ()other…
I will explain, this is due to the fact that the distance in the scene is measured in arbitrary units other than a pixel and, in addition, the objects have a nesting system, respectively, the positioning is carried out relative to the parent.
8. Poor dial-up of UI controls
Problem: only the most basic elements are delivered from the box, and even then you have to tinker with some.
Solution: You can be content with little. For example, I spent a lot of time trying to make a dynamic list scroll. You can buy cool controls (minus - spend money).
9. Large apk file size
Problem: when building an empty project, its size is
21.9 MB (23,061,612 bytes)
Solution: you need to save on everything. I pinched mp3 files, compressed textures, tried not to include anything extra in the project. But with the addition of additional packages, the size mercilessly increased, tending to a hundred.
Google Play asks developers to post applications
<100Mb . (22 already gobbled up). There are, of course, mechanisms of a split, dynamic resource loading, but we are newbies, and our goal is to learn the basics, to realize our cherished dreams, and not to deal with market limits.
10. Cyrillic
Problem: having collected the project for the JS / HTML5 platform (for tests), it turned out that there are simply no texts written in Russian.
Solution: you need to download the font file, import it into assets, and then specify this imported font in the setting of each text.
This is somehow quite strange.
11. Productivity of physics
Problem: The game starts to slow down in the presence of complex colliders, when using the
Continuous mode for
Collision Detection , when several
Particle Systems are used in one scene, in short, when using everything that gives spectacularity and beauty to games.
Solution: use only the primitive colliders
Circle and
Rectangle ,
Collision Detection should be only
Discrete , the number of particles in the
Particle System should be set to the minimum acceptable. Well and still, not to allow my mistake and not to use collisions inside the particle system. The effect is, of course, beautiful, as blood flows down through the objects, but very resource-intensive.

Naturally, this is all relevant for 2D mobile games. But I would like Unity to develop, use new cool shaders for particles, for collisions, and for everything else complex and beautiful.
Conclusion
There were of course other pitfalls, but these are trifles. There were also unexpected advantages, such as:
- Prefabs
- Good documentation and community
- Automatic creation of a polygon collider on the alpha channel of the sprite
- Ease of use of sound effects
- Very handy animation on keyframes (with the addition of Anima2D and inverse kinematics)
But that's another story ...
As for the deadlines for the task - I was very hampered by point number 3 (the development of a plugin for modeling the platform) As an experienced developer, I evaluated the task for myself and evaluated it as follows: 20, 30, 40 (evenings / weekends, because during the day I am busy with my main work), where 20 is optimistic and 40 are pessimistic. If it were not for point number 3, then I would have got into 20-30, but in the end I spent about two months. (No, I did not work every evening, that is, I got about 40).
If anyone is interested, I would say that I had to draw the graphics myself, thanks to the
Inkscape program. I chose music exclusively with a license for free use.
A couple of days had to spend on publishing on
Google Play .
It took two more days to integrate advertising (you most likely will not see it, just wanted to try it, although the toy did not reflect commercial)
Yes, a lot could have been improved, but I wanted to amuse my friends before the New Year holidays.
Do not get me wrong, this is not a PR post. Most of all I want those who make the Unity engine itself to pay attention to these shortcomings and, of course, eliminate them (well, ideally). And I also want to help my brothers in the spirit not to get on the same rake as me.
And if I am mistaken in something, then do not judge strictly, share your advice in the comments!