{"id":417634,"date":"2024-06-30T01:40:50","date_gmt":"2024-06-30T01:40:50","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=417634"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2024-06-30T01:40:50","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=417634","title":{"rendered":"<span>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0448\u0443\u0442\u0435\u0440\u0430 \u0441 LeoECS. \u0427\u0430\u0441\u0442\u044c 1<\/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><em>\u0414\u0440\u0443\u0437\u044c\u044f, \u044d\u0442\u043e \u043f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0443 LeoECS \u0438\u0437 \u043f\u0440\u0435\u0434\u0441\u0442\u043e\u044f\u0449\u0435\u0439 \u0441\u0435\u0440\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0432\u0430\u043c \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u043f\u043e\u043d\u044f\u0442\u044c, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 LeoECS \u0432 Unity \u0438 \u0440\u0435\u0448\u0438\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u0438\u0434\u044b \u043f\u0440\u043e\u0431\u043b\u0435\u043c, \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0449\u0438\u0445 \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435. \u0412\u0441\u0435 \u0441\u043e\u0432\u0435\u0442\u044b, \u0438\u0437\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u0432 \u043d\u0438\u0445, \u043d\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0441\u043e\u0431\u043e\u044e \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0441\u0432\u043e\u0434 \u043f\u0440\u0430\u0432\u0438\u043b, \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432, \u0430 \u0441\u043a\u043e\u0440\u0435\u0435 \u043d\u0430\u0431\u043e\u0440 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0439 \u0438 best practices, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043c\u043e\u0433\u0443\u0442 \u0432\u0430\u043c \u043e\u0441\u0432\u043e\u0438\u0442\u044c\u0441\u044f \u0432 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u043c. \u041f\u0435\u0440\u0435\u0434 \u0447\u0442\u0435\u043d\u0438\u0435\u043c \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0432\u044b \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442\u0435 \u043f\u0440\u0438\u043d\u0446\u0438\u043f \u0440\u0430\u0431\u043e\u0442\u044b \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u043e\u0433\u043e \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430 <\/em><a href=\"https:\/\/habr.com\/ru\/post\/197920\/\" rel=\"noopener noreferrer nofollow\"><em>Entity Component System (ECS)<\/em><\/a><em>, \u0438 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u044c\u0442\u0435\u0441\u044c \u0441 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0435\u0439 LeoECS, \u0442\u0430\u043a \u043a\u0430\u043a \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0438\u0433\u0440\u0443 \u0436\u0430\u043d\u0440\u0430 Top-Down shooter, \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0447\u0430\u0441\u0442\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0449\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u0440\u0435\u0448\u0435\u043d\u0438\u044f, \u0438 \u043e\u0442\u0432\u043b\u0435\u043a\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0435\u0439 ECS, \u043d\u0435 \u0431\u0443\u0434\u0435\u043c.<br \/><\/em><a href=\"https:\/\/habr.com\/ru\/post\/578054\/\" rel=\"noopener noreferrer nofollow\"><em>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f<\/em><\/a><em> <\/em><a href=\"https:\/\/habr.com\/ru\/post\/578054\/\" rel=\"noopener noreferrer nofollow\"><em>\u0447\u0430\u0441\u0442\u044c<\/em><\/a><\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/934\/2c6\/5e7\/9342c65e79bb088df5c01e9e2a174f78.png\" width=\"1565\" height=\"855\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/934\/2c6\/5e7\/9342c65e79bb088df5c01e9e2a174f78.png\"\/><\/figure>\n<p><a href=\"https:\/\/github.com\/Leopotam\/ecs\" rel=\"noopener noreferrer nofollow\">LeoECS <\/a>\u2013 \u044d\u0442\u043e \u043e\u0434\u043d\u0430 \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u0431\u044b\u0441\u0442\u0440\u044b\u0445, \u043b\u0435\u0433\u043a\u043e\u0432\u0435\u0441\u043d\u044b\u0445 \u0438 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430 Entity Component System \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 C# \u0441 \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0435\u0439 \u0441 Unity: <a href=\"https:\/\/github.com\/Leopotam\/ecs-unityintegration\" rel=\"noopener noreferrer nofollow\">\u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u0434\u0435\u0431\u0430\u0433\u0433\u0435\u0440<\/a>, \u044d\u043c\u0438\u0442\u0442\u0435\u0440\u044b \u0441\u043e\u0431\u044b\u0442\u0438\u0439 <a href=\"https:\/\/github.com\/supremestranger\/leoecs-physics\" rel=\"noopener noreferrer nofollow\">\u0444\u0438\u0437\u0438\u043a\u0438 <\/a>\u0438 <a href=\"https:\/\/github.com\/Leopotam\/ecs-ui\" rel=\"noopener noreferrer nofollow\">uGUI<\/a>, <a href=\"https:\/\/github.com\/voody2506\/UniLeo\" rel=\"noopener noreferrer nofollow\">\u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0435\u0440<\/a> \u0441\u0446\u0435\u043d\u044b \u0441 GameObject\u2019\u0430\u043c\u0438 \u0438 MonoBehaviour\u2019\u0430\u043c\u0438 \u0432 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0432 \u201c\u043c\u0438\u0440\u0435\u201d ECS. \u0424\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0443\u0436\u0435 \u0434\u043e\u043b\u0433\u043e\u0435 \u0432\u0440\u0435\u043c\u044f, \u043d\u0430 \u043d\u0435\u043c \u0432\u044b\u043f\u0443\u0449\u0435\u043d \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u043e\u0434\u0438\u043d \u043a\u043e\u043c\u043c\u0435\u0440\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u0440\u043e\u0435\u043a\u0442.<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0438 \u043d\u0430\u0447\u043d\u0435\u043c \u0441 \u0441\u0430\u043c\u043e\u0433\u043e \u0433\u043b\u0430\u0432\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u0432 \u0432\u0430\u0448\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u2013 EcsStartup. \u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 MonoBehaviour \u043a\u043b\u0430\u0441\u0441 \u0438 \u043f\u0440\u0438\u043a\u0440\u0435\u043f\u0438\u0442\u0435 \u0435\u0433\u043e \u043a \u043a\u0430\u043a\u043e\u043c\u0443-\u043d\u0438\u0431\u0443\u0434\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u0443 \u0432 \u0441\u0446\u0435\u043d\u0435 \u2013 \u043b\u0443\u0447\u0448\u0435 \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u043f\u043e\u0434 \u044d\u0442\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0443\u0441\u0442\u043e\u0439 GameObject. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0442\u043e\u0440 \u0441 Unity, \u0442\u043e\u0433\u0434\u0430 EcsStartup \u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043f\u0430\u043f\u043a\u0438 (Components, Systems, Services, UnityComponents) \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438.<\/p>\n<pre><code class=\"cs\">public class EcsStartup : MonoBehaviour {     private EcsWorld ecsWorld;     private EcsSystems systems;       private void Start()     {         ecsWorld = new EcsWorld(); \/\/ \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0439 EcsWorld         systems = new EcsSystems(ecsWorld); \/\/ \u0438 \u0433\u0440\u0443\u043f\u043f\u0443 \u0441\u0438\u0441\u0442\u0435\u043c \u0432 \u044d\u0442\u043e\u043c \u043c\u0438\u0440\u0435              systems             .Add(new PlayerInitSystem()) \/\/ \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u0435\u0440\u0432\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443             .Init(); \/\/ \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0433\u0440\u0443\u043f\u043f\u0443 \u0441\u0438\u0441\u0442\u0435\u043c     }       private void Update()     {         systems?.Run(); \/\/ \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043a\u0430\u0436\u0434\u044b\u0439 \u043a\u0430\u0434\u0440     }       private void OnDestroy()     {         systems?.Destroy(); \/\/ \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0430\u0435\u043c \u0433\u0440\u0443\u043f\u043f\u0443 \u0441\u0438\u0441\u0442\u0435\u043c \u043f\u0440\u0438 \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u0438\u0438 \u0441\u0442\u0430\u0440\u0442\u0430\u043f\u0430         systems = null;         ecsWorld?.Destroy() \/\/ \u0438 \u043c\u0438\u0440         ecsWorld = null;     } } <\/code><\/pre>\n<p>\u041e\u0442\u043b\u0438\u0447\u043d\u043e, \u043f\u0435\u0440\u0432\u044b\u0439 \u0448\u0430\u0433 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d! \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u0430\u0448 \u043f\u0435\u0440\u0432\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0438 \u043f\u0435\u0440\u0432\u0443\u044e Init-\u0441\u0438\u0441\u0442\u0435\u043c\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u0437\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u0438\u0433\u0440\u043e\u043a\u0430 \u0438 \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0435\u0439 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432.<\/p>\n<pre><code class=\"cs\">public struct Player \/\/ \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0438\u0433\u0440\u043e\u043a\u0430 {     public Rigidbody playerRigidbody; }<\/code><\/pre>\n<pre><code class=\"cs\">public class PlayerInitSystem : IEcsInitSystem {     private EcsWorld ecsWorld; \/\/ \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043c\u0438\u0440 \u0438\u043d\u0436\u0435\u043a\u0442\u0438\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438    public void Init()   {       EcsEntity playerEntity = ecsWorld.NewEntity();       \/\/ entity.Get \u2013 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0438\u043b\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u043e\u0432\u044b\u0439                  \/\/ \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u0434\u043b\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u0438 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0433\u0440\u043e\u043a\u0430       ref var player = ref playerEntity.Get&lt;Player>()         \/\/ \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438\u043d\u043f\u0443\u0442\u0430       ref var inputData = ref playerEntity.Get&lt;PlayerInputData>();                player.playerRigidbody = \/\/ \u0433\u0434\u0435 \u0436\u0435 \u0432\u0437\u044f\u0442\u044c Rigidbody \u0438\u0433\u0440\u043e\u043a\u0430?   } }<\/code><\/pre>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u043c\u044b \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0438\u0441\u044c \u0441 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439. \u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u043a\u0443\u0434\u0430-\u0442\u043e \u0432\u0437\u044f\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435, \u0447\u0442\u043e\u0431\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0438\u0445 \u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b ECS. \u041a\u0430\u043a \u0431\u044b\u0442\u044c? \u041f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u0432 \u0433\u043e\u043b\u043e\u0432\u0443 &#8212; \u043d\u0430\u0439\u0442\u0438 \u0438\u0433\u0440\u043e\u043a\u0430 \u043d\u0430 \u0441\u0446\u0435\u043d\u0435 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0442\u0435\u0433\u0430, \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0438\u043b\u0438 \u0434\u0430\u0436\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 MonoBehaviour, \u043d\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043a\u043e\u043f\u043d\u0435\u043c \u0433\u043b\u0443\u0431\u0436\u0435&#8230;<\/p>\n<h2>\u042d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445<\/h2>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0430\u0431\u0441\u0442\u0440\u0430\u0433\u0438\u0440\u0443\u0435\u043c\u0441\u044f \u043e\u0442 \u043d\u0430\u0448\u0435\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0438 \u043f\u043e\u0434\u0443\u043c\u0430\u0435\u043c \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043d\u0430\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432\u043d\u0435\u0448\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. \u0421\u0430\u043c\u044b\u0439 \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u2013 \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u0438\u0445 \u043d\u0430 \u0442\u0440\u0438 \u0442\u0438\u043f\u0430: Static Data, Scene Data \u0438 Runtime Data.<\/p>\n<p>Static Data \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0438\u0433\u0440\u044b \u2013 \u0437\u0434\u0435\u0441\u044c \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0435\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b. \u042d\u0442\u043e \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u043f\u0440\u0435\u0444\u0430\u0431\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0438\u043d\u0441\u0442\u0430\u043d\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0432 \u0440\u0430\u043d\u0442\u0430\u0439\u043c\u0435, \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u043a\u0430\u0440\u0442\u044b \u0438 \u043f\u0440\u043e\u0447\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b. \u041f\u0440\u043e\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0435\u0435 \u0447\u0435\u0440\u0435\u0437 ScriptableObject, \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 EcsStartup.<\/p>\n<p>Scene Data \u2013 \u044d\u0442\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0441\u0446\u0435\u043d\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430 \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u0446\u0435\u043d\u0430\u0445. \u0412 \u043d\u0435\u0439 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u043f\u0430\u0432\u043d \u043f\u043e\u0438\u043d\u0442 \u0438\u0433\u0440\u043e\u043a\u0430 \u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u044e\u043d\u0438\u0442\u043e\u0432, \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438, \u0438\u043d\u0434\u0438\u0432\u0438\u0434\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0446\u0435\u043d\u044b \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435. \u041f\u043e \u0441\u0443\u0442\u0438, \u044d\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u044b\u0439 MonoBehaviour \u043a\u043b\u0430\u0441\u0441, \u043f\u0440\u0438\u043a\u0440\u0435\u043f\u043b\u0435\u043d\u043d\u044b\u0439 \u043a Startup-\u043e\u0431\u044a\u0435\u043a\u0442\u0443, \u0430 \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043d\u0435\u0433\u043e, \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0441\u043e Static Data, \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 EcsStartup.<\/p>\n<p>Runtime Data \u2013 \u044d\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u044b\u0439 C# \u043a\u043b\u0430\u0441\u0441, \u043a\u0443\u0434\u0430 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043c\u0435\u0449\u0430\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445 \u00ab\u0437\u0434\u0435\u0441\u044c \u0438 \u0441\u0435\u0439\u0447\u0430\u0441\u00bb, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u044b \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0438\u0433\u0440\u044b. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043a\u0430\u0440\u0442\u0430 \u043a\u043b\u0435\u0442\u043e\u043a, \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043a\u0430\u043c\u0435\u0440\u0443, \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c \u0438\u0433\u0440\u043e\u043a\u0430 \u0438 \u043c\u043d\u043e\u0433\u043e\u0435 \u0434\u0440\u0443\u0433\u043e\u0435. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u0445, \u043d\u043e, \u0442\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u0435\u0441\u043b\u0438 \u0432\u044b \u0443\u0432\u0435\u0440\u0435\u043d\u044b, \u0447\u0442\u043e \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0432 \u0441\u0432\u043e\u0435\u043c \u0440\u043e\u0434\u0435, \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u0432 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0447\u0430\u0441\u0442\u044f\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u044e, \u0434\u0430\u0436\u0435 \u0447\u0442\u043e-\u0442\u043e \u0432\u0440\u043e\u0434\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u0430, \u0432\u0430\u043c \u0431\u0443\u0434\u0435\u0442 \u0443\u0434\u043e\u0431\u043d\u0435\u0435 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0435\u0433\u043e \u0432 \u044d\u0442\u043e\u0442 \u0432\u0438\u0434 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>\u041a\u0430\u043a \u0436\u0435 \u043d\u0430\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a\u043e \u0432\u0441\u0435\u043c \u044d\u0442\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u043c \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445? \u0428\u0442\u0430\u0442\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f data injection \u0432 LeoECS \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u043c \u0432 \u043e\u0434\u043d\u0443 \u0441\u0442\u0440\u043e\u043a\u0443 \u0432\u043d\u0435\u0434\u0440\u0438\u0442\u044c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0430\u0441\u0441\u0430 \u0432 \u0433\u0440\u0443\u043f\u043f\u0443 \u0441\u0438\u0441\u0442\u0435\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0440\u0435\u0444\u043b\u0435\u043a\u0441\u0438\u0438. \u0427\u0442\u043e\u0431\u044b \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u043d\u043e\u043c\u0443 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0443, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u043e\u043b\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u0442\u0438\u043f\u0430 \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b.<\/p>\n<h2>\u0412\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u043a LeoECS<\/h2>\n<pre><code class=\"cs\">public class EcsStartup : MonoBehaviour {     \/\/ \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 StaticData \u0438 SceneData, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u0432\u0435\u0441\u0438\u0442\u044c \u0432 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0435     \/\/ \u0447\u0435\u0440\u0435\u0437 \u0438\u043d\u0441\u043f\u0435\u043a\u0442\u043e\u0440     public StaticData configuration;     public SceneData sceneData;     private EcsWorld ecsWorld;     private EcsSystems systems;    private void Start()     {       ecsWorld = new EcsWorld();       systems = new EcsSystems(ecsWorld);         \/\/ \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 RuntimeData.       RuntimeData runtimeData = new RuntimeData();        systems           .Add(new PlayerInitSystem())           \/\/ \u0438\u043d\u0436\u0435\u043a\u0442\u0438\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435           .Inject(configuration)           .Inject(sceneData)           .Inject(runtimeData)           .Init();     }     private void Update()   {       systems?.Run();   }    private void OnDestroy()   {         systems?.Destroy();         systems = null;         ecsWorld?.Destroy();         ecsWorld = null;   } }<\/code><\/pre>\n<pre><code class=\"cs\">[CreateAssetMenu] public class StaticData : ScriptableObject {     public GameObject playerPrefab; }<\/code><\/pre>\n<pre><code class=\"cs\">public class SceneData : MonoBehaviour {     public Transform playerSpawnPoint; }<\/code><\/pre>\n<pre><code class=\"cs\">public class RuntimeData { } <\/code><\/pre>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u043a PlayerInitSystem \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0432\u043b\u043e\u0436\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0433\u0440\u043e\u043a\u0430 \u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b ECS.<\/p>\n<pre><code class=\"cs\">public class PlayerInitSystem : IEcsInitSystem {     private EcsWorld ecsWorld;   private StaticData staticData; \/\/ \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 StaticData \u0438 SceneData   private SceneData sceneData;    public void Init()   {         EcsEntity playerEntity = ecsWorld.NewEntity();        ref var player = ref playerEntity.Get&lt;Player>();       ref var inputData = ref playerEntity.Get&lt;PlayerInputData>();                  \/\/ \u0421\u043f\u0430\u0432\u043d\u0438\u043c GameObject \u0438\u0433\u0440\u043e\u043a\u0430         GameObject playerGO = Object.Instantiate(staticData.playerPrefab, sceneData.playerSpawnPoint.position, Quaternion.identity);       player.playerRigidbody = playerGO.GetComponent&lt;Rigidbody>();   } }<\/code><\/pre>\n<p>\u041d\u0430\u0441\u0442\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u043f\u0435\u0440\u0435\u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u0438\u0433\u0440\u043e\u043a\u0430. \u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e\u043c \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432. \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432 \u043e\u0434\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u043b\u043e\u0432\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0431 \u0438\u043d\u043f\u0443\u0442\u0435, \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0438\u0445 \u0432 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 PlayerInputData, \u0430 \u0432 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0434\u0432\u0438\u0433\u0430\u0442\u044c \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0430 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430.<\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u043b\u0435 \u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 PlayerInputData:<\/p>\n<pre><code class=\"cs\">public struct PlayerInputData {     public Vector3 moveInput; }<\/code><\/pre>\n<p>\u0418 \u0441\u043e\u0437\u0434\u0430\u0442\u044c Run-\u0441\u0438\u0441\u0442\u0435\u043c\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043a\u0430\u0436\u0434\u044b\u0439 \u043a\u0430\u0434\u0440 \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430. \u041d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0435\u0435 \u0432 \u0433\u0440\u0443\u043f\u043f\u0443 \u0441\u0438\u0441\u0442\u0435\u043c \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 EcsStartup.<\/p>\n<pre><code class=\"cs\">public class PlayerInputSystem : IEcsRunSystem {     private EcsFilter&lt;PlayerInputData> filter; \/\/ \u0444\u0438\u043b\u044c\u0442\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0434\u0430\u0441\u0442 \u043d\u0430\u043c \u0432\u0441\u0435 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438, \u0443 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0435\u0441\u0442\u044c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 PlayerInputData        public void Run()     {         foreach (var i in filter)         {             \/\/ \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430. \u0412\u0430\u0436\u0435\u043d \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u043a\u043e\u043d\u0441\u0442\u0440\u0435\u0439\u043d\u0442\u043e\u0432 \u0444\u0438\u043b\u044c\u0442\u0440\u0430 - \u0446\u0438\u0444\u0440\u0430 \u043f\u043e\u0441\u043b\u0435 Get \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u043e\u043c\u0435\u0440 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043e\u043d \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442             ref var input = ref filter.Get1(i)             \/\/ \u0412\u044b\u0437\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 filter.Get2(i) \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f.             \/\/ \u041f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u0432 \u0444\u0438\u043b\u044c\u0442\u0440\u0435 \u0432\u044b \u043c\u0435\u043d\u044f\u0435\u0442\u0435 \u0435\u0433\u043e \u043a\u043b\u0430\u0441\u0441, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0443 \u0444\u0438\u043b\u044c\u0442\u0440\u0430 \u0441 1 \u043a\u043e\u043d\u0441\u0442\u0440\u0435\u0439\u043d\u0442\u043e\u043c \u043d\u0435\u0442 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 Get2(), Get3(), etc.                        input.moveInput = new Vector3(Input.GetAxisRaw(\"Horizontal\"), 0f, Input.GetAxisRaw(\"Vertical\")); \/\/ \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435         }     } }<\/code><\/pre>\n<p>\u0421\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0432 \u0441\u0442\u0430\u0440\u0442\u0430\u043f\u0435 \u0434\u043e\u043b\u0436\u043d\u0430 \u0438\u0434\u0442\u0438 \u0434\u0440\u0443\u0433\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u0432\u0438\u0433\u0430\u0435\u0442 \u0438\u0433\u0440\u043e\u043a\u0430.<\/p>\n<p>\u041a\u0430\u043a \u043e\u043f\u044b\u0442\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 Unity, \u043c\u044b \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u043f\u0440\u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0438 \u0441 \u0444\u0438\u0437\u0438\u043a\u043e\u0439, \u043d\u0430\u043c \u043b\u0443\u0447\u0448\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0446\u0438\u043a\u043b FixedUpdate \u0441 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u0442\u0438\u043a\u0440\u0435\u0439\u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043a\u0430\u043a\u0438\u0445-\u043b\u0438\u0431\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0441 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f\u043c\u0438. \u041d\u043e \u0443 \u043d\u0430\u0441 \u043b\u0438\u0448\u044c \u043e\u0434\u043d\u0430 \u0433\u0440\u0443\u043f\u043f\u0430 \u0441\u0438\u0441\u0442\u0435\u043c \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u043e\u043d\u0430 \u0432 \u0446\u0438\u043a\u043b\u0435 Update. \u0412\u044b\u0445\u043e\u0434 \u043e\u0447\u0435\u0432\u0438\u0434\u0435\u043d \u2013 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u0433\u0440\u0443\u043f\u043f\u0443 \u0441\u0438\u0441\u0442\u0435\u043c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0432 FixedUpdate().<\/p>\n<p>\u041a\u0441\u0442\u0430\u0442\u0438, \u043d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 Rigidbody \u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0438 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0434\u0432\u0438\u0433\u0430\u0442\u044c\u0441\u044f.<\/p>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c, \u043a\u0430\u043a \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043f\u043e\u043b\u0435 \u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435 \u0438\u0433\u0440\u043e\u043a\u0430, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0435\u0435 \u0437\u0430 \u0435\u0433\u043e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"cs\">public struct Player {     public Rigidbody playerRigidbody;     public float playerSpeed; }<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u0437\u044f\u0442\u044c \u044d\u0442\u043e\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0438\u0437 \u043d\u0430\u0448\u0435\u0433\u043e ScriptableObject &#8212; StaticData. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u043c \u0432 \u044d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441 \u043f\u043e\u043b\u0435 playerSpeed \u0438 \u0437\u0430\u0434\u0430\u0434\u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0432 \u0430\u0441\u0441\u0435\u0442\u0435:<\/p>\n<pre><code class=\"cs\">[CreateAssetMenu] public class StaticData : ScriptableObject {     public GameObject playerPrefab;     public float playerSpeed; }<\/code><\/pre>\n<p>\u0412 PlayerInitSystem \u043c\u044b \u0432\u043e\u0437\u044c\u043c\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0437 Static Data \u0438 \u043f\u043e\u043b\u043e\u0436\u0438\u043c \u0435\u0433\u043e \u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0438\u0433\u0440\u043e\u043a\u0430:<\/p>\n<pre><code class=\"cs\">player.playerSpeed = staticData.playerSpeed;<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u043e\u0432\u0443\u044e \u0433\u0440\u0443\u043f\u043f\u0443 \u0441\u0438\u0441\u0442\u0435\u043c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c\u0441\u044f \u0432 FixedUpdate:<\/p>\n<pre><code class=\"cs\">public class EcsStartup : MonoBehaviour {     public StaticData configuration;     public SceneData sceneData;      private EcsWorld ecsWorld;     private EcsSystems updateSystems;     private EcsSystems fixedUpdateSystems; \/\/ \u043d\u043e\u0432\u0430\u044f \u0433\u0440\u0443\u043f\u043f\u0430 \u0441\u0438\u0441\u0442\u0435\u043c      private void Start()     {         ecsWorld = new EcsWorld();         updateSystems = new EcsSystems(ecsWorld);         fixedUpdateSystems = new EcsSystems(ecsWorld);         RuntimeData runtimeData = new RuntimeData();          updateSystems             .Add(new PlayerInitSystem())             .Add(new PlayerInputSystem())             .Inject(configuration)             .Inject(sceneData)             .Inject(runtimeData);          fixedUpdateSystems             .Add(new PlayerMoveSystem()); \/\/ \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f                \/\/ \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0433\u0440\u0443\u043f\u043f\u044b \u0441\u0438\u0441\u0442\u0435\u043c         updateSystems.Init();         fixedUpdateSystems.Init();     }      private void Update()     {         updateSystems?.Run();     }      private void FixedUpdate()     {         fixedUpdateSystems?.Run(); \/\/ \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0438\u0445 \u043a\u0430\u0436\u0434\u044b\u0439 \u0442\u0438\u043a FixedUpdate()     }      private void OnDestroy()     {         updateSystems?.Destroy();         updateSystems = null;         fixedUpdateSystems?.Destroy();         fixedUpdateSystems = null;         ecsWorld?.Destroy();         ecsWorld = null;     } }<\/code><\/pre>\n<p>\u0422\u0430\u043a \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u0438\u0433\u0440\u043e\u043a\u0430:<\/p>\n<pre><code class=\"cs\">public class PlayerMoveSystem : IEcsRunSystem {     private EcsFilter&lt;Player, PlayerInputData> filter;          public void Run()     {         foreach (var i in filter)         {             ref var player = ref filter.Get1(i);             ref var input = ref filter.Get2(i);              Vector3 direction = (Vector3.forward * input.moveInput.z + Vector3.right * input.moveInput.x).normalized;             player.playerRigidbody.AddForce(direction * player.playerSpeed);         }     } }<\/code><\/pre>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0442\u0435\u043f\u0435\u0440\u044c \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436 \u043f\u043e\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u043b\u0441\u044f \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u043a\u0443\u0440\u0441\u043e\u0440\u0430. \u0417\u0430\u0434\u0430\u0447\u0430 \u0432\u0435\u0441\u044c\u043c\u0430 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u0430, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u0443 \u043c\u0435\u0445\u0430\u043d\u0438\u043a\u0443 \u0432 \u043e\u0434\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 &#8212; PlayerRotationSystem. \u041c\u044b \u043c\u043e\u0433\u043b\u0438 \u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a Transform\u2019\u0443 \u0438\u0433\u0440\u043e\u043a\u0430 \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 Rigidbody, \u043d\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043b\u0443\u0447\u0448\u0435 \u043f\u0440\u043e\u043a\u0438\u043d\u0435\u043c \u0435\u0433\u043e \u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0432 init-\u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0438\u0433\u0440\u043e\u043a\u0430 \u0442\u0430\u043a \u0436\u0435, \u043a\u0430\u043a \u0438 \u043f\u0440\u043e\u043a\u0438\u043d\u0443\u043b\u0438 \u0441\u0430\u043c Rigidbody.<\/p>\n<pre><code class=\"cs\">public struct Player {     public Transform playerTransform; \/\/ \u043d\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435 \u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435 \u0438\u0433\u0440\u043e\u043a\u0430     public Rigidbody playerRigidbody;     public float playerSpeed; }<\/code><\/pre>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0441\u0442\u0440\u043e\u0447\u043a\u0443 \u0432 PlayerInitSystem:<\/p>\n<pre><code class=\"cs\">player.playerTransform = playerGO.transform; <\/code><\/pre>\n<p>\u041e\u0442\u043b\u0438\u0447\u043d\u043e. \u041d\u0430\u043c \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043a\u0430\u043c\u0435\u0440\u0443, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043c \u0435\u0435 \u0432 SceneData &#8212; \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0430\u0437\u043d\u0430\u0447\u0438\u0442\u044c \u0435\u0435 \u0440\u0443\u043a\u0430\u043c\u0438 \u0432 \u0441\u0446\u0435\u043d\u0435.\u00a0<\/p>\n<pre><code class=\"cs\">public class SceneData : MonoBehaviour {     public Transform playerSpawnPoint;     public Camera mainCamera; }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043f\u043e\u043b\u043d\u0438\u043c \u043d\u0430\u0448 \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u0438\u0441\u0442\u0435\u043c updateSystems \u043d\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439, \u043e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0433\u043e\u0432\u043e\u0440\u0438\u043b\u0438 \u0440\u0430\u043d\u0435\u0435:<\/p>\n<pre><code class=\"cs\">public class PlayerRotationSystem : IEcsRunSystem {     private EcsFilter&lt;Player> filter;     private SceneData sceneData;      public void Run()     {         foreach (var i in filter)         {             ref var player = ref filter.Get1(i);              Plane playerPlane = new Plane(Vector3.up, player.playerTransform.position);             Ray ray = sceneData.mainCamera.ScreenPointToRay(Input.mousePosition);             if (!playerPlane.Raycast(ray, out var hitDistance)) continue;              player.playerTransform.forward = ray.GetPoint(hitDistance) - player.playerTransform.position;         }     } }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0448 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436 \u0445\u043e\u0434\u0438\u0442 \u0438 \u043f\u043e\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f, \u043d\u043e \u0434\u043b\u044f \u043f\u043e\u043b\u043d\u043e\u0442\u044b \u043a\u0430\u0440\u0442\u0438\u043d\u044b \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0439. \u0412 \u043d\u0430\u0448\u0435\u0439 \u0438\u0433\u0440\u0435 \u0434\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0439 (\u043a\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u043e \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0438 \u043f\u043e\u0432\u043e\u0440\u043e\u0442 \u0438\u0433\u0440\u043e\u043a\u0430, \u0438 \u0432\u0435\u043a\u0442\u043e\u0440 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f) \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c Blend Tree \u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435 Animator, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043b\u0435\u0433\u043a\u043e \u0441\u043c\u0435\u0448\u0438\u0432\u0430\u0442\u044c \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043a\u0430\u043a\u0438\u0445-\u0442\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e 5 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0439: Idle, \u0445\u043e\u0434\u044c\u0431\u0430 \u0432\u043f\u0435\u0440\u0435\u0434, \u0445\u043e\u0434\u044c\u0431\u0430 \u043d\u0430\u0437\u0430\u0434, \u0445\u043e\u0434\u044c\u0431\u0430 \u0432\u043b\u0435\u0432\u043e, \u0445\u043e\u0434\u044c\u0431\u0430 \u0432\u043f\u0440\u0430\u0432\u043e. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u043a\u0430\u043a \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0430, \u0442\u0430\u043a \u0438 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 \u043a \u043d\u0435\u043c\u0443 \u0432 Unity Asset Store. \u042f \u043e\u0441\u0442\u0430\u0432\u043b\u044e \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0430\u0441\u0441\u0435\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b, \u0432 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0430\u0442\u044c\u0438.<\/p>\n<p>\u0412 Blend Tree \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0439, \u043a\u0430\u043a \u043d\u0430 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0435:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/bfd\/06d\/22e\/bfd06d22e159b10c2ddaa3ff2833f82b.png\" width=\"1611\" height=\"645\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/bfd\/06d\/22e\/bfd06d22e159b10c2ddaa3ff2833f82b.png\"\/><\/figure>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043b\u0438\u0448\u044c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0434\u043b\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 Horizontal \u0438 Vertical \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0432\u0435\u043a\u0442\u043e\u0440\u0430 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f (\u0438\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0432\u0432\u043e\u0434\u0430) \u0438 \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u0430 \u0438\u0433\u0440\u043e\u043a\u0430.<\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 Animator \u0442\u0430\u043a \u0436\u0435, \u043a\u0430\u043a \u0438 \u043d\u0430 Transform \u0438 Rigidbody &#8212; \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043d\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435 \u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435 Player \u0442\u0438\u043f\u0430 Animator \u0438 \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0432 init-\u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0438\u0433\u0440\u043e\u043a\u0430 \u0441\u0442\u0440\u043e\u0447\u043a\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442 \u0435\u0433\u043e.<\/p>\n<pre><code class=\"cs\">public struct Player {     public Transform playerTransform;     public Animator playerAnimator;     public Rigidbody playerRigidbody;     public float playerSpeed; }<\/code><\/pre>\n<pre><code class=\"cs\">player.playerAnimator = playerGO.GetComponent&lt;Animator>();<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0410\u043d\u0438\u043c\u0430\u0442\u043e\u0440\u0430:<\/p>\n<pre><code class=\"cs\">public class PlayerAnimationSystem : IEcsRunSystem {     private EcsFilter&lt;Player, PlayerInputData> filter;      public void Run()     {         foreach (var i in filter)         {             ref var player = ref filter.Get1(i);             ref var input = ref filter.Get2(i);                          float vertical = Vector3.Dot(input.moveInput.normalized, player.playerTransform.forward);             float horizontal = Vector3.Dot(input.moveInput.normalized, player.playerTransform.right);             player.playerAnimator.SetFloat(\"Horizontal\", horizontal, 0.1f, Time.deltaTime);             player.playerAnimator.SetFloat(\"Vertical\", vertical, 0.1f, Time.deltaTime);         }     } }<\/code><\/pre>\n<p>\u041e\u0442\u043b\u0438\u0447\u043d\u043e! \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0448 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436 \u0434\u0432\u0438\u0436\u0435\u0442\u0441\u044f, \u043f\u043e\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u043a\u0443\u0440\u0441\u043e\u0440\u0430 \u043c\u044b\u0448\u0438 \u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0434\u0432\u0438\u0433\u0430\u0435\u0442 \u043d\u043e\u0433\u0430\u043c\u0438 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f!<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a84\/e20\/4f6\/a84e204f672a6a75b0bf8be8eaf13c0c.gif\" width=\"1128\" height=\"634\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a84\/e20\/4f6\/a84e204f672a6a75b0bf8be8eaf13c0c.gif\"\/><\/figure>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u041c\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0430\u0441\u043f\u0435\u043a\u0442\u044b \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u043c LeoECS \u0438 \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u0431\u0430\u0437\u043e\u0432\u043e\u0435 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0430 \u0441 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044f\u043c\u0438. \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0447\u0430\u0441\u0442\u044f\u0445 \u043c\u044b \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u044b\u0435 \u043c\u0435\u0445\u0430\u043d\u0438\u043a\u0438 \u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u201c\u043c\u0438\u0440\u0430\u201d ECS \u0438 MonoBehaviour-\u043e\u0432.<\/p>\n<\/p>\n<p>\u0422\u0443\u0442\u043e\u0440\u0438\u0430\u043b \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d \u0432 \u0441\u043e\u0430\u0432\u0442\u043e\u0440\u0441\u0442\u0432\u0435 \u0441 \u0412\u043b\u0430\u0434\u0438\u043c\u0438\u0440\u043e\u043c \u0420\u043e\u0442\u0442\u0435\u0440\u0434\u0430\u043c\u0441\u043a\u0438\u043c  <\/p>\n<p>\u2192 <a href=\"https:\/\/assetstore.unity.com\/packages\/3d\/characters\/robots\/sci-fi-warrior-pbr-hp-polyart-106154\" rel=\"noopener noreferrer nofollow\">\u0410\u0441\u0441\u0435\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0434\u043b\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/a><\/p>\n<p>\u2192 <a href=\"https:\/\/github.com\/supremestranger\/shooter-leoecs\" rel=\"noopener noreferrer nofollow\">\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0441 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c<\/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\/573028\/\"> https:\/\/habr.com\/ru\/articles\/573028\/<\/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><em>\u0414\u0440\u0443\u0437\u044c\u044f, \u044d\u0442\u043e \u043f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0443 LeoECS \u0438\u0437 \u043f\u0440\u0435\u0434\u0441\u0442\u043e\u044f\u0449\u0435\u0439 \u0441\u0435\u0440\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0432\u0430\u043c \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u043f\u043e\u043d\u044f\u0442\u044c, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 LeoECS \u0432 Unity \u0438 \u0440\u0435\u0448\u0438\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u0438\u0434\u044b \u043f\u0440\u043e\u0431\u043b\u0435\u043c, \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0449\u0438\u0445 \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435. \u0412\u0441\u0435 \u0441\u043e\u0432\u0435\u0442\u044b, \u0438\u0437\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u0432 \u043d\u0438\u0445, \u043d\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0441\u043e\u0431\u043e\u044e \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0441\u0432\u043e\u0434 \u043f\u0440\u0430\u0432\u0438\u043b, \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432, \u0430 \u0441\u043a\u043e\u0440\u0435\u0435 \u043d\u0430\u0431\u043e\u0440 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0439 \u0438 best practices, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043c\u043e\u0433\u0443\u0442 \u0432\u0430\u043c \u043e\u0441\u0432\u043e\u0438\u0442\u044c\u0441\u044f \u0432 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u043c. \u041f\u0435\u0440\u0435\u0434 \u0447\u0442\u0435\u043d\u0438\u0435\u043c \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0432\u044b \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442\u0435 \u043f\u0440\u0438\u043d\u0446\u0438\u043f \u0440\u0430\u0431\u043e\u0442\u044b \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u043e\u0433\u043e \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430 <\/em><a href=\"https:\/\/habr.com\/ru\/post\/197920\/\" rel=\"noopener noreferrer nofollow\"><em>Entity Component System (ECS)<\/em><\/a><em>, \u0438 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u044c\u0442\u0435\u0441\u044c \u0441 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0435\u0439 LeoECS, \u0442\u0430\u043a \u043a\u0430\u043a \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0438\u0433\u0440\u0443 \u0436\u0430\u043d\u0440\u0430 Top-Down shooter, \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0447\u0430\u0441\u0442\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0449\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u0440\u0435\u0448\u0435\u043d\u0438\u044f, \u0438 \u043e\u0442\u0432\u043b\u0435\u043a\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0435\u0439 ECS, \u043d\u0435 \u0431\u0443\u0434\u0435\u043c.<br \/><\/em><a href=\"https:\/\/habr.com\/ru\/post\/578054\/\" rel=\"noopener noreferrer nofollow\"><em>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f<\/em><\/a><em> <\/em><a href=\"https:\/\/habr.com\/ru\/post\/578054\/\" rel=\"noopener noreferrer nofollow\"><em>\u0447\u0430\u0441\u0442\u044c<\/em><\/a><\/p>\n<figure class=\"full-width\"><\/figure>\n<p><a href=\"https:\/\/github.com\/Leopotam\/ecs\" rel=\"noopener noreferrer nofollow\">LeoECS <\/a>\u2013 \u044d\u0442\u043e \u043e\u0434\u043d\u0430 \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u0431\u044b\u0441\u0442\u0440\u044b\u0445, \u043b\u0435\u0433\u043a\u043e\u0432\u0435\u0441\u043d\u044b\u0445 \u0438 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430 Entity Component System \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 C# \u0441 \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0435\u0439 \u0441 Unity: <a href=\"https:\/\/github.com\/Leopotam\/ecs-unityintegration\" rel=\"noopener noreferrer nofollow\">\u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u0434\u0435\u0431\u0430\u0433\u0433\u0435\u0440<\/a>, \u044d\u043c\u0438\u0442\u0442\u0435\u0440\u044b \u0441\u043e\u0431\u044b\u0442\u0438\u0439 <a href=\"https:\/\/github.com\/supremestranger\/leoecs-physics\" rel=\"noopener noreferrer nofollow\">\u0444\u0438\u0437\u0438\u043a\u0438 <\/a>\u0438 <a href=\"https:\/\/github.com\/Leopotam\/ecs-ui\" rel=\"noopener noreferrer nofollow\">uGUI<\/a>, <a href=\"https:\/\/github.com\/voody2506\/UniLeo\" rel=\"noopener noreferrer nofollow\">\u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0435\u0440<\/a> \u0441\u0446\u0435\u043d\u044b \u0441 GameObject\u2019\u0430\u043c\u0438 \u0438 MonoBehaviour\u2019\u0430\u043c\u0438 \u0432 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0432 \u201c\u043c\u0438\u0440\u0435\u201d ECS. \u0424\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0443\u0436\u0435 \u0434\u043e\u043b\u0433\u043e\u0435 \u0432\u0440\u0435\u043c\u044f, \u043d\u0430 \u043d\u0435\u043c \u0432\u044b\u043f\u0443\u0449\u0435\u043d \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u043e\u0434\u0438\u043d \u043a\u043e\u043c\u043c\u0435\u0440\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u0440\u043e\u0435\u043a\u0442.<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0438 \u043d\u0430\u0447\u043d\u0435\u043c \u0441 \u0441\u0430\u043c\u043e\u0433\u043e \u0433\u043b\u0430\u0432\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u0432 \u0432\u0430\u0448\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u2013 EcsStartup. \u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 MonoBehaviour \u043a\u043b\u0430\u0441\u0441 \u0438 \u043f\u0440\u0438\u043a\u0440\u0435\u043f\u0438\u0442\u0435 \u0435\u0433\u043e \u043a \u043a\u0430\u043a\u043e\u043c\u0443-\u043d\u0438\u0431\u0443\u0434\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u0443 \u0432 \u0441\u0446\u0435\u043d\u0435 \u2013 \u043b\u0443\u0447\u0448\u0435 \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u043f\u043e\u0434 \u044d\u0442\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0443\u0441\u0442\u043e\u0439 GameObject. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0442\u043e\u0440 \u0441 Unity, \u0442\u043e\u0433\u0434\u0430 EcsStartup \u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043f\u0430\u043f\u043a\u0438 (Components, Systems, Services, UnityComponents) \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438.<\/p>\n<pre><code class=\"cs\">public class EcsStartup : MonoBehaviour {     private EcsWorld ecsWorld;     private EcsSystems systems;       private void Start()     {         ecsWorld = new EcsWorld(); \/\/ \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0439 EcsWorld         systems = new EcsSystems(ecsWorld); \/\/ \u0438 \u0433\u0440\u0443\u043f\u043f\u0443 \u0441\u0438\u0441\u0442\u0435\u043c \u0432 \u044d\u0442\u043e\u043c \u043c\u0438\u0440\u0435              systems             .Add(new PlayerInitSystem()) \/\/ \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u0435\u0440\u0432\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443             .Init(); \/\/ \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0433\u0440\u0443\u043f\u043f\u0443 \u0441\u0438\u0441\u0442\u0435\u043c     }       private void Update()     {         systems?.Run(); \/\/ \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043a\u0430\u0436\u0434\u044b\u0439 \u043a\u0430\u0434\u0440     }       private void OnDestroy()     {         systems?.Destroy(); \/\/ \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0430\u0435\u043c \u0433\u0440\u0443\u043f\u043f\u0443 \u0441\u0438\u0441\u0442\u0435\u043c \u043f\u0440\u0438 \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u0438\u0438 \u0441\u0442\u0430\u0440\u0442\u0430\u043f\u0430         systems = null;         ecsWorld?.Destroy() \/\/ \u0438 \u043c\u0438\u0440         ecsWorld = null;     } } <\/code><\/pre>\n<p>\u041e\u0442\u043b\u0438\u0447\u043d\u043e, \u043f\u0435\u0440\u0432\u044b\u0439 \u0448\u0430\u0433 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d! \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u0430\u0448 \u043f\u0435\u0440\u0432\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0438 \u043f\u0435\u0440\u0432\u0443\u044e Init-\u0441\u0438\u0441\u0442\u0435\u043c\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u0437\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u0438\u0433\u0440\u043e\u043a\u0430 \u0438 \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0435\u0439 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432.<\/p>\n<pre><code class=\"cs\">public struct Player \/\/ \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0438\u0433\u0440\u043e\u043a\u0430 {     public Rigidbody playerRigidbody; }<\/code><\/pre>\n<pre><code class=\"cs\">public class PlayerInitSystem : IEcsInitSystem {     private EcsWorld ecsWorld; \/\/ \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043c\u0438\u0440 \u0438\u043d\u0436\u0435\u043a\u0442\u0438\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438    public void Init()   {       EcsEntity playerEntity = ecsWorld.NewEntity();       \/\/ entity.Get \u2013 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0438\u043b\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u043e\u0432\u044b\u0439                  \/\/ \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u0434\u043b\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u0438 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0433\u0440\u043e\u043a\u0430       ref var player = ref playerEntity.Get&lt;Player>()         \/\/ \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438\u043d\u043f\u0443\u0442\u0430       ref var inputData = ref playerEntity.Get&lt;PlayerInputData>();                player.playerRigidbody = \/\/ \u0433\u0434\u0435 \u0436\u0435 \u0432\u0437\u044f\u0442\u044c Rigidbody \u0438\u0433\u0440\u043e\u043a\u0430?   } }<\/code><\/pre>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u043c\u044b \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0438\u0441\u044c \u0441 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439. \u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u043a\u0443\u0434\u0430-\u0442\u043e \u0432\u0437\u044f\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435, \u0447\u0442\u043e\u0431\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0438\u0445 \u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b ECS. \u041a\u0430\u043a \u0431\u044b\u0442\u044c? \u041f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u0432 \u0433\u043e\u043b\u043e\u0432\u0443 &#8212; \u043d\u0430\u0439\u0442\u0438 \u0438\u0433\u0440\u043e\u043a\u0430 \u043d\u0430 \u0441\u0446\u0435\u043d\u0435 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0442\u0435\u0433\u0430, \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0438\u043b\u0438 \u0434\u0430\u0436\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 MonoBehaviour, \u043d\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043a\u043e\u043f\u043d\u0435\u043c \u0433\u043b\u0443\u0431\u0436\u0435&#8230;<\/p>\n<h2>\u042d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445<\/h2>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0430\u0431\u0441\u0442\u0440\u0430\u0433\u0438\u0440\u0443\u0435\u043c\u0441\u044f \u043e\u0442 \u043d\u0430\u0448\u0435\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0438 \u043f\u043e\u0434\u0443\u043c\u0430\u0435\u043c \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043d\u0430\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432\u043d\u0435\u0448\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. \u0421\u0430\u043c\u044b\u0439 \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u2013 \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u0438\u0445 \u043d\u0430 \u0442\u0440\u0438 \u0442\u0438\u043f\u0430: Static Data, Scene Data \u0438 Runtime Data.<\/p>\n<p>Static Data \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0438\u0433\u0440\u044b \u2013 \u0437\u0434\u0435\u0441\u044c \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0435\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b. \u042d\u0442\u043e \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u043f\u0440\u0435\u0444\u0430\u0431\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0438\u043d\u0441\u0442\u0430\u043d\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0432 \u0440\u0430\u043d\u0442\u0430\u0439\u043c\u0435, \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u043a\u0430\u0440\u0442\u044b \u0438 \u043f\u0440\u043e\u0447\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b. \u041f\u0440\u043e\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0435\u0435 \u0447\u0435\u0440\u0435\u0437 ScriptableObject, \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 EcsStartup.<\/p>\n<p>Scene Data \u2013 \u044d\u0442\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0441\u0446\u0435\u043d\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430 \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u0446\u0435\u043d\u0430\u0445. \u0412 \u043d\u0435\u0439 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u043f\u0430\u0432\u043d \u043f\u043e\u0438\u043d\u0442 \u0438\u0433\u0440\u043e\u043a\u0430 \u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u044e\u043d\u0438\u0442\u043e\u0432, \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438, \u0438\u043d\u0434\u0438\u0432\u0438\u0434\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0446\u0435\u043d\u044b \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435. \u041f\u043e \u0441\u0443\u0442\u0438, \u044d\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u044b\u0439 MonoBehaviour \u043a\u043b\u0430\u0441\u0441, \u043f\u0440\u0438\u043a\u0440\u0435\u043f\u043b\u0435\u043d\u043d\u044b\u0439 \u043a Startup-\u043e\u0431\u044a\u0435\u043a\u0442\u0443, \u0430 \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043d\u0435\u0433\u043e, \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0441\u043e Static Data, \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 EcsStartup.<\/p>\n<p>Runtime Data \u2013 \u044d\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u044b\u0439 C# \u043a\u043b\u0430\u0441\u0441, \u043a\u0443\u0434\u0430 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043c\u0435\u0449\u0430\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445 \u00ab\u0437\u0434\u0435\u0441\u044c \u0438 \u0441\u0435\u0439\u0447\u0430\u0441\u00bb, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u044b \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0438\u0433\u0440\u044b. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043a\u0430\u0440\u0442\u0430 \u043a\u043b\u0435\u0442\u043e\u043a, \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043a\u0430\u043c\u0435\u0440\u0443, \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c \u0438\u0433\u0440\u043e\u043a\u0430 \u0438 \u043c\u043d\u043e\u0433\u043e\u0435 \u0434\u0440\u0443\u0433\u043e\u0435. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u0445, \u043d\u043e, \u0442\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u0435\u0441\u043b\u0438 \u0432\u044b \u0443\u0432\u0435\u0440\u0435\u043d\u044b, \u0447\u0442\u043e \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0432 \u0441\u0432\u043e\u0435\u043c \u0440\u043e\u0434\u0435, \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u0432 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0447\u0430\u0441\u0442\u044f\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u044e, \u0434\u0430\u0436\u0435 \u0447\u0442\u043e-\u0442\u043e \u0432\u0440\u043e\u0434\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u0430, \u0432\u0430\u043c \u0431\u0443\u0434\u0435\u0442 \u0443\u0434\u043e\u0431\u043d\u0435\u0435 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0435\u0433\u043e \u0432 \u044d\u0442\u043e\u0442 \u0432\u0438\u0434 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>\u041a\u0430\u043a \u0436\u0435 \u043d\u0430\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a\u043e \u0432\u0441\u0435\u043c \u044d\u0442\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u043c \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445? \u0428\u0442\u0430\u0442\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f data injection \u0432 LeoECS \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u043c \u0432 \u043e\u0434\u043d\u0443 \u0441\u0442\u0440\u043e\u043a\u0443 \u0432\u043d\u0435\u0434\u0440\u0438\u0442\u044c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0430\u0441\u0441\u0430 \u0432 \u0433\u0440\u0443\u043f\u043f\u0443 \u0441\u0438\u0441\u0442\u0435\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0440\u0435\u0444\u043b\u0435\u043a\u0441\u0438\u0438. \u0427\u0442\u043e\u0431\u044b \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u043d\u043e\u043c\u0443 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0443, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u043e\u043b\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u0442\u0438\u043f\u0430 \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b.<\/p>\n<h2>\u0412\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u043a LeoECS<\/h2>\n<pre><code class=\"cs\">public class EcsStartup : MonoBehaviour {     \/\/ \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 StaticData \u0438 SceneData, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u0432\u0435\u0441\u0438\u0442\u044c \u0432 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0435     \/\/ \u0447\u0435\u0440\u0435\u0437 \u0438\u043d\u0441\u043f\u0435\u043a\u0442\u043e\u0440     public StaticData configuration;     public SceneData sceneData;     private EcsWorld ecsWorld;     private EcsSystems systems;    private void Start()     {       ecsWorld = new EcsWorld();       systems = new EcsSystems(ecsWorld);         \/\/ \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 RuntimeData.       RuntimeData runtimeData = new RuntimeData();        systems           .Add(new PlayerInitSystem())           \/\/ \u0438\u043d\u0436\u0435\u043a\u0442\u0438\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435           .Inject(configuration)           .Inject(sceneData)           .Inject(runtimeData)           .Init();     }     private void Update()   {       systems?.Run();   }    private void OnDestroy()   {         systems?.Destroy();         systems = null;         ecsWorld?.Destroy();         ecsWorld = null;   } }<\/code><\/pre>\n<pre><code class=\"cs\">[CreateAssetMenu] public class StaticData : ScriptableObject {     public GameObject playerPrefab; }<\/code><\/pre>\n<pre><code class=\"cs\">public class SceneData : MonoBehaviour {     public Transform playerSpawnPoint; }<\/code><\/pre>\n<pre><code class=\"cs\">public class RuntimeData { } <\/code><\/pre>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u043a PlayerInitSystem \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0432\u043b\u043e\u0436\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0433\u0440\u043e\u043a\u0430 \u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b ECS.<\/p>\n<pre><code class=\"cs\">public class PlayerInitSystem : IEcsInitSystem {     private EcsWorld ecsWorld;   private StaticData staticData; \/\/ \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 StaticData \u0438 SceneData   private SceneData sceneData;    public void Init()   {         EcsEntity playerEntity = ecsWorld.NewEntity();        ref var player = ref playerEntity.Get&lt;Player>();       ref var inputData = ref playerEntity.Get&lt;PlayerInputData>();                  \/\/ \u0421\u043f\u0430\u0432\u043d\u0438\u043c GameObject \u0438\u0433\u0440\u043e\u043a\u0430         GameObject playerGO = Object.Instantiate(staticData.playerPrefab, sceneData.playerSpawnPoint.position, Quaternion.identity);       player.playerRigidbody = playerGO.GetComponent&lt;Rigidbody>();   } }<\/code><\/pre>\n<p>\u041d\u0430\u0441\u0442\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u043f\u0435\u0440\u0435\u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u0438\u0433\u0440\u043e\u043a\u0430. \u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e\u043c \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432. \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432 \u043e\u0434\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u043b\u043e\u0432\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0431 \u0438\u043d\u043f\u0443\u0442\u0435, \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0438\u0445 \u0432 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 PlayerInputData, \u0430 \u0432 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0434\u0432\u0438\u0433\u0430\u0442\u044c \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0430 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430.<\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u043b\u0435 \u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 PlayerInputData:<\/p>\n<pre><code class=\"cs\">public struct PlayerInputData {     public Vector3 moveInput; }<\/code><\/pre>\n<p>\u0418 \u0441\u043e\u0437\u0434\u0430\u0442\u044c Run-\u0441\u0438\u0441\u0442\u0435\u043c\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043a\u0430\u0436\u0434\u044b\u0439 \u043a\u0430\u0434\u0440 \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430. \u041d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0435\u0435 \u0432 \u0433\u0440\u0443\u043f\u043f\u0443 \u0441\u0438\u0441\u0442\u0435\u043c \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 EcsStartup.<\/p>\n<pre><code class=\"cs\">public class PlayerInputSystem : IEcsRunSystem {     private EcsFilter&lt;PlayerInputData> filter; \/\/ \u0444\u0438\u043b\u044c\u0442\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0434\u0430\u0441\u0442 \u043d\u0430\u043c \u0432\u0441\u0435 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438, \u0443 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0435\u0441\u0442\u044c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 PlayerInputData        public void Run()     {         foreach (var i in filter)         {             \/\/ \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430. \u0412\u0430\u0436\u0435\u043d \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u043a\u043e\u043d\u0441\u0442\u0440\u0435\u0439\u043d\u0442\u043e\u0432 \u0444\u0438\u043b\u044c\u0442\u0440\u0430 - \u0446\u0438\u0444\u0440\u0430 \u043f\u043e\u0441\u043b\u0435 Get \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u043e\u043c\u0435\u0440 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043e\u043d \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442             ref var input = ref filter.Get1(i)             \/\/ \u0412\u044b\u0437\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 filter.Get2(i) \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f.             \/\/ \u041f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u0432 \u0444\u0438\u043b\u044c\u0442\u0440\u0435 \u0432\u044b \u043c\u0435\u043d\u044f\u0435\u0442\u0435 \u0435\u0433\u043e \u043a\u043b\u0430\u0441\u0441, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0443 \u0444\u0438\u043b\u044c\u0442\u0440\u0430 \u0441 1 \u043a\u043e\u043d\u0441\u0442\u0440\u0435\u0439\u043d\u0442\u043e\u043c \u043d\u0435\u0442 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 Get2(), Get3(), etc.                        input.moveInput = new Vector3(Input.GetAxisRaw(\"Horizontal\"), 0f, Input.GetAxisRaw(\"Vertical\")); \/\/ \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435         }     } }<\/code><\/pre>\n<p>\u0421\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0432 \u0441\u0442\u0430\u0440\u0442\u0430\u043f\u0435 \u0434\u043e\u043b\u0436\u043d\u0430 \u0438\u0434\u0442\u0438 \u0434\u0440\u0443\u0433\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u0432\u0438\u0433\u0430\u0435\u0442 \u0438\u0433\u0440\u043e\u043a\u0430.<\/p>\n<p>\u041a\u0430\u043a \u043e\u043f\u044b\u0442\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 Unity, \u043c\u044b \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u043f\u0440\u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0438 \u0441 \u0444\u0438\u0437\u0438\u043a\u043e\u0439, \u043d\u0430\u043c \u043b\u0443\u0447\u0448\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0446\u0438\u043a\u043b FixedUpdate \u0441 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u0442\u0438\u043a\u0440\u0435\u0439\u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043a\u0430\u043a\u0438\u0445-\u043b\u0438\u0431\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0441 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f\u043c\u0438. \u041d\u043e \u0443 \u043d\u0430\u0441 \u043b\u0438\u0448\u044c \u043e\u0434\u043d\u0430 \u0433\u0440\u0443\u043f\u043f\u0430 \u0441\u0438\u0441\u0442\u0435\u043c \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u043e\u043d\u0430 \u0432 \u0446\u0438\u043a\u043b\u0435 Update. \u0412\u044b\u0445\u043e\u0434 \u043e\u0447\u0435\u0432\u0438\u0434\u0435\u043d \u2013 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u0433\u0440\u0443\u043f\u043f\u0443 \u0441\u0438\u0441\u0442\u0435\u043c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0432 FixedUpdate().<\/p>\n<p>\u041a\u0441\u0442\u0430\u0442\u0438, \u043d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 Rigidbody \u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0438 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0434\u0432\u0438\u0433\u0430\u0442\u044c\u0441\u044f.<\/p>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c, \u043a\u0430\u043a \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043f\u043e\u043b\u0435 \u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435 \u0438\u0433\u0440\u043e\u043a\u0430, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0435\u0435 \u0437\u0430 \u0435\u0433\u043e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"cs\">public struct Player {     public Rigidbody playerRigidbody;     public float playerSpeed; }<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u0437\u044f\u0442\u044c \u044d\u0442\u043e\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0438\u0437 \u043d\u0430\u0448\u0435\u0433\u043e ScriptableObject &#8212; StaticData. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u043c \u0432 \u044d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441 \u043f\u043e\u043b\u0435 playerSpeed \u0438 \u0437\u0430\u0434\u0430\u0434\u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0432 \u0430\u0441\u0441\u0435\u0442\u0435:<\/p>\n<pre><code class=\"cs\">[CreateAssetMenu] public class StaticData : ScriptableObject {     public GameObject playerPrefab;     public float playerSpeed; }<\/code><\/pre>\n<p>\u0412 PlayerInitSystem \u043c\u044b \u0432\u043e\u0437\u044c\u043c\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0437 Static Data \u0438 \u043f\u043e\u043b\u043e\u0436\u0438\u043c \u0435\u0433\u043e \u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0438\u0433\u0440\u043e\u043a\u0430:<\/p>\n<pre><code class=\"cs\">player.playerSpeed = staticData.playerSpeed;<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u043e\u0432\u0443\u044e \u0433\u0440\u0443\u043f\u043f\u0443 \u0441\u0438\u0441\u0442\u0435\u043c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c\u0441\u044f \u0432 FixedUpdate:<\/p>\n<pre><code class=\"cs\">public class EcsStartup : MonoBehaviour {     public StaticData<\/code><\/pre>\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-417634","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/417634","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=417634"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/417634\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=417634"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=417634"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=417634"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}