{"id":352591,"date":"2024-05-20T22:11:35","date_gmt":"2024-05-20T22:11:35","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=352591"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2024-05-20T22:11:35","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=352591","title":{"rendered":"<span>UI Router \u0432 Unity + CustomEditor<\/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<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/a16\/fc4\/b41\/a16fc4b414cdb3b55df855db340fecee.png\" alt=\"(\u041d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0435\u0439 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0440\u043e\u0443\u0442\u0435\u0440\u0430)\" title=\"(\u041d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0435\u0439 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0440\u043e\u0443\u0442\u0435\u0440\u0430)\" width=\"724\" height=\"483\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a16\/fc4\/b41\/a16fc4b414cdb3b55df855db340fecee.png\"\/><\/p>\n<div><figcaption>(\u041d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0435\u0439 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0440\u043e\u0443\u0442\u0435\u0440\u0430)<\/figcaption><\/div>\n<\/figure>\n<h2>\u0414\u0438\u0441\u043a\u043b\u0435\u0439\u043c\u0435\u0440<\/h2>\n<p>\u041c\u043e\u0439 \u0440\u043e\u0443\u0442\u0435\u0440 \u0438\u0434\u0435\u0439\u043d\u043e \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u0442 \u0440\u043e\u0443\u0442\u0435\u0440 <a href=\"https:\/\/habr.com\/ru\/articles\/711524\/\" rel=\"noopener noreferrer nofollow\">\u0438\u0437 \u0441\u0442\u0430\u0442\u044c\u0438<\/a>, \u043e\u0434\u043d\u0430\u043a\u043e \u0434\u0430\u043d\u043d\u0430\u044f \u0442\u0430\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u043c\u043d\u0435 \u043d\u0435 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0438 \u043d\u0435 \u0443\u0434\u043e\u0431\u043d\u043e\u0439 \u0432 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438. \u042f \u043e\u043f\u0438\u0448\u0443 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441\u0432\u043e\u0435\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 + CustomEditor, \u0431\u0435\u0437 \u0430\u0442\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u0438 SendMessage.<\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u044f \u0431\u0443\u0434\u0443 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043a\u0443\u0441\u043a\u0438 \u043a\u043e\u0434\u0430, \u0430 \u0437\u0430\u0442\u0435\u043c \u0432 \u0441\u043f\u043e\u0439\u043b\u0435\u0440\u0435 \u043f\u043e\u043b\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438, \u0447\u0442\u043e\u0431\u044b \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043d\u0435 \u0440\u0430\u0441\u0442\u044f\u0433\u0438\u0432\u0430\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u044e.<\/p>\n<hr\/>\n<h2>\u041a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u044f<\/h2>\n<p>\u0417\u0430\u0447\u0430\u0441\u0442\u0443\u044e, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u044e \u0441\u043b\u043e\u0432\u0430\u0440\u0435\u0439, \u0435\u043d\u0430\u043c\u043e\u0432, \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430, \u0447\u0442\u043e\u0431\u044b \u0433\u0440\u0430\u043c\u043e\u0442\u043d\u043e \u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 \u0442\u0435\u043c \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442. \u041e\u0434\u043d\u0430\u043a\u043e, \u0438\u043d\u043e\u0433\u0434\u0430 \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u0440\u0435\u0447\u0438\u0442\u044c \u0438\u0434\u0435\u043e\u043b\u043e\u0433\u0438\u0438, \u0447\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u043b\u0438\u0448\u044c \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435, \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u044f \u0435\u0433\u043e.<\/p>\n<p>\u0414\u043b\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u0438\u043c\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043e\u043f\u044b\u0442 \u0438\u0437 \u0432\u0435\u0431 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438:<\/p>\n<ol>\n<li>\n<p>\u0412\u0441\u0435 \u044d\u043a\u0440\u0430\u043d\u044b \u0438\u043c\u0435\u044e\u0442 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 url.<\/p>\n<\/li>\n<li>\n<p>\u0412\u0441\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u0432 \u0432\u0438\u0434\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043a\u0430\u043a \u0447\u0430\u0441\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0438.<\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u043c\u0430\u043d\u0434\u044b \u043e\u043a\u043d\u0430\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0445\u0440\u0430\u043d\u0438\u0442 \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u043e\u043a\u043e\u043d \u0432 \u0441\u0442\u044d\u043a\u0435 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0443.<\/p>\n<\/li>\n<\/ol>\n<p>\u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0438\u043c\u0435\u0435\u043c:<\/p>\n<ul>\n<li>\n<p>\u042d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0440\u043d\u0443\u044e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 back. \u0412 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0435\u0433\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u043b\u043e\u0441\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u0441\u0441\u044b\u043b\u043a\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u043c back, \u0442\u043e \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043d\u043e\u0432\u0430 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u044d\u043a\u0440\u0430\u043d, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u043b\u0438 \u0434\u043e \u044d\u0442\u043e\u0433\u043e \u0441 \u0442\u0435\u043c\u0438 \u0436\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0442\u043e\u0442 \u0436\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.<\/p>\n<\/li>\n<li>\n<p>\u0418\u0437\u0431\u0435\u0433\u0430\u0435\u043c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u043c\u0435\u0436\u0434\u0443 \u043e\u043a\u043d\u0430\u043c\u0438.<\/p>\n<\/li>\n<\/ul>\n<h2>\u041f\u0438\u0448\u0435\u043c \u0440\u043e\u0443\u0442\u0435\u0440<\/h2>\n<p>\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0441\u0442\u044d\u043a \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0446, \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 \u0441\u0442\u0440\u0430\u043d\u0438\u0446, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u0443\u0442\u044c \u0434\u043e \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0438 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430:<\/p>\n<pre><code class=\"cs\">public static class UIRouter {     private static Stack&lt;string> _screensStack = new Stack&lt;string>();     private static Dictionary&lt;string, IUIPage> _routesPageData = new Dictionary&lt;string, IUIPage>();     private static string _mainScreenRoute = string.Empty;      #region const     \/\/ \u0427\u0442\u043e\u0431\u044b \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 url \u0431\u044b\u043b \u0435\u0434\u0438\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u044b\u043c, \u044f\u0432\u043d\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0435\u0433\u043e \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b     \/\/ \u041f\u0440\u0438\u043c\u0435\u0440 \u0441\u0441\u044b\u043b\u043a\u0438:     \/\/ canvas.Name + slash + gameObj1.Name + separator + key + equally + value + and + key2 + equally + value2 = \"Canvas\/Name1?key=value&amp;key2=value2\"     public const string slash = \"\/\";     public const string separator = \"?\";     public const string and = \"&amp;\";     public const string equally = \"=\";     #endregion      \/\/ \u0427\u0442\u043e\u0431\u044b \u043d\u0435 \u0432\u044b\u0431\u0440\u0430\u0441\u043e\u0432\u0430\u043b\u043e NullReferenceException, \u043f\u0435\u0440\u0432\u044b\u043c \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435\u043c \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043f\u043e\u043b\u044f.     public static void ForceCreate()     {         if (_routesPageData == null || _screensStack == null)         {             _routesPageData = new Dictionary&lt;string, IUIPage>();             _screensStack = new Stack&lt;string>();             _mainScreenRoute = string.Empty;         }             } }<\/code><\/pre>\n<p>\u0412\u0441\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043e\u0431\u043b\u0430\u0434\u0430\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u044b\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u043e\u043c \u0434\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0433\u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u0440\u043e\u0443\u0442\u0435\u0440\u043e\u043c (\u0438 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u043e\u043c \u043a\u0430\u043d\u0432\u0430\u0441\u0430 \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c). \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441:<\/p>\n<pre><code class=\"cs\">public interface IUIPage {     public string url { get; }     public void CreateURL(string url, bool shouldUpdatePropertiesValues);      public void Show(Dictionary&lt;string, string> data);     public string Hide();          public void Subscribe();     public void Unsubscribe();      public void FindAndDefineChildsProperties(); }<\/code><\/pre>\n<p>\u0427\u0442\u043e\u0431\u044b \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0435 \u0432 \u0432\u0438\u0434\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0432 url, \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 <code>UIRouter<\/code> \u043f\u0438\u0448\u0435\u043c \u043f\u0430\u0440\u0441\u0435\u0440:<\/p>\n<pre><code class=\"cs\">private static Dictionary&lt;string, string> ParseParams(string fullRoute, out string route) {     string routeEnd = \"\";     if (fullRoute.Contains(slash))     {         routeEnd = fullRoute.Split(slash)[^1];     }     else     {         routeEnd = fullRoute;     }     var result = new Dictionary&lt;string, string>();     var routeParams = routeEnd.Split(separator);     if (routeParams.Length > 1)     {         var parameters = routeParams[1].Split(and);         if (parameters.Length > 0)         {             foreach (var param in parameters)             {                 var data = param.Split(equally);                 if (data.Length > 1)                 {                     result[data[0]] = data[1];                 }             }         }         route = fullRoute.Split(separator)[0];     }     else     {         route = fullRoute;     }     return result; }<\/code><\/pre>\n<p>\u041e\u043d \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0435\u0442 \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0434\u0432\u0435 \u0447\u0430\u0441\u0442\u0438: \u0430\u0434\u0440\u0435\u0441\u0441 \u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 <code>separator<\/code>. \u0421\u0430\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043e\u0442\u0434\u0435\u043b\u044f\u044e\u0442 \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430 \u043f\u043e \u0437\u043d\u0430\u043a\u0443 <code>and<\/code>, \u0430 \u043a\u043b\u044e\u0447\u0438 \u043e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043f\u043e \u0437\u043d\u0430\u043a\u0443 <code>equally<\/code>. \u041f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0438\u0439\u0441\u044f \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0438\u0437 \u043a\u043b\u044e\u0447\u0435\u0439 \u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043f\u043e\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0447\u0435\u0440\u0435\u0437 <code>return<\/code>, \u0430 \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u043a\u043b\u0430\u0434\u0451\u0442 \u0447\u0430\u0441\u0442\u044c url \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0443\u044e \u0437\u0430 \u0430\u0434\u0440\u0435\u0441.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c &#171;\u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c&#187; \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u043f\u043e \u0438\u0445 \u0430\u0434\u0440\u0435\u0441\u0441\u0443 \u0432 url, \u043d\u0435 \u0431\u043e\u044f\u0441\u044c \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0430\u0434\u0440\u0435\u0441\u0441 \u0441 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438.<\/p>\n<pre><code class=\"cs\">public static void SubscribePath(string path, IUIPage page) {     ParseParams(path, out path);     if (!_routesPageData.ContainsKey(path))     {         _routesPageData.Add(path, page);     } } public static void UnsubscribePath(string path) {     ParseParams(path, out path);     if (_routesPageData.ContainsKey(path))     {         _routesPageData.Remove(path);     } } public static void SetMainScreenRoute(string route, bool forceAdd=false) {     if (_mainScreenRoute == \"\" || forceAdd)     {         _mainScreenRoute = route;         if (_screensStack.Count == 0)         {             _screensStack.Push(route);         }     } }<\/code><\/pre>\n<p>\u041c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f \u0438 \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446:<\/p>\n<pre><code class=\"cs\">public static void OpenPageUrl(string route) {     if (_screensStack.Count > 0)     {         string url = _screensStack.Peek();         if (url.Contains(separator))         {             url = url.Split(separator)[0];         }         _screensStack.Push(_routesPageData[url].Hide());     }     _screensStack.Push(route);          var payload = ParseParams(route, out route);     if (_routesPageData.ContainsKey(route))     {         var page = _routesPageData[route];         page.Show(payload);     }     else     {         Debug.LogError($\"There no route with name: {route}\");     } } public static void ReleaseLastPage() {     if (_screensStack.Count > 0)     {         _screensStack.Pop();         if (_screensStack.Count >= 1)         {             string route = _screensStack.Peek();             OpenPageUrl(route, true);         }         else         {             if (_mainScreenRoute != null) OpenPageUrl(_mainScreenRoute, true);         }     } }<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 \u0440\u043e\u0443\u0442\u0435\u0440\u0430:<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cs\">public static class UIRouter {     private static Stack&lt;string> _screensStack = new Stack&lt;string>();     private static Dictionary&lt;string, IUIPage> _routesPageData = new Dictionary&lt;string, IUIPage>();     private static string _mainScreenRoute = string.Empty;      #region const     \/\/ \u0427\u0442\u043e\u0431\u044b \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 url \u0431\u044b\u043b \u0435\u0434\u0438\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u044b\u043c, \u044f\u0432\u043d\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0435\u0433\u043e \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b     \/\/ \u041f\u0440\u0438\u043c\u0435\u0440 \u0441\u0441\u044b\u043b\u043a\u0438:     \/\/ canvas.Name + slash + gameObj1.Name + separator + key + equally + value + and + key2 + equally + value2 = \"Canvas\/Name1?key=value&amp;key2=value2\"     public const string slash = \"\/\";     public const string separator = \"?\";     public const string and = \"&amp;\";     public const string equally = \"=\";     #endregion      \/\/ \u0427\u0442\u043e\u0431\u044b \u043d\u0435 \u0432\u044b\u0431\u0440\u0430\u0441\u043e\u0432\u0430\u043b\u043e NullReferenceException \u043f\u0435\u0440\u0432\u044b\u043c \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435\u043c \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043f\u043e\u043b\u044f.     public static void ForceCreate()     {         if (_routesPageData == null || _screensStack == null)         {             _routesPageData = new Dictionary&lt;string, IUIPage>();             _screensStack = new Stack&lt;string>();             _mainScreenRoute = string.Empty;         }             }      public static void SubscribePath(string path, IUIPage page)     {         ParseParams(path, out path);         if (!_routesPageData.ContainsKey(path))         {             _routesPageData.Add(path, page);         }     }      public static void UnsubscribePath(string path)     {         ParseParams(path, out path);         if (_routesPageData.ContainsKey(path))         {             _routesPageData.Remove(path);         }     }      public static void SetMainScreenRoute(string route, bool forceAdd = false)     {         if (_mainScreenRoute == \"\" || forceAdd)         {             _mainScreenRoute = route;             if (_screensStack.Count == 0)             {                 _screensStack.Push(route);             }         }     }      public static void OpenPageUrl(string route)     {         if (_screensStack.Count > 0)         {             string url = _screensStack.Peek();             if (url.Contains(separator))             {                 url = url.Split(separator)[0];             }             _screensStack.Push(_routesPageData[url].Hide());         }         _screensStack.Push(route);                  var payload = ParseParams(route, out route);         if (_routesPageData.ContainsKey(route))         {             var page = _routesPageData[route];             page.Show(payload);         }         else         {             Debug.LogError($\"There no route with name: {route}\");         }     }      public static void ReleaseLastPage()     {         if (_screensStack.Count > 0)         {             _screensStack.Pop();             if (_screensStack.Count >= 1)             {                 string route = _screensStack.Peek();                 OpenPageUrl(route);             }             else             {                 if (_mainScreenRoute != null) OpenPageUrl(_mainScreenRoute);             }         }               public static bool CheckNameForURL(string name)     {         if (name.Contains(slash) || name.Contains(separator) || name.Contains(and) || name.Contains(equally))         {             Debug.LogError(\"Name must not include url syntacis chars! Error with name \" + name);             return false;         }         return true;     }      private static Dictionary&lt;string, string> ParseParams(string fullRoute, out string route)     {         string routeEnd = \"\";         if (fullRoute.Contains(slash))         {             routeEnd = fullRoute.Split(slash)[^1];         }         else         {             routeEnd = fullRoute;         }         var result = new Dictionary&lt;string, string>();         var routeParams = routeEnd.Split(separator);         if (routeParams.Length > 1)         {             var parameters = routeParams[1].Split(and);             if (parameters.Length > 0)             {                 foreach (var param in parameters)                 {                     var data = param.Split(equally);                     if (data.Length > 1)                     {                         result[data[0]] = data[1];                     }                 }             }             route = fullRoute.Split(separator)[0];         }         else         {             route = fullRoute;         }         return result;     }  }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h2>\u0418\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 IUIPages<\/h2>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u0439\u0434\u0451\u043c \u043a \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 <code>IUIPages<\/code> \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0441 \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u0442\u0435\u043a\u0441\u0442\u043e\u0432 <code>TextMeshPro<\/code>:<\/p>\n<pre><code class=\"cs\">public class PageWithTextController : MonoBehaviour, IUIPage {     #region Serialized Fields     [SerializeField] private string url_ = \"\";     [SerializeField] private List&lt;TMP_Text> _Texts = new List&lt;TMP_Text>();     [SerializeField] private Dictionary&lt;string, string> params_ = new Dictionary&lt;string, string>();      [SerializeField] public bool shouldWriteRuntimeChanges = true;     #endregion      #region Properties     public string url      {         get          {             CreateURL(url_);             return url_;          }      }     public Dictionary&lt;string, string> parametrs { get { return params_; } }     #endregion      #region Unity method     private void OnDestroy()     {         Unsubscribe();     }     #endregion      #region interface IUIPage implementation     public void CreateURL(string url__)     {         if (url__.Contains(UIRouter.separator))         {             url__ = url__.Split(UIRouter.separator)[0];         }         if (shouldWriteRuntimeChanges || params_.Count == 0) { FindAndDefineChildsProperties(); }         System.Text.StringBuilder builder = new System.Text.StringBuilder();         builder.Append(url__);         builder.Append(DictToString(params_));         url_ = builder.ToString();     }       public void Show(Dictionary&lt;string, string> data)     {         gameObject.SetActive(true);         TryAssignProperties(data);     }      public string Hide()     {         CreateURL(url_);         gameObject.SetActive(false);         return url_;     }      public void Subscribe()     {         UIRouter.SubscribePath(url_, this);     }     public void Unsubscribe()     {         UIRouter.UnsubscribePath(url_);     }     public virtual void FindAndDefineChildsProperties()     {         FindAndSubscribeChildsText();     }     #endregion }<\/code><\/pre>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430, \u043c\u044b \u0442\u0430\u043a\u0436\u0435 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u043f\u043e\u043b\u044f \u0438 \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0438\u0445 \u0432 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0435 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u043e\u0433\u043e \u0438\u043d\u0441\u043f\u0435\u043a\u0442\u043e\u0440\u0430.<\/p>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e\u043f\u0438\u0448\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0443 <code>CreateURL<\/code>: \u0431\u0435\u0440\u0451\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0430\u0434\u0440\u0435\u0441 \u0438\u0437 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u043e\u0433\u043e <code>url__<\/code>,  <code>shouldWriteRuntimeChanges<\/code> \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u0442\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0443 url \u0441\u043e\u0431\u0438\u0440\u0430\u043b\u0438\u0441\u044c \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, <code>DictToString<\/code> \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0432 \u0433\u043e\u0442\u043e\u0432\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 url \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c\u0443 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0443.<\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <code>StringBuilder<\/code>, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c\u0438 \u0441\u0442\u0440\u043e\u043a\u0430\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043d\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u043b\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0441 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e.<\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u043e\u043b\u043d\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 PageWithTextController:<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cs\">using System.Collections.Generic; using UnityEngine; using TMPro; using UnityEditor;  public class PageWithTextController : MonoBehaviour, IUIPage {     #region Serialized Fields     [SerializeField] private string url_ = \"\";     [SerializeField] private List&lt;TMP_Text> _Texts = new List&lt;TMP_Text>();     [SerializeField] private Dictionary&lt;string, string> params_ = new Dictionary&lt;string, string>();      [SerializeField] public bool shouldWriteRuntimeChanges = true;     #endregion      #region Properties     public string url      {         get          {             CreateURL(url_);             return url_;          }      }     public Dictionary&lt;string, string> parametrs { get { return params_; } }     #endregion      #region Unity method     private void OnDestroy()     {         Unsubscribe();     }     #endregion      #region interface IUIPage implementation     public void CreateURL(string url__)     {         if (url__.Contains(UIRouter.separator))         {             url__ = url__.Split(UIRouter.separator)[0];         }         if (shouldWriteRuntimeChanges || params_.Count == 0) { FindAndDefineChildsProperties(); }         System.Text.StringBuilder builder = new System.Text.StringBuilder();         builder.Append(url__);         builder.Append(DictToString(params_));         url_ = builder.ToString();     }       public void Show(Dictionary&lt;string, string> data)     {         gameObject.SetActive(true);         TryAssignProperties(data);     }      public string Hide()     {         CreateURL(url_);         gameObject.SetActive(false);         return url_;     }      public void Subscribe()     {         UIRouter.SubscribePath(url_, this);     }     public void Unsubscribe()     {         UIRouter.UnsubscribePath(url_);     }     #endregion      \/\/\/ &lt;summary>     \/\/\/ Useful when you need to enable page through button     \/\/\/ &lt;\/summary>     public void ForceShow() { UIRouter.OpenPageUrl(url_); }       public virtual void FindAndDefineChildsProperties()     {         FindAndSubscribeChildsText();     }      #region private methods      protected void FindAndSubscribeChildsText()     {         _Texts = TextChildsCheck(gameObject);         InitTextParametrs();     }      protected List&lt;TMP_Text> TextChildsCheck(GameObject game)     {         if (UIRouter.CheckNameForURL(game.name))         {             List&lt;TMP_Text> textList = new List&lt;TMP_Text>(game.transform.childCount);             List&lt;GameObject> childs = GetAllChilds(game);             foreach (GameObject child in childs)             {                 TMP_Text tryText = null;                 if (child.TryGetComponent(out tryText))                 {                     if (!textList.Contains(tryText) &amp;&amp; UIRouter.CheckNameForURL(child.name))                     {                         textList.Add(tryText);                     }                     else                     {                         Debug.LogError(string.Format(\"All child object of IUIPage must have unique names! Not a unique name {}\", child.name));                     }                 }                 var childRes = TextChildsCheck(child);                 if (childRes != null)                 {                     textList.AddRange(childRes);                 }             }             return textList;         }         return null;     }      protected void InitTextParametrs()     {         Dictionary&lt;string, string> _params2 = new Dictionary&lt;string, string>();         foreach (TMP_Text tMP_ in _Texts)         {             if (tMP_ != null)             {                 _params2.Add(tMP_.name, tMP_.text);             }         }         params_ = _params2;     }      protected string DictToString(Dictionary&lt;string, string> dict)     {         bool first = true;         System.Text.StringBuilder builder = new System.Text.StringBuilder();         foreach (string key in dict.Keys)         {             if (dict[key] != null)             {                 if (first)                 {                     first = false;                     builder.AppendFormat(string.Format(\"{0}{1}{2}{3}\", UIRouter.separator, key, UIRouter.equally, dict[key]));                 }                 else                 {                     builder.AppendFormat(string.Format(\"{0}{1}{2}{3}\", UIRouter.and, key, UIRouter.equally, dict[key]));                 }             }         }         return builder.ToString();     }      protected virtual void TryAssignProperties(Dictionary&lt;string, string> data)     {         foreach (TMP_Text text in _Texts)         {             string newText = text.text;             if (data.TryGetValue(text.name, out newText))             {                 text.text = newText;                 if (GUI.changed)                 {                     EditorUtility.SetDirty(text);                 }             }         }     }     protected virtual void TryAssignProperties(string key, string value)     {         foreach (TMP_Text text in _Texts)         {             if (text.name == key)             {                 string newText = string.Empty;                 if (params_.TryGetValue(text.name, out newText))                 {                     text.text = newText;                     if (GUI.changed)                     {                         EditorUtility.SetDirty(text);                     }                 }                 return;             }         }     }      protected List&lt;GameObject> GetAllChilds(GameObject game)     {         int children = game.transform.childCount;         List&lt;GameObject> childs = new List&lt;GameObject>();         for (int i = 0; i &lt; children; ++i)         {             childs.Add(game.transform.GetChild(i).gameObject);         }         return childs;     }     #endregion } <\/code><\/pre>\n<p>\u041c\u043d\u043e\u0433\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0443\u043a\u0430\u0437\u0430\u043d\u044b \u0441 \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430\u043c\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 <code>protected<\/code> \u0438 <code>virtual<\/code>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u043c\u043e\u0436\u043d\u043e \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u044d\u0442\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0446\u0432\u0435\u0442 \u0441\u043f\u0440\u0430\u0439\u0442\u0430\u043c.<\/p>\n<\/div>\n<\/details>\n<h2>CanvasManager<\/h2>\n<p>\u0412 \u043c\u043e\u0435\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0430\u0434\u0440\u0435\u0441 \u0432 url \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u0438 \u0438\u043c\u0435\u043d\u0435\u043c UI \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u043a\u0430\u043d\u0432\u0430\u0441\u0430. <\/p>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u043b\u044e\u0441\u0430:<\/p>\n<ul>\n<li>\n<p>\u0432\u0441\u0435 \u0430\u0434\u0440\u0435\u0441\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0442\u0441\u043b\u0435\u0434\u0438\u0442\u044c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0434\u043b\u044f \u0434\u0435\u0431\u0430\u0433\u0430.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043c\u0438\u043d\u0443\u0441\u043e\u0432:<\/p>\n<ul>\n<li>\n<p>\u0412\u0441\u0435 \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043e\u0434\u043d\u043e\u0433\u043e \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u043c\u0435\u0442\u044c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0438\u043c\u0435\u043d\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0412 \u0438\u043c\u0435\u043d\u0430\u0445 \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0445 \u043e\u0431\u044a\u0435\u0442\u043e\u0432 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c\u0441\u044f \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430 url.<\/p>\n<\/li>\n<\/ul>\n<details class=\"spoiler\">\n<summary>\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 CanvasManager<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cs\">public class CanvasManager : MonoBehaviour {     [SerializeField] private PageWithTextController mainPage;      private List&lt;IUIPage> uIPages = new List&lt;IUIPage>();     private static Dictionary&lt;IUIPage, string> pagePathes = new Dictionary&lt;IUIPage, string>();      \/\/ Start is called before the first frame update     private void Start()     {         UIRouter.ForceCreate();         InitAllPages();     }      private void OnDestroy()     {         UnSubscribe();     }      public void InitAllPages()     {         List&lt;IUIPage> allPagesInChilds = FindAllPagesInChilds(gameObject, gameObject.name);         if (allPagesInChilds != null) { uIPages.AddRange(allPagesInChilds); }         SubscribePages();     }      \/\/\/ &lt;summary>     \/\/\/ \u0427\u0442\u043e\u0431\u044b \u043d\u0435 \u0445\u0430\u0440\u0434\u043a\u043e\u0434\u0438\u0442\u044c \u0430\u0434\u0440\u0435\u0441\u0441 \u0441\u0442\u0440\u0430\u043d\u0438\u0446, \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0438     \/\/\/ &lt;\/summary>     public static string GetLink(IUIPage page)     {         if (pagePathes.ContainsKey(page))         {             return pagePathes[page];         }         return null;     }      private void UnSubscribe()     {         foreach(var uIPage in uIPages)         {             uIPage.Unsubscribe();         }     }      private List&lt;IUIPage> FindAllPagesInChilds(GameObject game, string curPath)     {         if (UIRouter.CheckNameForURL(game.name))         {             string locPath = string.Empty;             List&lt;IUIPage> pageList = new List&lt;IUIPage>(game.transform.childCount);             List&lt;GameObject> childss = GetAllChilds(game);             foreach (GameObject child in childss)             {                 IUIPage tryPage = null;                 if (child.TryGetComponent(out tryPage) &amp;&amp; UIRouter.CheckNameForURL(child.name))                 {                     locPath = UIRouter.slash + child.name;                     if (pagePathes.ContainsValue(curPath + locPath))                     {                         Debug.LogError(\"All child objects of a canvas with an IUIPage must have unique names. Not a unique name \" + child.name);                         return null;                     }                     pagePathes.Add(tryPage, curPath + locPath);                     pageList.Add(tryPage);                 }                 var childRes = FindAllPagesInChilds(child, curPath + locPath);                 if (childRes != null)                 {                     pageList.AddRange(childRes);                 }             }             return pageList;         }         return null;     }      private void SubscribePages()     {         foreach (var page in uIPages)          {             page.CreateURL(pagePathes[page]);             page.Subscribe();         }         if (uIPages.Contains(mainPage))         {             UIRouter.SetMainScreenRoute(pagePathes[mainPage]);         }     }      private List&lt;GameObject> GetAllChilds(GameObject game)     {         int children = game.transform.childCount;         List&lt;GameObject> childs = new List&lt;GameObject>();         for (int i = 0; i &lt; children; ++i)         {             childs.Add(game.transform.GetChild(i).gameObject);         }         return childs;     } }<\/code><\/pre>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0442\u0438\u043f\u0430 \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0432\u044b\u043d\u0443\u0436\u0434\u0435\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u043d <code>PageWithTextController<\/code> \u0432\u043c\u0435\u0441\u0442\u043e <code>IUIPage<\/code> \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043a\u043b\u0430\u0441\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0442 <code>MonoBehaviour.<\/code><\/p>\n<ul>\n<li>\n<p><code>FindAllPagesInChilds<\/code> \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u043f\u043e \u0432\u0441\u0435\u043c <code>gameObject<\/code> \u043a\u0430\u043d\u0432\u0430\u0441\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <code>IUIPages<\/code>, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0438\u043c\u0435\u043d\u0430 \u043d\u0430 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430 url, \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043f\u0443\u0442\u0438 \u0434\u043e \u043d\u0438\u0445. <\/p>\n<\/li>\n<li>\n<p><code>SubscribePages<\/code> \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0432\u0441\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0432 \u0440\u043e\u0443\u0442\u0435\u0440\u0435, \u0435\u0441\u043b\u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0443\u043a\u0430\u0437\u0430\u043d\u0430 \u043a\u0430\u043a \u0433\u043b\u0430\u0432\u043d\u0430\u044f \u0432 \u0438\u043d\u0441\u043f\u0435\u043a\u0442\u043e\u0440\u0435, \u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0438 \u0432 \u0440\u043e\u0443\u0442\u0435\u0440\u0435.<\/p>\n<\/li>\n<\/ul>\n<\/div>\n<\/details>\n<h2>\u041a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 \u0438\u043d\u0441\u043f\u0435\u043a\u0442\u043e\u0440\u044b<\/h2>\n<p>\u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u043c\u043d\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0446\u0435\u043b\u0435\u0441\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u044b\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0439 \u0438\u043d\u0441\u043f\u0435\u043a\u0442\u043e\u0440 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432. \u041e\u043d \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043a\u0430\u043a\u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u0441\u044f \u043a\u0430\u043a \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0435, \u0438 \u043a\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0438\u0437\u043c\u0435\u043d\u0438\u0442 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443.<\/p>\n<details class=\"spoiler\">\n<summary>\u0421 CanvasManagerInspector \u0432\u0441\u0451 \u043f\u0440\u043e\u0441\u0442\u043e:<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cs\">using UnityEngine; using UnityEditor;  [CustomEditor(typeof(CanvasManager))] public class CanvasManagerInspector : Editor {     public override void OnInspectorGUI()     {         base.OnInspectorGUI();          var manager = target as CanvasManager;         if (GUILayout.Button(\"Manually subscribe childs\"))         {             manager.InitAllPages();         }     } } <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0410 \u0432\u043e\u0442 \u0441 PageWithTextController \u0432\u0441\u0451 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u0435\u0435.<\/p>\n<pre><code class=\"cs\">[CustomEditor(typeof(PageWithTextController))] public class PageWithTextControllerInspector : Editor {      private Dictionary&lt;string, string> dict = new Dictionary&lt;string, string>();     private PageWithTextController controller;          private const int spaceSize = 5;      public override void OnInspectorGUI()     {                  controller = target as PageWithTextController;         if (GUILayout.Button(\"Manually add and define parameters\"))         {             controller.FindAndDefineChildsProperties();             dict = new Dictionary&lt;string, string>(controller.parametrs);         }                  EditorGUILayout.Space(spaceSize);          EditorGUIUtility.labelWidth = 240;         controller.shouldWriteRuntimeChanges = EditorGUILayout.Toggle(\"Should record changes made at runtime\", controller.shouldWriteRuntimeChanges);                  EditorGUILayout.Space(spaceSize);          ShowDict(dict);          EditorGUILayout.Space(spaceSize);          if (GUILayout.Button(\"Update params values through editor\"))         {             controller.Show(dict);         }          serializedObject.ApplyModifiedProperties();          if (GUI.changed)         {             EditorUtility.SetDirty(controller);         }     }      private Dictionary&lt;string, string> ShowDict(Dictionary&lt;string, string> dictt)     {         Dictionary&lt;string, string> newDict = new Dictionary&lt;string, string>(dictt);         foreach(string key in dictt.Keys)         {             EditorGUILayout.BeginHorizontal();              GUILayout.Label(key + \" = \");             newDict[key] = EditorGUILayout.TextField(dictt[key]);              EditorGUILayout.EndHorizontal();         }         dict = new Dictionary&lt;string, string>(newDict);         return newDict;     } }<\/code><\/pre>\n<p>\u0412\u043d\u0443\u0442\u0440\u0438 \u043a\u043b\u0430\u0441\u0441\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435:<\/p>\n<ul>\n<li>\n<p><code>dict<\/code> &#8212; \u0441\u043b\u043e\u0432\u0430\u0440\u044c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0438 \u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439.<\/p>\n<\/li>\n<li>\n<p><code>controller<\/code> &#8212; \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0431\u044a\u0435\u043a\u0442 \u0442\u0438\u043f\u0430 <code>PageWithTextController<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u0438\u043d\u0441\u043f\u0435\u043a\u0442\u043e\u0440\u0435.<\/p>\n<\/li>\n<li>\n<p><code>spaceSize<\/code> &#8212; \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430 \u0434\u043b\u044f \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043a\u0430 \u043c\u0435\u0436\u0434\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0432 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0435.<\/p>\n<\/li>\n<\/ul>\n<p>\u041c\u0435\u0442\u043e\u0434 <code>OnInspectorGUI()<\/code> \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d \u0438\u0437 \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 <code>Editor<\/code>. \u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0432 \u0438\u043d\u0441\u043f\u0435\u043a\u0442\u043e\u0440\u0435 Unity.<\/p>\n<ul>\n<li>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 <code>controller<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0430\u0436\u0430\u0442\u0430 \u043a\u043d\u043e\u043f\u043a\u0430 &#171;Manually add and define parameters&#187;, \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 <code>FindAndDefineChildsProperties()<\/code> \u0443 <code>controller<\/code>, \u0437\u0430\u0442\u0435\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0441\u043b\u043e\u0432\u0430\u0440\u044f <code>parametrs<\/code> \u043e\u0431\u044a\u0435\u043a\u0442\u0430 <code>controller<\/code> \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u044c <code>dict<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u043a\u043d\u043e\u043f\u043a\u0430 &#171;Should record changes made at runtime&#187;, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0430\u044f \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c\/\u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 <code>ShowDict()<\/code> \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0438 \u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439. \u041f\u043e \u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0432 \u044e\u043d\u0438\u0442\u0438 \u043d\u0435\u0442 \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u043e\u0433\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0441\u043b\u043e\u0432\u0430\u0440\u0438 \u0432 \u0438\u043d\u0441\u043f\u0435\u043a\u0442\u0440, \u043c\u044b \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u043c \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e. \u0427\u0442\u043e\u0431\u044b \u043d\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u043e\u0448\u0438\u0431\u043e\u043a \u043f\u0440\u0438 <code>foreach<\/code>, \u0441\u043f\u0435\u0440\u0432\u0430 \u043d\u043e\u0432\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0438\u0448\u0443\u0442\u0441\u044f \u0432 \u0431\u0443\u0444\u0435\u0440\u043d\u043e\u0435 \u043f\u043e\u043b\u0435.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u043a\u043d\u043e\u043f\u043a\u0430 &#171;Update params values through editor&#187;, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043c\u0435\u0442\u043e\u0434 <code>Show(dict)<\/code> \u0443 <code>controller<\/code>.<\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<h2>\u0412\u044b\u0432\u043e\u0434\u044b<\/h2>\n<p>\u041d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438: <\/p>\n<ul>\n<li>\n<p>\u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u043f\u0438\u0441\u0430\u0442\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f <code>IUIPage<\/code> \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u0438\u0445. <\/p>\n<\/li>\n<li>\n<p>\u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u0431\u0435\u0437 \u0437\u0430\u0449\u0438\u0442\u044b \u043e\u0442 \u0434\u0443\u0440\u0430\u043a\u0430, \u0434\u0440\u0443\u0433\u0438\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0437\u043d\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438. \u041f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0438 \u0445\u0430\u0440\u0434\u043a\u043e\u0434\u0438\u0442\u044c. <\/p>\n<\/li>\n<li>\n<p>\u0412 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435\u0439 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u0435 \u043d\u0443\u0436\u043d\u043e: \u043b\u0438\u0431\u043e \u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 <code>IUIPage<\/code>, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u0440\u0430\u0449\u0430\u044f\u0441\u044c \u043a <code>CanvasManager.GetLink(IUIPage)<\/code>\u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u043c\u0435\u0442\u043e\u0434 \u0441\u0441\u044b\u043b\u043a\u0443 \u0434\u043e \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438. \u041b\u0438\u0431\u043e \u0441\u043d\u043e\u0432\u0430 \u0445\u0430\u0440\u0434\u043a\u043e\u0434\u0438\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0443.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0435\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0441\u0442\u0438 (\u0447\u0442\u043e \u0434\u043b\u044f \u0440\u0435\u0434\u043a\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0441\u043c\u0435\u043d\u044b \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u043d\u0435 \u0442\u0430\u043a \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u043e)<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0447\u0435\u043c-\u0442\u043e \u0437\u043d\u0430\u0442\u044c \u043a\u043e\u0433\u0434\u0430 \u043e\u0442\u043a\u0440\u044b\u043b\u043e\u0441\u044c \u043e\u043a\u043d\u043e \u0434\u043b\u044f \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0439 (\u0430 \u043d\u0435 \u043a\u043e\u0433\u0434\u0430 \u0433\u043e\u0442\u043e\u0432\u044b \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f \u043e\u043a\u043d\u0430), \u0442\u043e \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b.<\/p>\n<\/li>\n<\/ul>\n<p>\u0415\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u0435\u0449\u0451 \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u043c\u0438\u043d\u0443\u0441\u044b, \u043c\u043e\u0436\u0435\u0442\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043c\u0435\u043d\u044f \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445.<\/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\/755574\/\"> https:\/\/habr.com\/ru\/articles\/755574\/<\/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<figure class=\"full-width\">\n<div><figcaption>(\u041d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0435\u0439 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0440\u043e\u0443\u0442\u0435\u0440\u0430)<\/figcaption><\/div>\n<\/figure>\n<h2>\u0414\u0438\u0441\u043a\u043b\u0435\u0439\u043c\u0435\u0440<\/h2>\n<p>\u041c\u043e\u0439 \u0440\u043e\u0443\u0442\u0435\u0440 \u0438\u0434\u0435\u0439\u043d\u043e \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u0442 \u0440\u043e\u0443\u0442\u0435\u0440 <a href=\"https:\/\/habr.com\/ru\/articles\/711524\/\" rel=\"noopener noreferrer nofollow\">\u0438\u0437 \u0441\u0442\u0430\u0442\u044c\u0438<\/a>, \u043e\u0434\u043d\u0430\u043a\u043e \u0434\u0430\u043d\u043d\u0430\u044f \u0442\u0430\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u043c\u043d\u0435 \u043d\u0435 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0438 \u043d\u0435 \u0443\u0434\u043e\u0431\u043d\u043e\u0439 \u0432 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438. \u042f \u043e\u043f\u0438\u0448\u0443 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441\u0432\u043e\u0435\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 + CustomEditor, \u0431\u0435\u0437 \u0430\u0442\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u0438 SendMessage.<\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u044f \u0431\u0443\u0434\u0443 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043a\u0443\u0441\u043a\u0438 \u043a\u043e\u0434\u0430, \u0430 \u0437\u0430\u0442\u0435\u043c \u0432 \u0441\u043f\u043e\u0439\u043b\u0435\u0440\u0435 \u043f\u043e\u043b\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438, \u0447\u0442\u043e\u0431\u044b \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043d\u0435 \u0440\u0430\u0441\u0442\u044f\u0433\u0438\u0432\u0430\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u044e.<\/p>\n<hr\/>\n<h2>\u041a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u044f<\/h2>\n<p>\u0417\u0430\u0447\u0430\u0441\u0442\u0443\u044e, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u044e \u0441\u043b\u043e\u0432\u0430\u0440\u0435\u0439, \u0435\u043d\u0430\u043c\u043e\u0432, \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430, \u0447\u0442\u043e\u0431\u044b \u0433\u0440\u0430\u043c\u043e\u0442\u043d\u043e \u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 \u0442\u0435\u043c \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442. \u041e\u0434\u043d\u0430\u043a\u043e, \u0438\u043d\u043e\u0433\u0434\u0430 \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u0440\u0435\u0447\u0438\u0442\u044c \u0438\u0434\u0435\u043e\u043b\u043e\u0433\u0438\u0438, \u0447\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u043b\u0438\u0448\u044c \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435, \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u044f \u0435\u0433\u043e.<\/p>\n<p>\u0414\u043b\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u0438\u043c\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043e\u043f\u044b\u0442 \u0438\u0437 \u0432\u0435\u0431 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438:<\/p>\n<ol>\n<li>\n<p>\u0412\u0441\u0435 \u044d\u043a\u0440\u0430\u043d\u044b \u0438\u043c\u0435\u044e\u0442 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 url.<\/p>\n<\/li>\n<li>\n<p>\u0412\u0441\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u0432 \u0432\u0438\u0434\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043a\u0430\u043a \u0447\u0430\u0441\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0438.<\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u043c\u0430\u043d\u0434\u044b \u043e\u043a\u043d\u0430\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0445\u0440\u0430\u043d\u0438\u0442 \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u043e\u043a\u043e\u043d \u0432 \u0441\u0442\u044d\u043a\u0435 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0443.<\/p>\n<\/li>\n<\/ol>\n<p>\u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0438\u043c\u0435\u0435\u043c:<\/p>\n<ul>\n<li>\n<p>\u042d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0440\u043d\u0443\u044e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 back. \u0412 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0435\u0433\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u043b\u043e\u0441\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u0441\u0441\u044b\u043b\u043a\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u043c back, \u0442\u043e \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043d\u043e\u0432\u0430 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u044d\u043a\u0440\u0430\u043d, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u043b\u0438 \u0434\u043e \u044d\u0442\u043e\u0433\u043e \u0441 \u0442\u0435\u043c\u0438 \u0436\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0442\u043e\u0442 \u0436\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.<\/p>\n<\/li>\n<li>\n<p>\u0418\u0437\u0431\u0435\u0433\u0430\u0435\u043c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u043c\u0435\u0436\u0434\u0443 \u043e\u043a\u043d\u0430\u043c\u0438.<\/p>\n<\/li>\n<\/ul>\n<h2>\u041f\u0438\u0448\u0435\u043c \u0440\u043e\u0443\u0442\u0435\u0440<\/h2>\n<p>\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0441\u0442\u044d\u043a \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0446, \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 \u0441\u0442\u0440\u0430\u043d\u0438\u0446, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u0443\u0442\u044c \u0434\u043e \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0438 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430:<\/p>\n<pre><code class=\"cs\">public static class UIRouter {     private static Stack&lt;string> _screensStack = new Stack&lt;string>();     private static Dictionary&lt;string, IUIPage> _routesPageData = new Dictionary&lt;string, IUIPage>();     private static string _mainScreenRoute = string.Empty;      #region const     \/\/ \u0427\u0442\u043e\u0431\u044b \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 url \u0431\u044b\u043b \u0435\u0434\u0438\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u044b\u043c, \u044f\u0432\u043d\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0435\u0433\u043e \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b     \/\/ \u041f\u0440\u0438\u043c\u0435\u0440 \u0441\u0441\u044b\u043b\u043a\u0438:     \/\/ canvas.Name + slash + gameObj1.Name + separator + key + equally + value + and + key2 + equally + value2 = \"Canvas\/Name1?key=value&amp;key2=value2\"     public const string slash = \"\/\";     public const string separator = \"?\";     public const string and = \"&amp;\";     public const string equally = \"=\";     #endregion      \/\/ \u0427\u0442\u043e\u0431\u044b \u043d\u0435 \u0432\u044b\u0431\u0440\u0430\u0441\u043e\u0432\u0430\u043b\u043e NullReferenceException, \u043f\u0435\u0440\u0432\u044b\u043c \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435\u043c \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043f\u043e\u043b\u044f.     public static void ForceCreate()     {         if (_routesPageData == null || _screensStack == null)         {             _routesPageData = new Dictionary&lt;string, IUIPage>();             _screensStack = new Stack&lt;string>();             _mainScreenRoute = string.Empty;         }             } }<\/code><\/pre>\n<p>\u0412\u0441\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043e\u0431\u043b\u0430\u0434\u0430\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u044b\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u043e\u043c \u0434\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0433\u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u0440\u043e\u0443\u0442\u0435\u0440\u043e\u043c (\u0438 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u043e\u043c \u043a\u0430\u043d\u0432\u0430\u0441\u0430 \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c). \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441:<\/p>\n<pre><code class=\"cs\">public interface IUIPage {     public string url { get; }     public void CreateURL(string url, bool shouldUpdatePropertiesValues);      public void Show(Dictionary&lt;string, string> data);     public string Hide();          public void Subscribe();     public void Unsubscribe();      public void FindAndDefineChildsProperties(); }<\/code><\/pre>\n<p>\u0427\u0442\u043e\u0431\u044b \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0435 \u0432 \u0432\u0438\u0434\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0432 url, \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 <code>UIRouter<\/code> \u043f\u0438\u0448\u0435\u043c \u043f\u0430\u0440\u0441\u0435\u0440:<\/p>\n<pre><code class=\"cs\">private static Dictionary&lt;string, string> ParseParams(string fullRoute, out string route) {     string routeEnd = \"\";     if (fullRoute.Contains(slash))     {         routeEnd = fullRoute.Split(slash)[^1];     }     else     {         routeEnd = fullRoute;     }     var result = new Dictionary&lt;string, string>();     var routeParams = routeEnd.Split(separator);     if (routeParams.Length > 1)     {         var parameters = routeParams[1].Split(and);         if (parameters.Length > 0)         {             foreach (var param in parameters)             {                 var data = param.Split(equally);                 if (data.Length > 1)                 {                     result[data[0]] = data[1];                 }             }         }         route = fullRoute.Split(separator)[0];     }     else     {         route = fullRoute;     }     return result; }<\/code><\/pre>\n<p>\u041e\u043d \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0435\u0442 \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0434\u0432\u0435 \u0447\u0430\u0441\u0442\u0438: \u0430\u0434\u0440\u0435\u0441\u0441 \u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 <code>separator<\/code>. \u0421\u0430\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043e\u0442\u0434\u0435\u043b\u044f\u044e\u0442 \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430 \u043f\u043e \u0437\u043d\u0430\u043a\u0443 <code>and<\/code>, \u0430 \u043a\u043b\u044e\u0447\u0438 \u043e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043f\u043e \u0437\u043d\u0430\u043a\u0443 <code>equally<\/code>. \u041f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0438\u0439\u0441\u044f \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0438\u0437 \u043a\u043b\u044e\u0447\u0435\u0439 \u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043f\u043e\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0447\u0435\u0440\u0435\u0437 <code>return<\/code>, \u0430 \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u043a\u043b\u0430\u0434\u0451\u0442 \u0447\u0430\u0441\u0442\u044c url \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0443\u044e \u0437\u0430 \u0430\u0434\u0440\u0435\u0441.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c &#171;\u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c&#187; \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u043f\u043e \u0438\u0445 \u0430\u0434\u0440\u0435\u0441\u0441\u0443 \u0432 url, \u043d\u0435 \u0431\u043e\u044f\u0441\u044c \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0430\u0434\u0440\u0435\u0441\u0441 \u0441 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438.<\/p>\n<pre><code class=\"cs\">public static void SubscribePath(string path, IUIPage page) {     ParseParams(path, out path);     if (!_routesPageData.ContainsKey(path))     {         _routesPageData.Add(path, page);     } } public static void UnsubscribePath(string path) {     ParseParams(path, out path);     if (_routesPageData.ContainsKey(path))     {         _routesPageData.Remove(path);     } } public static void SetMainScreenRoute(string route, bool forceAdd=false) {     if (_mainScreenRoute == \"\" || forceAdd)     {         _mainScreenRoute = route;         if (_screensStack.Count == 0)         {             _screensStack.Push(route);         }     } }<\/code><\/pre>\n<p>\u041c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f \u0438 \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446:<\/p>\n<pre><code class=\"cs\">public static void OpenPageUrl(string route) {     if (_screensStack.Count > 0)     {         string url = _screensStack.Peek();         if (url.Contains(separator))         {             url = url.Split(separator)[0];         }         _screensStack.Push(_routesPageData[url].Hide());     }     _screensStack.Push(route);          var payload = ParseParams(route, out route);     if (_routesPageData.ContainsKey(route))     {         var page = _routesPageData[route];         page.Show(payload);     }     else     {         Debug.LogError($\"There no route with name: {route}\");     } } public static void ReleaseLastPage() {     if (_screensStack.Count > 0)     {         _screensStack.Pop();         if (_screensStack.Count >= 1)         {             string route = _screensStack.Peek();             OpenPageUrl(route, true);         }         else         {             if (_mainScreenRoute != null) OpenPageUrl(_mainScreenRoute, true);         }     } }<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 \u0440\u043e\u0443\u0442\u0435\u0440\u0430:<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cs\">public static class UIRouter {     private static Stack&lt;string> _screensStack = new Stack&lt;string>();     private static Dictionary&lt;string, IUIPage> _routesPageData = new Dictionary&lt;string, IUIPage>();     private static string _mainScreenRoute = string.Empty;      #region const     \/\/ \u0427\u0442\u043e\u0431\u044b \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 url \u0431\u044b\u043b \u0435\u0434\u0438\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u044b\u043c, \u044f\u0432\u043d\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0435\u0433\u043e \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b     \/\/ \u041f\u0440\u0438\u043c\u0435\u0440 \u0441\u0441\u044b\u043b\u043a\u0438:     \/\/ canvas.Name + slash + gameObj1.Name + separator + key + equally + value + and + key2 + equally + value2 = \"Canvas\/Name1?key=value&amp;key2=value2\"     public const string slash = \"\/\";     public const string separator = \"?\";     public const string and = \"&amp;\";     public const string equally = \"=\";     #endregion      \/\/ \u0427\u0442\u043e\u0431\u044b \u043d\u0435 \u0432\u044b\u0431\u0440\u0430\u0441\u043e\u0432\u0430\u043b\u043e NullReferenceException \u043f\u0435\u0440\u0432\u044b\u043c \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435\u043c \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043f\u043e\u043b\u044f.     public static void ForceCreate()     {         if (_routesPageData == null || _screensStack == null)         {             _routesPageData = new Dictionary&lt;string, IUIPage>();             _screensStack = new Stack&lt;string>();             _mainScreenRoute = string.Empty;         }             }      public static void SubscribePath(string path, IUIPage page)     {         ParseParams(path, out path);         if (!_routesPageData.ContainsKey(path))         {             _routesPageData.Add(path, page);         }     }      public static void UnsubscribePath(string path)     {         ParseParams(path, out path);         if (_routesPageData.ContainsKey(path))         {             _routesPageData.Remove(path);         }     }      public static void SetMainScreenRoute(string route, bool forceAdd = false)     {         if (_mainScreenRoute == \"\" || forceAdd)         {             _mainScreenRoute = route;             if (_screensStack.Count == 0)             {                 _screensStack.Push(route);             }         }     }      public static void OpenPageUrl(string route)     {         if (_screensStack.Count > 0)         {             string url = _screensStack.Peek();             if (url.Contains(separator))             {                 url = url.Split(separator)[0];             }             _screensStack.Push(_routesPageData[url].Hide());         }         _screensStack.Push(route);                  var payload = ParseParams(route, out route);         if (_routesPageData.ContainsKey(route))         {             var page = _routesPageData[route];             page.Show(payload);         }         else         {             Debug.LogError($\"There no route with name: {route}\");         }     }      public static void ReleaseLastPage()     {         if (_screensStack.Count > 0)         {             _screensStack.Pop();             if (_screensStack.Count >= 1)             {                 string route = _screensStack.Peek();                 OpenPageUrl(route);             }             else             {                 if (_mainScreenRoute != null) OpenPageUrl(_mainScreenRoute);             }         }               public static bool CheckNameForURL(string name)     {         if (name.Contains(slash) || name.Contains(separator) || name.Contains(and) || name.Contains(equally))         {             Debug.LogError(\"Name must not include url syntacis chars! Error with name \" + name);             return false;         }         return true;     }      private static Dictionary&lt;string, string> ParseParams(string fullRoute, out string route)     {         string routeEnd = \"\";         if (fullRoute.Contains(slash))         {             routeEnd = fullRoute.Split(slash)[^1];         }         else         {             routeEnd = fullRoute;         }         var result = new Dictionary&lt;string, string>();         var routeParams = routeEnd.Split(separator);         if (routeParams.Length > 1)         {             var parameters = routeParams[1].Split(and);             if<\/code><\/pre>\n<\/div>\n<\/details>\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-352591","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/352591","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=352591"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/352591\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=352591"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=352591"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=352591"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}