{"id":360985,"date":"2024-05-21T01:04:10","date_gmt":"2024-05-21T01:04:10","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=360985"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=360985","title":{"rendered":"<span>\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f \u043d\u0430 \u0413\u0440\u043e\u0443\u0432-\u0421\u0442\u0440\u0438\u0442. \u0410\u043d\u0430\u043b\u0438\u0437 \u0434\u0432\u0438\u0436\u043a\u0430 Grand Theft Auto: San Andreas \u043d\u0430 Unity<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0421\u0435\u0440\u0438\u044f Grand Theft Auto \u0441\u0442\u0430\u043b\u0430 \u043a\u0443\u043b\u044c\u0442\u043e\u0432\u043e\u0439 \u0432 \u0438\u0433\u0440\u043e\u0432\u043e\u0439 \u0438\u043d\u0434\u0443\u0441\u0442\u0440\u0438\u0438, \u0430 San Andreas \u2014 \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u0437\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u044e\u0449\u0438\u0445\u0441\u044f \u0447\u0430\u0441\u0442\u0435\u0439 \u0434\u043b\u044f \u043c\u043d\u043e\u0433\u0438\u0445 \u0438\u0433\u0440\u043e\u043a\u043e\u0432. \u0412\u0440\u0435\u043c\u044f \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442, \u043d\u043e \u0444\u0430\u043d\u0430\u0442\u044b \u0432\u0441\u0451 \u0442\u0430\u043a \u0436\u0435 \u043f\u0440\u0435\u0434\u0430\u043d\u044b \u0438\u0433\u0440\u0435. \u041a\u0442\u043e-\u0442\u043e \u0434\u043e\u0441\u0442\u0430\u0451\u0442 \u0441\u0442\u0430\u0440\u044b\u0439 \u0438 \u043f\u044b\u043b\u044c\u043d\u044b\u0439 \u0434\u0438\u0441\u043a \u0441 \u043d\u043e\u0441\u0442\u0430\u043b\u044c\u0433\u0438\u0435\u0439, \u0430 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u0430\u0445\u043e\u0434\u044f\u0442 \u0435\u0449\u0451 \u0434\u0430\u043b\u044c\u0448\u0435. \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u0444\u0430\u043d\u0430\u0442\u0441\u043a\u0438\u0439 \u043f\u0435\u0440\u0435\u043d\u043e\u0441 GTA: San Andreas \u043d\u0430 \u0434\u0432\u0438\u0436\u043e\u043a Unity \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 PVS-Studio!<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/bc4\/fac\/17b\/bc4fac17b2565694747f02c6afa02cdb.png\" alt=\"1083_GTA_SA_ru\/image1.png\" title=\"\" width=\"1600\" height=\"902\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/bc4\/fac\/17b\/bc4fac17b2565694747f02c6afa02cdb.png\"\/><\/figure>\n<h3>\u041e \u043f\u0440\u043e\u0435\u043a\u0442\u0435<\/h3>\n<p>SanAndreasUnity \u2014 \u044d\u0442\u043e Open Source \u043f\u0440\u043e\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u0442 Grand Theft Auto: San Andreas \u0432 Unity! \u041d\u043e\u0432\u044b\u0439 \u0434\u0432\u0438\u0436\u043e\u043a \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0434\u043b\u044f \u044d\u043d\u0442\u0443\u0437\u0438\u0430\u0441\u0442\u043e\u0432 \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0442\u044c \u0438 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0433\u0440\u0443 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0441\u0438\u043b\u044c\u043d\u0435\u0435, \u0447\u0435\u043c \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u043b\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u0438\u0433\u0440\u0430 \u043e\u0442 Rockstar Games. \u041f\u043e\u043c\u0438\u043c\u043e \u044d\u0442\u043e\u0433\u043e, \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430 \u043a\u0440\u043e\u0441\u0441\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u2014 \u0442\u0435\u043f\u0435\u0440\u044c \u0438\u0433\u0440\u0443 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043d\u0430 \u0441\u043c\u0430\u0440\u0442\u0444\u043e\u043d\u0435, \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0438 \u0434\u0430\u0436\u0435 \u0432 VR.<\/p>\n<p>\u041f\u0440\u043e\u0435\u043a\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 C#, \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u043b\u0441\u044f \u0444\u0430\u043d\u0430\u0442\u0430\u043c\u0438 \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u043e \u0441\u0438\u0445 \u043f\u043e\u0440. \u041f\u0440\u043e\u0435\u043a\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432 <a href=\"https:\/\/github.com\/GTA-ASM\/SanAndreasUnity\">\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u043d\u0430 GitHub<\/a>.<\/p>\n<blockquote>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435.<\/strong> \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b \u0444\u0430\u043d\u0430\u0442\u0441\u043a\u0438\u0435 &#171;\u0440\u0435\u043c\u0430\u0441\u0442\u0435\u0440\u044b&#187; \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0438\u0433\u0440, \u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 \u043d\u0435\u0434\u0430\u0432\u043d\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435\u0439 \u043e Heroes of Might and Magic III \u2014 <a href=\"https:\/\/pvs-studio.ru\/ru\/blog\/posts\/cpp\/1058\/\">\u0413\u0435\u0440\u043e\u0438 \u041a\u043e\u0434\u0430 \u0438 \u041c\u0430\u0433\u0438\u0438: \u0430\u043d\u0430\u043b\u0438\u0437 \u0438\u0433\u0440\u043e\u0432\u043e\u0433\u043e \u0434\u0432\u0438\u0436\u043a\u0430 VCMI<\/a>.<\/p>\n<\/blockquote>\n<h3>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 PVS-Studio \u0432 Unity<\/h3>\n<p>\u041d\u043e \u043f\u0435\u0440\u0435\u0434 \u0440\u0430\u0437\u0431\u043e\u0440\u043e\u043c \u043e\u0448\u0438\u0431\u043e\u043a \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0443\u0437\u043d\u0430\u0435\u043c \u2014 \u043a\u0430\u043a \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0430 Unity?<\/p>\n<p><strong>\u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0441\u0430\u043c\u043e\u0435 \u0432\u0430\u0436\u043d\u043e\u0435:<\/strong><\/p>\n<p>\u0423 \u0432\u0430\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d PVS-Studio \ud83d\ude42<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0436\u0435 \u0432\u044b \u0435\u0449\u0451 \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u0441\u0434\u0435\u043b\u0430\u043b\u0438, \u0442\u043e \u0432 \u044d\u0442\u043e\u043c \u0432\u0430\u043c \u043f\u043e\u043c\u043e\u0436\u0435\u0442 <a href=\"https:\/\/pvs-studio.ru\/ru\/pvs-studio\/try-free\/?utm_source=website&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=1083\">\u0434\u0430\u043d\u043d\u0430\u044f<\/a> \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430.<\/p>\n<h4>\u041e\u0442\u043a\u0440\u043e\u0439\u0442\u0435 \u043f\u0440\u043e\u0435\u043a\u0442 \u0432 Unity<\/h4>\n<p>\u0417\u0430\u0442\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 Unity \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0438\u0442\u0430\u0435\u043c\u044b\u0439 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432.<\/p>\n<p>\u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 &#171;External Script Editor&#187; \u043d\u0430 \u0432\u043a\u043b\u0430\u0434\u043a\u0435 &#171;External Tools&#187; \u0432 \u043e\u043a\u043d\u0435 &#171;Preferences&#187;.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u044d\u0442\u043e \u043e\u043a\u043d\u043e, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u043e\u043f\u0446\u0438\u044e \u043c\u0435\u043d\u044e &#171;Edit&#187; -> &#171;Preferences&#187; \u0432 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0435 Unity:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/da2\/4fd\/e9d\/da24fde9d169fac349ea1e15fbf0b3eb.png\" alt=\"1083_GTA_SA_ru\/image2.png\" title=\"\" width=\"642\" height=\"328\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/da2\/4fd\/e9d\/da24fde9d169fac349ea1e15fbf0b3eb.png\"\/><\/figure>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0432 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0439 IDE, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043e\u043f\u0446\u0438\u044e &#171;Assets&#187; -> &#171;Open C# Project&#187; \u0432 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0435 Unity.<\/p>\n<h4>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u0430\u043d\u0430\u043b\u0438\u0437 \u0432 IDE<\/h4>\n<p>\u042f \u0431\u0443\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Visual Studio 2022. \u0427\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442 \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 IDE, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0443\u043d\u043a\u0442 \u043c\u0435\u043d\u044e &#171;Extensions&#187; -> &#171;PVS-Studio&#187; -> &#171;Check Solution&#187;:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/299\/de0\/dc0\/299de0dc0244545a9a9f967b4cb371cd.png\" alt=\"1083_GTA_SA_ru\/image3.png\" title=\"\" width=\"548\" height=\"295\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/299\/de0\/dc0\/299de0dc0244545a9a9f967b4cb371cd.png\"\/><\/figure>\n<p>\u0412\u0441\u0451! \u0410\u043d\u0430\u043b\u0438\u0437 \u043a\u043e\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0443\u0449\u0435\u043d, \u0438 \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0447\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f\u043c\u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430.<\/p>\n<p>\u0411\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0430\u043d\u0430\u043b\u0438\u0437 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u043d\u0430 Unity \u043e\u043f\u0438\u0441\u0430\u043d \u0432 <a href=\"https:\/\/pvs-studio.ru\/ru\/docs\/manual\/6607\/\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>.<\/p>\n<blockquote>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435.<\/strong> \u0415\u0441\u043b\u0438 \u0432\u044b \u0432\u043f\u0435\u0440\u0432\u044b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 PVS-Studio, \u0442\u043e \u0430\u043d\u0430\u043b\u0438\u0437 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0434\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0439 \u043d\u0430 \u0432\u0435\u0441\u044c \u043a\u043e\u0434.<\/p>\n<p>\u0412\u0430\u043c \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0432\u0441\u0451 \u0441\u0440\u0430\u0437\u0443. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 <a href=\"https:\/\/pvs-studio.ru\/ru\/docs\/manual\/0032\/\">\u043f\u043e\u0434\u0430\u0432\u0438\u0442\u044c<\/a> \u0432\u0441\u0435 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f \u0438 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0430\u043d\u0430\u043b\u0438\u0437 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043d\u043e\u0432\u043e\u043c \u043a\u043e\u0434\u0435, \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044f\u0441\u044c \u043a \u0441\u0442\u0430\u0440\u044b\u043c \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f\u043c.<\/p>\n<\/blockquote>\n<h3>\u041d\u0430\u0432\u043e\u0434\u0438\u043c \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u043d\u0430 \u0443\u043b\u0438\u0446\u0430\u0445 \u041b\u043e\u0441-\u0421\u0430\u043d\u0442\u043e\u0441\u0430<\/h3>\n<h4>NullReferenceException<\/h4>\n<p>\u041e\u0434\u0438\u043d \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u0447\u0430\u0441\u0442\u044b\u0445 \u0432\u0440\u0430\u0433\u043e\u0432 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432, \u0433\u043b\u0430\u0432\u043d\u043e\u0435 \u0432\u043e\u0432\u0440\u0435\u043c\u044f \u0435\u0433\u043e \u043d\u0430\u0439\u0442\u0438.<\/p>\n<h4>Issue 1<\/h4>\n<p>\u0418\u043d\u043e\u0433\u0434\u0430 \u043e\u0448\u0438\u0431\u043a\u0430 \u043f\u043e\u0434\u043a\u0440\u0430\u0434\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0441\u0442.<\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434:<\/p>\n<pre><code class=\"cs\">public static void RegisterPrefab(GameObject prefab, Guid newAssetId,   SpawnHandlerDelegate spawnHandler, UnSpawnDelegate unspawnHandler) {   if (newAssetId == Guid.Empty)    {      Debug.LogError($\"Could not register handler for '{prefab.name}'         with new assetId because the new assetId was empty\");      return;   }   if (prefab == null)    {     Debug.LogError(\"Could not register handler for prefab        because the prefab was null\");     return;   }   ....   if (spawnHandler == null)    {     Debug.LogError($\"Can not Register null SpawnHandler for {assetId}\");     return;   }   if (unspawnHandler == null)    {     Debug.LogError($\"Can not Register null UnSpawnHandler for {assetId}\");     return;   }   .... } <\/code><\/pre>\n<p>\u0412 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043c\u0435\u0442\u043e\u0434\u0430 \u043d\u0430 <em>null<\/em>. \u041d\u043e \u0434\u0430\u0436\u0435 \u0442\u0430\u043a\u043e\u0435 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b (\u0438\u0440\u043e\u043d\u0438\u0447\u043d\u043e, \u0434\u0430?).<\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0435\u0440\u0432\u044b\u0435 \u0434\u0432\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438:<\/p>\n<pre><code class=\"cs\">public static void RegisterPrefab(GameObject prefab, Guid newAssetId, ....) {   if (newAssetId == Guid.Empty)   {     Debug.LogError($\"Could not register handler for '{prefab.name}'       with new assetId because the new assetId was empty\");     return;   }   if (prefab == null)   {     Debug.LogError(\"Could not register handler for prefab        because the prefab was null\");     return;   }   .... } <\/code><\/pre>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: <a href=\"https:\/\/pvs-studio.ru\/ru\/docs\/warnings\/v3095\/\">V3095<\/a> The &#8216;prefab&#8217; object was used before it was verified against null. Check lines: 669, 673. NetworkClient.cs 669<\/p>\n<p>\u0412 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 <em>newAssetId<\/em> \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a \u043f\u043e\u043b\u044e <em>name<\/em> \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 <em>prefab<\/em>, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 <em>prefab<\/em> \u0438\u0434\u0451\u0442 \u0443\u0436\u0435 \u043f\u043e\u0441\u043b\u0435. \u041d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0430 <em>null<\/em> \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u0432\u044b\u0431\u0440\u043e\u0441\u0443 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f <em>NullReferenceException<\/em>.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ffa\/92f\/ac5\/ffa92fac54b169e35ce5d9cb86c3423e.png\" alt=\"1083_GTA_SA_ru\/image4.png\" title=\"\" width=\"1600\" height=\"902\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ffa\/92f\/ac5\/ffa92fac54b169e35ce5d9cb86c3423e.png\"\/><\/figure>\n<p>\u041e\u0448\u0438\u0431\u043a\u0438 \u0432 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u0445 \u043e\u0448\u0438\u0431\u043e\u043a \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043e\u043f\u0430\u0441\u043d\u0435\u0435 5-\u0437\u0432\u0435\u0437\u0434\u043e\u0447\u043d\u043e\u0439 \u043f\u043e\u0433\u043e\u043d\u0438, \u0432\u0435\u0434\u044c \u0438\u0445 \u043b\u0435\u0433\u043a\u043e \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0434\u0430\u0436\u0435 <em>HESOYAM<\/em> \u0438\u043b\u0438 <em>BAGUVIX<\/em>, \u043d\u043e \u043d\u0430\u0434\u0435\u0436\u0434\u0430 \u0435\u0449\u0451 \u0435\u0441\u0442\u044c \u2014 \u044d\u0442\u043e <a href=\"https:\/\/pvs-studio.ru\/ru\/blog\/posts\/1048\/\">\u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437 \u043a\u043e\u0434\u0430<\/a>.<\/p>\n<h4>Issue 2<\/h4>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043f\u043e\u0434\u043e\u0437\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442:<\/p>\n<pre><code class=\"cs\">static void RebuildObserversCustom(NetworkIdentity identity, bool initialize) {   newObservers.Clear();   if (identity.visible != Visibility.ForceHidden)   {     aoi.OnRebuildObservers(identity, newObservers);     }   ....   \/\/ this code is from UNET, it's a bit strange but it works:   if (initialize)   {     if (!newObservers.Contains(localConnection))     {       if (aoi != null)           aoi.SetHostVisibility(identity, false);     }   } } <\/code><\/pre>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: <a href=\"https:\/\/pvs-studio.ru\/ru\/docs\/warnings\/v3095\/\">V3095<\/a> The &#8216;aoi&#8217; object was used before it was verified against null. Check lines: 1464, 1546. NetworkServer.cs 1464<\/p>\n<p>\u0424\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u043e \u043d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u0442 \u043f\u0440\u043e\u0448\u043b\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440: \u043a <em>aoi<\/em> \u043e\u0431\u0440\u0430\u0449\u0430\u044e\u0442\u0441\u044f \u0434\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0430 <em>null<\/em>. \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0435\u0441\u0442\u044c \u0448\u0430\u043d\u0441, \u0447\u0442\u043e \u043a\u043e\u0434 \u043d\u0435 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044e <em>NullReferenceException<\/em>, \u043d\u043e \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u0434\u043c\u0435\u0447\u0430\u0442\u044c \u0438 \u043f\u043e\u0434\u043e\u0437\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0441\u0442\u0430.<\/p>\n<p>\u041a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c, \u043a\u043e\u0434 \u0441\u0442\u0440\u0430\u043d\u043d\u044b\u0439. \u042d\u0442\u043e \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0438\u0437 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0430:<\/p>\n<p><em>&#171;this code is from UNET, it&#8217;s a bit strange but it works&#187;<\/em><\/p>\n<blockquote>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435.<\/strong> \u0415\u0441\u043b\u0438 \u0445\u043e\u0442\u0438\u0442\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u0443\u0437\u043d\u0430\u0442\u044c \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f <em>NullReferenceException<\/em> \u0438\u043b\u0438 \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0435\u0433\u043e, \u0441\u043e\u0432\u0435\u0442\u0443\u044e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 <a href=\"https:\/\/pvs-studio.ru\/ru\/blog\/posts\/csharp\/1049\/\">\u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0451\u0439<\/a>.<\/p>\n<\/blockquote>\n<h4>\u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f<\/h4>\n<p>\u041e\u0434\u043d\u0430 \u0438\u0437 \u043d\u043e\u0432\u044b\u0445 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 \u043d\u0430\u0448\u0435\u0433\u043e C# \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u2013 \u044d\u0442\u043e <a href=\"https:\/\/pvs-studio.ru\/ru\/blog\/posts\/csharp\/1071\/\">\u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a\u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u043b\u044f Unity \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432<\/a>!<\/p>\n<p>\u0414\u0430\u043d\u043d\u044b\u0435 \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a\u0438 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u044b \u043d\u0430 \u043f\u043e\u0438\u0441\u043a \u0447\u0430\u0441\u0442\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u0432 \u043d\u0438\u0445 \u043c\u0435\u0441\u0442, \u043d\u0435\u0433\u0430\u0442\u0438\u0432\u043d\u043e \u0441\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0445\u0441\u044f \u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u043e\u0432 \u043a\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u0441\u043d\u0438\u0436\u0435\u043d\u0438\u044e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438:<\/p>\n<h4>Issue 3<\/h4>\n<pre><code class=\"cs\">private void Update() {   if (!Loader.HasLoaded)     return;    _updateTimeLimitStopwatch.Restart();    this.FocusPointManager.Update(); \/\/ &lt;=   .... } <\/code><\/pre>\n<p>\u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u0430 <em>Update<\/em> \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u043d \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043a\u0430\u0436\u0434\u044b\u0439 \u043a\u0430\u0434\u0440. \u0410 \u0435\u0441\u043b\u0438 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0432 \u0447\u0430\u0441\u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u0443, \u0442\u043e&#8230; \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0434\u043e\u0433\u0430\u0434\u0430\u0442\u044c\u0441\u044f \u0441\u0430\u043c\u0438 \ud83d\ude42<\/p>\n<p>\u0412\u0437\u0433\u043b\u044f\u043d\u0435\u043c \u043d\u0430 <em>this.FocusPointManager.Update()<\/em>:<\/p>\n<pre><code class=\"cs\">public void Update() {   double timeNow = Time.timeAsDouble;    UnityEngine.Profiling.Profiler.BeginSample(\"Update focus points\");   this._focusPoints.RemoveAll(f => {....});                  \/\/ &lt;=   UnityEngine.Profiling.Profiler.EndSample();    bool hasElementToRemove = false;   _focusPointsToRemoveAfterTimeout.ForEach(_ => {....});     \/\/ &lt;=    if (hasElementToRemove)     _focusPointsToRemoveAfterTimeout.RemoveAll(_ => {....}); \/\/ &lt;= } <\/code><\/pre>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: <a href=\"https:\/\/pvs-studio.ru\/ru\/docs\/warnings\/v4003\/\">V4003<\/a> Avoid capturing variables in performance-sensitive context inside the &#8216;Update&#8217; method. This can lead to decreased performance. Cell.cs 427<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c\u0441\u044f, \u043f\u043e\u0447\u0435\u043c\u0443 \u044d\u0442\u043e\u0442 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u043a\u043e\u0434\u0430 \u043c\u043e\u0436\u0435\u0442 \u043d\u0435\u0433\u0430\u0442\u0438\u0432\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>\u041f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u0437\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u0438 \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0430\u0441\u0441\u0430 \u0437\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u044f, \u0430 \u0432 \u0435\u0433\u043e \u043f\u043e\u043b\u044f \u043f\u043e\u043c\u0435\u0449\u0430\u044e\u0442\u0441\u044f \u0437\u0430\u0445\u0432\u0430\u0447\u0435\u043d\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u0422\u0430\u043a \u043a\u0430\u043a \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0430\u0441\u0441\u0430 \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u0432 \u043a\u0443\u0447\u0435, \u044d\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u043d\u0430 GC.<\/p>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0434\u043d\u0438\u043c \u0438\u0437 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439, \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e\u0439 <em>RemoveAll<\/em> \u0438 <em>ForEach<\/em>. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438 \u0438 \u0441\u043d\u0438\u0437\u0438\u0442\u044c \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u043d\u0430 \u0441\u0431\u043e\u0440\u0449\u0438\u043a \u043c\u0443\u0441\u043e\u0440\u0430.<\/p>\n<h4>Issue 4<\/h4>\n<pre><code class=\"cs\">void OnGUI() {   if (!statisticsGUI) return;    GUILayout.BeginArea(new Rect(5, 110, 300, 300));    if (ServerActive())   {     ....     GUILayout.Label($\"connections: {server.connections.Count}\");     GUILayout.Label($\"SendQueue: {GetTotalSendQueue()}\");     GUILayout.Label($\"ReceiveQueue: {GetTotalReceiveQueue()}\");   }   .... } <\/code><\/pre>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: <a href=\"https:\/\/pvs-studio.ru\/ru\/docs\/warnings\/v4001\/\">V4001<\/a> Boxing usage inside the frequently called &#8216;OnGUI&#8217; method may decrease performance. KcpTransport.cs 281<\/p>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 <em>GUILayout.Label<\/em> \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u0435\u0441\u0442\u0430\u0445 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0443\u043f\u0430\u043a\u043e\u0432\u043a\u0430 \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0442\u0438\u043f\u0430 <em>int<\/em> \u0438\u043b\u0438 <em>long<\/em>. \u0421 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u0432\u043b\u0438\u044f\u043d\u0438\u0435 \u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435 \u0441\u0438\u043b\u044c\u043d\u044b\u043c, \u043d\u043e \u0441 \u0434\u0440\u0443\u0433\u043e\u0439, \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u2014 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c <em>ToString<\/em> \u0438 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043b\u0438\u0448\u043d\u0435\u0439 \u0443\u043f\u0430\u043a\u043e\u0432\u043a\u0438.<\/p>\n<blockquote>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435.<\/strong> IDE \u0441\u0447\u0438\u0442\u0430\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 <em>ToString<\/em> \u0438\u0437\u0431\u044b\u0442\u043e\u0447\u043d\u044b\u043c. \u0418 \u043f\u0440\u0430\u0432\u0434\u0430, \u0437\u0430\u0447\u0435\u043c \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u0432\u0441\u0451 \u0438 \u0442\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442? \u0422\u043e\u043b\u044c\u043a\u043e \u0432\u043e\u0442 \u044d\u0442\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u0442 \u043a \u0443\u043f\u0430\u043a\u043e\u0432\u043a\u0435 \u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0435. \u0411\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u044d\u0442\u043e\u0442 \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043d\u0435 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u0435 \u0441\u043b\u0443\u0447\u0430\u0438 \u0443\u043f\u0430\u043a\u043e\u0432\u043a\u0438 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043d\u044b \u0432 <a href=\"https:\/\/pvs-studio.ru\/ru\/blog\/posts\/csharp\/1060\/\">\u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a>.<\/p>\n<\/blockquote>\n<h4>Issue 5<\/h4>\n<pre><code class=\"cs\">private void LateUpdate() {   ....   if (ped != null)     this.FocusPos = ped.transform.position;    else if (Camera.main != null)     this.FocusPos = Camera.main.transform.position;   ....   float relAngle = Camera.main != null ?     Camera.main.transform.eulerAngles.y : 0f; .... } <\/code><\/pre>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: V4005 Expensive operation is performed inside the &#8216;Camera.main&#8217; property. Using such property in performance-sensitive context can lead to decreased performance. MiniMap.cs 190<\/p>\n<p>\u0410\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u043d\u0430\u0448\u0451\u043b \u0434\u0430\u043d\u043d\u044b\u0439 \u0443\u0447\u0430\u0441\u0442\u043e\u043a \u043a\u043e\u0434\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u043e\u0432\u043e\u0439 \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a\u0438. \u041e\u043d\u0430 \u0435\u0449\u0451 \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u043d\u043e \u0443\u0436\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u0430 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0434\u043b\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438!<\/p>\n<p>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u043c\u043d\u043e\u0433\u043e\u043a\u0440\u0430\u0442\u043d\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 <em>Camera.main<\/em>, \u0447\u0442\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a <a href=\"https:\/\/docs.unity3d.com\/ScriptReference\/Camera-main.html\">\u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u044e \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043d\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440<\/a>.<\/p>\n<p>\u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u043c \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439, \u0432 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0437\u0430\u043f\u0438\u0448\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 <em>Camera.main<\/em>. \u0412 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a \u044d\u0442\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439.<\/p>\n<h4>\u0420\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b<\/h4>\n<h4>Issue 6-7<\/h4>\n<p>\u041a\u043e\u043d\u0446\u043e\u0432\u043a\u0430 \u043f\u043e\u0434\u043a\u0430\u0447\u0430\u043b\u0430. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442:<\/p>\n<pre><code class=\"cs\">private void OnDrawGizmosSelected() {   ....   var vehicles = FindObjectsOfType&lt;Vehicle>()                 .Where(....)                 .OrderBy(....)                 .ToArray();   foreach (var vehicle in vehicles)   {     foreach (var seat in vehicle.Seats){....}     var closestSeat = vehicle.GetSeatAlignmentOfClosestSeat(transform.position);     if (closestSeat != Vehicle.SeatAlignment.None){....}     break;   } } <\/code><\/pre>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: <a href=\"https:\/\/pvs-studio.ru\/ru\/docs\/warnings\/v3020\/\">V3020<\/a> An unconditional &#8216;break&#8217; within a loop. PlayerController.cs 258<\/p>\n<p>\u041f\u0440\u043e\u0441\u0442\u0430\u044f \u0438 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0441\u0435\u0440\u044c\u0451\u0437\u043d\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430 \u2014 <em>break<\/em> \u043f\u0440\u0438 \u043b\u044e\u0431\u044b\u0445 \u043e\u0431\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430\u0445 \u043d\u0430 \u043f\u0435\u0440\u0432\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u0446\u0438\u043a\u043b\u0430. \u0412 \u0438\u0442\u043e\u0433\u0435 \u0438\u0437 \u0432\u0441\u0435\u0439 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 <em>vehicles<\/em> \u0432 \u0446\u0438\u043a\u043b\u0435 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u043d \u043b\u0438\u0448\u044c \u043f\u0435\u0440\u0432\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442.<\/p>\n<p>\u0415\u0449\u0451 \u043e\u0434\u0438\u043d \u0441\u0445\u043e\u0436\u0438\u0439 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442:<\/p>\n<pre><code class=\"cs\">public override void ClientLateUpdate() {   while (reliableClientToServer.Count > 0)   {     QueuedMessage message = reliableClientToServer[0];     if (message.time &lt;= Time.unscaledTime)     {       wrap.ClientSend(new ArraySegment&lt;byte>(message.bytes), Channels.Reliable);       reliableClientToServer.RemoveAt(0);     }     break;   }   .... } <\/code><\/pre>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: <a href=\"https:\/\/pvs-studio.ru\/ru\/docs\/warnings\/v3020\/\">V3020<\/a> An unconditional &#8216;break&#8217; within a loop. LatencySimulation.cs 220<\/p>\n<p>\u041a\u0430\u043a \u0438 \u0432 \u043f\u0440\u043e\u0448\u043b\u043e\u043c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0435 \u2014 <em>break<\/em> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0431\u0435\u0437\u0443\u0441\u043b\u043e\u0432\u043d\u044b\u043c \u0438 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0451\u0442 \u043d\u0430 \u043f\u0435\u0440\u0432\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438.<\/p>\n<p>\u0414\u0430\u043d\u043d\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u0442\u0435\u043c, \u0447\u0442\u043e \u0442\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <em>while<\/em>, \u0438 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u044b\u0435 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u044b \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u044e\u0442\u0441\u044f \u0435\u0449\u0451 \u0447\u0435\u0442\u044b\u0440\u0435 \u0440\u0430\u0437\u0430. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0442\u0430\u043a \u0438 \u0437\u0430\u0434\u0443\u043c\u0430\u043b, \u043d\u043e \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432 \u0438\u043b\u0438 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0435\u0433\u043e \u043d\u0430 \u044d\u0442\u043e \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u043d\u0435\u0442. \u0421\u0442\u0440\u0430\u043d\u043d\u043e\u0435 \u044d\u0442\u043e \u043c\u0435\u0441\u0442\u043e \u0438\u043b\u0438 \u043e\u0448\u0438\u0431\u043e\u0447\u043d\u043e\u0435, \u043f\u0443\u0441\u0442\u044c \u0440\u0435\u0448\u0430\u044e\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438, \u0430 \u043d\u0430\u043c \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u043b\u0438\u0448\u044c \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043d\u0430 \u043f\u043e\u0434\u043e\u0437\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/797\/862\/bd2\/797862bd2840d25d7d3ebdf752236929.png\" alt=\"1083_GTA_SA_ru\/image5.png\" title=\"\" width=\"1600\" height=\"902\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/797\/862\/bd2\/797862bd2840d25d7d3ebdf752236929.png\"\/><\/figure>\n<h4>Issue 8<\/h4>\n<p>\u041a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u0430\u0442\u0442\u0435\u0440\u043d \u043e\u0448\u0438\u0431\u043e\u043a, \u043e\u0442\u043b\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c\u044b\u0439 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430\u043c\u0438:<\/p>\n<pre><code class=\"cs\">public void SetString(string key, string value) {   if (m_syncDictionary.TryGetValue(key, out string existingValue))   {     if (value != existingValue)     {       m_syncDictionary[key] = value;     }   }   m_syncDictionary[key] = value; } <\/code><\/pre>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: <a href=\"https:\/\/pvs-studio.ru\/ru\/docs\/warnings\/v3008\/\">V3008<\/a> The &#8216;m_syncDictionary[key]&#8217; variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 112, 108. SyncedBag.cs 112<\/p>\n<p>\u041f\u0440\u0438 \u043f\u0440\u043e\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0438 \u0434\u0432\u0443\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u0439 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u0435 <em>m_syncDictionary[key]<\/em>. \u0410 \u0435\u0441\u043b\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u043d\u0435 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442&#8230; \u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u0435! \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0447\u0442\u043e \u043e\u0434\u043d\u043e \u0438\u0437 \u043d\u0438\u0445 \u0434\u043e\u043b\u0436\u043d\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f.<\/p>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>\u041d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0432\u0441\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0435 \u043d\u0435\u0434\u043e\u0447\u0451\u0442\u044b \u0432 \u043a\u043e\u0434\u0435, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043c\u043e\u043b\u043e\u0434\u0446\u044b, \u0438 \u043a\u043e\u0434 \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c. \u0421\u0442\u043e\u0438\u0442 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043e\u043d\u0438 \u0441\u0442\u0430\u0440\u0430\u043b\u0438\u0441\u044c \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c \u043b\u043e\u0433\u0438\u043a\u0443 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0438\u0433\u0440\u044b (\u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u043a\u043e\u0441\u0442\u044b\u043b\u044f\u043c\u0438 \u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u043c\u0438). \u041a\u043e\u043c\u044c\u044e\u043d\u0438\u0442\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043f\u0440\u0435\u0434\u0430\u043d\u044b \u0441\u0432\u043e\u0435\u043c\u0443 \u0432\u0442\u043e\u0440\u043e\u043c\u0443 \u0434\u043e\u043c\u0443 \u2014 <em>\u0413\u0440\u043e\u0443\u0432-\u0441\u0442\u0440\u0438\u0442\u0443<\/em>. Nice work!<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u0440\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0438\u0433\u0440\u043e\u0432\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432, \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 \u043d\u0430\u0448\u0438\u043c <a href=\"https:\/\/pvs-studio.ru\/ru\/blog\/posts\/?tag=GameDev\">\u0431\u043b\u043e\u0433\u043e\u043c<\/a>.<\/p>\n<p>\u0410 \u0435\u0441\u043b\u0438 \u0432\u0430\u0441 \u0437\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043b\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c Unity-\u043f\u0440\u043e\u0435\u043a\u0442 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e PVS-Studio, \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u043c\u043e\u0436\u043d\u043e <a href=\"https:\/\/pvs-studio.ru\/ru\/pvs-studio\/try-free\/?utm_source=website&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=1083\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435\u0439 \u0441 \u0430\u043d\u0433\u043b\u043e\u044f\u0437\u044b\u0447\u043d\u043e\u0439 \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u0435\u0439, \u0442\u043e \u043f\u0440\u043e\u0448\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u043f\u0435\u0440\u0435\u0432\u043e\u0434: Gleb Aslamov. <a href=\"https:\/\/pvs-studio.com\/en\/blog\/posts\/csharp\/1083\/\">Return to Grove Street. Checking the Grand Theft Auto: San Andreas engine in Unity<\/a>.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/775872\/\"> https:\/\/habr.com\/ru\/articles\/775872\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0421\u0435\u0440\u0438\u044f Grand Theft Auto \u0441\u0442\u0430\u043b\u0430 \u043a\u0443\u043b\u044c\u0442\u043e\u0432\u043e\u0439 \u0432 \u0438\u0433\u0440\u043e\u0432\u043e\u0439 \u0438\u043d\u0434\u0443\u0441\u0442\u0440\u0438\u0438, \u0430 San Andreas \u2014 \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u0437\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u044e\u0449\u0438\u0445\u0441\u044f \u0447\u0430\u0441\u0442\u0435\u0439 \u0434\u043b\u044f \u043c\u043d\u043e\u0433\u0438\u0445 \u0438\u0433\u0440\u043e\u043a\u043e\u0432. \u0412\u0440\u0435\u043c\u044f \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442, \u043d\u043e \u0444\u0430\u043d\u0430\u0442\u044b \u0432\u0441\u0451 \u0442\u0430\u043a \u0436\u0435 \u043f\u0440\u0435\u0434\u0430\u043d\u044b \u0438\u0433\u0440\u0435. \u041a\u0442\u043e-\u0442\u043e \u0434\u043e\u0441\u0442\u0430\u0451\u0442 \u0441\u0442\u0430\u0440\u044b\u0439 \u0438 \u043f\u044b\u043b\u044c\u043d\u044b\u0439 \u0434\u0438\u0441\u043a \u0441 \u043d\u043e\u0441\u0442\u0430\u043b\u044c\u0433\u0438\u0435\u0439, \u0430 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u0430\u0445\u043e\u0434\u044f\u0442 \u0435\u0449\u0451 \u0434\u0430\u043b\u044c\u0448\u0435. \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u0444\u0430\u043d\u0430\u0442\u0441\u043a\u0438\u0439 \u043f\u0435\u0440\u0435\u043d\u043e\u0441 GTA: San Andreas \u043d\u0430 \u0434\u0432\u0438\u0436\u043e\u043a Unity \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 PVS-Studio!<\/p>\n<figure class=\"full-width\"><\/figure>\n<h3>\u041e \u043f\u0440\u043e\u0435\u043a\u0442\u0435<\/h3>\n<p>SanAndreasUnity \u2014 \u044d\u0442\u043e Open Source \u043f\u0440\u043e\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u0442 Grand Theft Auto: San Andreas \u0432 Unity! \u041d\u043e\u0432\u044b\u0439 \u0434\u0432\u0438\u0436\u043e\u043a \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0434\u043b\u044f \u044d\u043d\u0442\u0443\u0437\u0438\u0430\u0441\u0442\u043e\u0432 \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0442\u044c \u0438 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0433\u0440\u0443 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0441\u0438\u043b\u044c\u043d\u0435\u0435, \u0447\u0435\u043c \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u043b\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u0438\u0433\u0440\u0430 \u043e\u0442 Rockstar Games. \u041f\u043e\u043c\u0438\u043c\u043e \u044d\u0442\u043e\u0433\u043e, \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430 \u043a\u0440\u043e\u0441\u0441\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u2014 \u0442\u0435\u043f\u0435\u0440\u044c \u0438\u0433\u0440\u0443 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043d\u0430 \u0441\u043c\u0430\u0440\u0442\u0444\u043e\u043d\u0435, \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0438 \u0434\u0430\u0436\u0435 \u0432 VR.<\/p>\n<p>\u041f\u0440\u043e\u0435\u043a\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 C#, \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u043b\u0441\u044f \u0444\u0430\u043d\u0430\u0442\u0430\u043c\u0438 \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u043e \u0441\u0438\u0445 \u043f\u043e\u0440. \u041f\u0440\u043e\u0435\u043a\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432 <a href=\"https:\/\/github.com\/GTA-ASM\/SanAndreasUnity\">\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u043d\u0430 GitHub<\/a>.<\/p>\n<blockquote>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435.<\/strong> \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b \u0444\u0430\u043d\u0430\u0442\u0441\u043a\u0438\u0435 &#171;\u0440\u0435\u043c\u0430\u0441\u0442\u0435\u0440\u044b&#187; \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0438\u0433\u0440, \u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 \u043d\u0435\u0434\u0430\u0432\u043d\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435\u0439 \u043e Heroes of Might and Magic III \u2014 <a href=\"https:\/\/pvs-studio.ru\/ru\/blog\/posts\/cpp\/1058\/\">\u0413\u0435\u0440\u043e\u0438 \u041a\u043e\u0434\u0430 \u0438 \u041c\u0430\u0433\u0438\u0438: \u0430\u043d\u0430\u043b\u0438\u0437 \u0438\u0433\u0440\u043e\u0432\u043e\u0433\u043e \u0434\u0432\u0438\u0436\u043a\u0430 VCMI<\/a>.<\/p>\n<\/blockquote>\n<h3>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 PVS-Studio \u0432 Unity<\/h3>\n<p>\u041d\u043e \u043f\u0435\u0440\u0435\u0434 \u0440\u0430\u0437\u0431\u043e\u0440\u043e\u043c \u043e\u0448\u0438\u0431\u043e\u043a \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0443\u0437\u043d\u0430\u0435\u043c \u2014 \u043a\u0430\u043a \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0430 Unity?<\/p>\n<p><strong>\u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0441\u0430\u043c\u043e\u0435 \u0432\u0430\u0436\u043d\u043e\u0435:<\/strong><\/p>\n<p>\u0423 \u0432\u0430\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d PVS-Studio \ud83d\ude42<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0436\u0435 \u0432\u044b \u0435\u0449\u0451 \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u0441\u0434\u0435\u043b\u0430\u043b\u0438, \u0442\u043e \u0432 \u044d\u0442\u043e\u043c \u0432\u0430\u043c \u043f\u043e\u043c\u043e\u0436\u0435\u0442 <a href=\"https:\/\/pvs-studio.ru\/ru\/pvs-studio\/try-free\/?utm_source=website&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=1083\">\u0434\u0430\u043d\u043d\u0430\u044f<\/a> \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430.<\/p>\n<h4>\u041e\u0442\u043a\u0440\u043e\u0439\u0442\u0435 \u043f\u0440\u043e\u0435\u043a\u0442 \u0432 Unity<\/h4>\n<p>\u0417\u0430\u0442\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 Unity \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0438\u0442\u0430\u0435\u043c\u044b\u0439 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432.<\/p>\n<p>\u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 &#171;External Script Editor&#187; \u043d\u0430 \u0432\u043a\u043b\u0430\u0434\u043a\u0435 &#171;External Tools&#187; \u0432 \u043e\u043a\u043d\u0435 &#171;Preferences&#187;.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u044d\u0442\u043e \u043e\u043a\u043d\u043e, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u043e\u043f\u0446\u0438\u044e \u043c\u0435\u043d\u044e &#171;Edit&#187; -> &#171;Preferences&#187; \u0432 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0435 Unity:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0432 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0439 IDE, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043e\u043f\u0446\u0438\u044e &#171;Assets&#187; -> &#171;Open C# Project&#187; \u0432 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0435 Unity.<\/p>\n<h4>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u0430\u043d\u0430\u043b\u0438\u0437 \u0432 IDE<\/h4>\n<p>\u042f \u0431\u0443\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Visual Studio 2022. \u0427\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442 \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 IDE, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0443\u043d\u043a\u0442 \u043c\u0435\u043d\u044e &#171;Extensions&#187; -> &#171;PVS-Studio&#187; -> &#171;Check Solution&#187;:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0412\u0441\u0451! \u0410\u043d\u0430\u043b\u0438\u0437 \u043a\u043e\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0443\u0449\u0435\u043d, \u0438 \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0447\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f\u043c\u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430.<\/p>\n<p>\u0411\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0430\u043d\u0430\u043b\u0438\u0437 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u043d\u0430 Unity \u043e\u043f\u0438\u0441\u0430\u043d \u0432 <a href=\"https:\/\/pvs-studio.ru\/ru\/docs\/manual\/6607\/\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>.<\/p>\n<blockquote>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435.<\/strong> \u0415\u0441\u043b\u0438 \u0432\u044b \u0432\u043f\u0435\u0440\u0432\u044b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 PVS-Studio, \u0442\u043e \u0430\u043d\u0430\u043b\u0438\u0437 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0434\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0439 \u043d\u0430 \u0432\u0435\u0441\u044c \u043a\u043e\u0434.<\/p>\n<p>\u0412\u0430\u043c \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0432\u0441\u0451 \u0441\u0440\u0430\u0437\u0443. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 <a href=\"https:\/\/pvs-studio.ru\/ru\/docs\/manual\/0032\/\">\u043f\u043e\u0434\u0430\u0432\u0438\u0442\u044c<\/a> \u0432\u0441\u0435 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f \u0438 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0430\u043d\u0430\u043b\u0438\u0437 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043d\u043e\u0432\u043e\u043c \u043a\u043e\u0434\u0435, \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044f\u0441\u044c \u043a \u0441\u0442\u0430\u0440\u044b\u043c \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f\u043c.<\/p>\n<\/blockquote>\n<h3>\u041d\u0430\u0432\u043e\u0434\u0438\u043c \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u043d\u0430 \u0443\u043b\u0438\u0446\u0430\u0445 \u041b\u043e\u0441-\u0421\u0430\u043d\u0442\u043e\u0441\u0430<\/h3>\n<h4>NullReferenceException<\/h4>\n<p>\u041e\u0434\u0438\u043d \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u0447\u0430\u0441\u0442\u044b\u0445 \u0432\u0440\u0430\u0433\u043e\u0432 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432, \u0433\u043b\u0430\u0432\u043d\u043e\u0435 \u0432\u043e\u0432\u0440\u0435\u043c\u044f \u0435\u0433\u043e \u043d\u0430\u0439\u0442\u0438.<\/p>\n<h4>Issue 1<\/h4>\n<p>\u0418\u043d\u043e\u0433\u0434\u0430 \u043e\u0448\u0438\u0431\u043a\u0430 \u043f\u043e\u0434\u043a\u0440\u0430\u0434\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0441\u0442.<\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434:<\/p>\n<pre><code class=\"cs\">public static void RegisterPrefab(GameObject prefab, Guid newAssetId,   SpawnHandlerDelegate spawnHandler, UnSpawnDelegate unspawnHandler) {   if (newAssetId == Guid.Empty)    {      Debug.LogError($\"Could not register handler for '{prefab.name}'         with new assetId because the new assetId was empty\");      return;   }   if (prefab == null)    {     Debug.LogError(\"Could not register handler for prefab        because the prefab was null\");     return;   }   ....   if (spawnHandler == null)    {     Debug.LogError($\"Can not Register null SpawnHandler for {assetId}\");     return;   }   if (unspawnHandler == null)    {     Debug.LogError($\"Can not Register null UnSpawnHandler for {assetId}\");     return;   }   .... } <\/code><\/pre>\n<p>\u0412 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043c\u0435\u0442\u043e\u0434\u0430 \u043d\u0430 <em>null<\/em>. \u041d\u043e \u0434\u0430\u0436\u0435 \u0442\u0430\u043a\u043e\u0435 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b (\u0438\u0440\u043e\u043d\u0438\u0447\u043d\u043e, \u0434\u0430?).<\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0435\u0440\u0432\u044b\u0435 \u0434\u0432\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438:<\/p>\n<pre><code class=\"cs\">public static void RegisterPrefab(GameObject prefab, Guid newAssetId, ....) {   if (newAssetId == Guid.Empty)   {     Debug.LogError($\"Could not register handler for '{prefab.name}'       with new assetId because the new assetId was empty\");     return;   }   if (prefab == null)   {     Debug.LogError(\"Could not register handler for prefab        because the prefab was null\");     return;   }   .... } <\/code><\/pre>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: <a href=\"https:\/\/pvs-studio.ru\/ru\/docs\/warnings\/v3095\/\">V3095<\/a> The &#8216;prefab&#8217; object was used before it was verified against null. Check lines: 669, 673. NetworkClient.cs 669<\/p>\n<p>\u0412 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 <em>newAssetId<\/em> \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a \u043f\u043e\u043b\u044e <em>name<\/em> \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 <em>prefab<\/em>, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 <em>prefab<\/em> \u0438\u0434\u0451\u0442 \u0443\u0436\u0435 \u043f\u043e\u0441\u043b\u0435. \u041d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0430 <em>null<\/em> \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u0432\u044b\u0431\u0440\u043e\u0441\u0443 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f <em>NullReferenceException<\/em>.<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u041e\u0448\u0438\u0431\u043a\u0438 \u0432 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u0445 \u043e\u0448\u0438\u0431\u043e\u043a \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043e\u043f\u0430\u0441\u043d\u0435\u0435 5-\u0437\u0432\u0435\u0437\u0434\u043e\u0447\u043d\u043e\u0439 \u043f\u043e\u0433\u043e\u043d\u0438, \u0432\u0435\u0434\u044c \u0438\u0445 \u043b\u0435\u0433\u043a\u043e \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0434\u0430\u0436\u0435 <em>HESOYAM<\/em> \u0438\u043b\u0438 <em>BAGUVIX<\/em>, \u043d\u043e \u043d\u0430\u0434\u0435\u0436\u0434\u0430 \u0435\u0449\u0451 \u0435\u0441\u0442\u044c \u2014 \u044d\u0442\u043e <a href=\"https:\/\/pvs-studio.ru\/ru\/blog\/posts\/1048\/\">\u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437 \u043a\u043e\u0434\u0430<\/a>.<\/p>\n<h4>Issue 2<\/h4>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043f\u043e\u0434\u043e\u0437\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442:<\/p>\n<pre><code class=\"cs\">static void RebuildObserversCustom(NetworkIdentity identity, bool initialize) {   newObservers.Clear();   if (identity.visible != Visibility.ForceHidden)   {     aoi.OnRebuildObservers(identity, newObservers);     }   ....   \/\/ this code is from UNET, it's a bit strange but it works:   if (initialize)   {     if (!newObservers.Contains(localConnection))     {       if (aoi != null)           aoi.SetHostVisibility(identity, false);     }   } } <\/code><\/pre>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: <a href=\"https:\/\/pvs-studio.ru\/ru\/docs\/warnings\/v3095\/\">V3095<\/a> The &#8216;aoi&#8217; object was used before it was verified against null. Check lines: 1464, 1546. NetworkServer.cs 1464<\/p>\n<p>\u0424\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u043e \u043d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u0442 \u043f\u0440\u043e\u0448\u043b\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440: \u043a <em>aoi<\/em> \u043e\u0431\u0440\u0430\u0449\u0430\u044e\u0442\u0441\u044f \u0434\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0430 <em>null<\/em>. \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0435\u0441\u0442\u044c \u0448\u0430\u043d\u0441, \u0447\u0442\u043e \u043a\u043e\u0434 \u043d\u0435 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044e <em>NullReferenceException<\/em>, \u043d\u043e \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u0434\u043c\u0435\u0447\u0430\u0442\u044c \u0438 \u043f\u043e\u0434\u043e\u0437\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0441\u0442\u0430.<\/p>\n<p>\u041a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c, \u043a\u043e\u0434 \u0441\u0442\u0440\u0430\u043d\u043d\u044b\u0439. \u042d\u0442\u043e \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0438\u0437 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0430:<\/p>\n<p><em>&#171;this code is from UNET, it&#8217;s a bit strange but it works&#187;<\/em><\/p>\n<blockquote>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435.<\/strong> \u0415\u0441\u043b\u0438 \u0445\u043e\u0442\u0438\u0442\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u0443\u0437\u043d\u0430\u0442\u044c \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f <em>NullReferenceException<\/em> \u0438\u043b\u0438 \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0435\u0433\u043e, \u0441\u043e\u0432\u0435\u0442\u0443\u044e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 <a href=\"https:\/\/pvs-studio.ru\/ru\/blog\/posts\/csharp\/1049\/\">\u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0451\u0439<\/a>.<\/p>\n<\/blockquote>\n<h4>\u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f<\/h4>\n<p>\u041e\u0434\u043d\u0430 \u0438\u0437 \u043d\u043e\u0432\u044b\u0445 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 \u043d\u0430\u0448\u0435\u0433\u043e C# \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u2013 \u044d\u0442\u043e <a href=\"https:\/\/pvs-studio.ru\/ru\/blog\/posts\/csharp\/1071\/\">\u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a\u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u043b\u044f Unity \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432<\/a>!<\/p>\n<p>\u0414\u0430\u043d\u043d\u044b\u0435 \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a\u0438 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u044b \u043d\u0430 \u043f\u043e\u0438\u0441\u043a \u0447\u0430\u0441\u0442\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u0432 \u043d\u0438\u0445 \u043c\u0435\u0441\u0442, \u043d\u0435\u0433\u0430\u0442\u0438\u0432\u043d\u043e \u0441\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0445\u0441\u044f \u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u043e\u0432 \u043a\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u0441\u043d\u0438\u0436\u0435\u043d\u0438\u044e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438:<\/p>\n<h4>Issue 3<\/h4>\n<pre><code class=\"cs\">private void Update() {   if (!Loader.HasLoaded)     return;    _updateTimeLimitStopwatch.Restart();    this.FocusPointManager.Update(); \/\/ &lt;=   .... } <\/code><\/pre>\n<p>\u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u0430 <em>Update<\/em> \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u043d \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043a\u0430\u0436\u0434\u044b\u0439 \u043a\u0430\u0434\u0440. \u0410 \u0435\u0441\u043b\u0438 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0432 \u0447\u0430\u0441\u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u0443, \u0442\u043e&#8230; \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0434\u043e\u0433\u0430\u0434\u0430\u0442\u044c\u0441\u044f \u0441\u0430\u043c\u0438 \ud83d\ude42<\/p>\n<p>\u0412\u0437\u0433\u043b\u044f\u043d\u0435\u043c \u043d\u0430 <em>this.FocusPointManager.Update()<\/em>:<\/p>\n<pre><code class=\"cs\">public void Update() {   double timeNow = Time.timeAsDouble;    UnityEngine.Profiling.Profiler.BeginSample(\"Update focus points\");   this._focusPoints.RemoveAll(f => {....});                  \/\/ &lt;=   UnityEngine.Profiling.Profiler.EndSample();    bool hasElementToRemove = false;   _focusPointsToRemoveAfterTimeout.ForEach(_ => {....});     \/\/ &lt;=    if (hasElementToRemove)     _focusPointsToRemoveAfterTimeout.RemoveAll(_ => {....}); \/\/ &lt;= } <\/code><\/pre>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: <a href=\"https:\/\/pvs-studio.ru\/ru\/docs\/warnings\/v4003\/\">V4003<\/a> Avoid capturing variables in performance-sensitive context inside the &#8216;Update&#8217; method. This can lead to decreased performance. Cell.cs 427<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c\u0441\u044f, \u043f\u043e\u0447\u0435\u043c\u0443 \u044d\u0442\u043e\u0442 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u043a\u043e\u0434\u0430 \u043c\u043e\u0436\u0435\u0442 \u043d\u0435\u0433\u0430\u0442\u0438\u0432\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>\u041f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u0437\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u0438 \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0430\u0441\u0441\u0430 \u0437\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u044f, \u0430 \u0432 \u0435\u0433\u043e \u043f\u043e\u043b\u044f \u043f\u043e\u043c\u0435\u0449\u0430\u044e\u0442\u0441\u044f \u0437\u0430\u0445\u0432\u0430\u0447\u0435\u043d\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u0422\u0430\u043a \u043a\u0430\u043a \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0430\u0441\u0441\u0430 \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u0432 \u043a\u0443\u0447\u0435, \u044d\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u043d\u0430 GC.<\/p>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0434\u043d\u0438\u043c \u0438\u0437 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439, \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e\u0439 <em>RemoveAll<\/em> \u0438 <em>ForEach<\/em>. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438 \u0438 \u0441\u043d\u0438\u0437\u0438\u0442\u044c \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u043d\u0430 \u0441\u0431\u043e\u0440\u0449\u0438\u043a \u043c\u0443\u0441\u043e\u0440\u0430.<\/p>\n<h4>Issue 4<\/h4>\n<pre><code class=\"cs\">void OnGUI() {   if (!statisticsGUI) return;    GUILayout.BeginArea(new Rect(5, 110, 300, 300));    if (ServerActive())   {     ....     GUILayout.Label($\"connections: {server.connections.Count}\");     GUILayout.Label($\"SendQueue: {GetTotalSendQueue()}\");     GUILayout.Label($\"ReceiveQueue: {GetTotalReceiveQueue()}\");   }   .... } <\/code><\/pre>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: <a href=\"https:\/\/pvs-studio.ru\/ru\/docs\/warnings\/v4001\/\">V4001<\/a> Boxing usage inside the frequently called &#8216;OnGUI&#8217; method may decrease performance. KcpTransport.cs 281<\/p>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 <em>GUILayout.Label<\/em> \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u0435\u0441\u0442\u0430\u0445 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0443\u043f\u0430\u043a\u043e\u0432\u043a\u0430 \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0442\u0438\u043f\u0430 <em>int<\/em> \u0438\u043b\u0438 <em>long<\/em>. \u0421 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u0432\u043b\u0438\u044f\u043d\u0438\u0435 \u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435 \u0441\u0438\u043b\u044c\u043d\u044b\u043c, \u043d\u043e \u0441 \u0434\u0440\u0443\u0433\u043e\u0439, \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u2014 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c <em>ToString<\/em> \u0438 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043b\u0438\u0448\u043d\u0435\u0439 \u0443\u043f\u0430\u043a\u043e\u0432\u043a\u0438.<\/p>\n<blockquote>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435.<\/strong> IDE \u0441\u0447\u0438\u0442\u0430\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 <em>ToString<\/em> \u0438\u0437\u0431\u044b\u0442\u043e\u0447\u043d\u044b\u043c. \u0418 \u043f\u0440\u0430\u0432\u0434\u0430, \u0437\u0430\u0447\u0435\u043c \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u0432\u0441\u0451 \u0438 \u0442\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442? \u0422\u043e\u043b\u044c\u043a\u043e \u0432\u043e\u0442 \u044d\u0442\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u0442 \u043a \u0443\u043f\u0430\u043a\u043e\u0432\u043a\u0435 \u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0435. \u0411\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u044d\u0442\u043e\u0442 \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043d\u0435 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u0435 \u0441\u043b\u0443\u0447\u0430\u0438 \u0443\u043f\u0430\u043a\u043e\u0432\u043a\u0438 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043d\u044b \u0432 <a href=\"https:\/\/pvs-studio.ru\/ru\/blog\/posts\/csharp\/1060\/\">\u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a>.<\/p>\n<\/blockquote>\n<h4>Issue 5<\/h4>\n<pre><code class=\"cs\">private void LateUpdate() {   ....   if (ped != null)     this.FocusPos = ped.transform.position;    else if (Camera.main != null)     this.FocusPos = Camera.main.transform.position;   ....   float relAngle = Camera.main != null ?     Camera.main.transform.eulerAngles.y : 0f; .... } <\/code><\/pre>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: V4005 Expensive operation is performed inside the &#8216;Camera.main&#8217; property. Using such property in performance-sensitive context can lead to decreased performance. MiniMap.cs 190<\/p>\n<p>\u0410\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u043d\u0430\u0448\u0451\u043b \u0434\u0430\u043d\u043d\u044b\u0439 \u0443\u0447\u0430\u0441\u0442\u043e\u043a \u043a\u043e\u0434\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u043e\u0432\u043e\u0439 \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a\u0438. \u041e\u043d\u0430 \u0435\u0449\u0451 \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u043d\u043e \u0443\u0436\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u0430 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0434\u043b\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438!<\/p>\n<p>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u043c\u043d\u043e\u0433\u043e\u043a\u0440\u0430\u0442\u043d\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 <em>Camera.main<\/em>, \u0447\u0442\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a <a href=\"https:\/\/docs.unity3d.com\/ScriptReference\/Camera-main.html\">\u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u044e \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043d\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440<\/a>.<\/p>\n<p>\u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u043c \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439, \u0432 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0437\u0430\u043f\u0438\u0448\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 <em>Camera.main<\/em>. \u0412 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a \u044d\u0442\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439.<\/p>\n<h4>\u0420\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b<\/h4>\n<h4>Issue 6-7<\/h4>\n<p>\u041a\u043e\u043d\u0446\u043e\u0432\u043a\u0430 \u043f\u043e\u0434\u043a\u0430\u0447\u0430\u043b\u0430. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442:<\/p>\n<pre><code class=\"cs\">private void OnDrawGizmosSelected() {   ....   var vehicles = FindObjectsOfType&lt;Vehicle>()                 .Where(....)                 .OrderBy(....)                 .ToArray();   foreach (var vehicle in vehicles)   {     foreach (var seat in vehicle.Seats){....}     var closestSeat = vehicle.GetSeatAlignmentOfClosestSeat(transform.position);     if (closestSeat != Vehicle.SeatAlignment.None){....}     break;   } } <\/code><\/pre>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-360985","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/360985","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=360985"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/360985\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=360985"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=360985"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=360985"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}