Пример #1
0
        private static void CopyAllRules(MenuCommand item)
        {
            CustomRuleTile tile = item.context as CustomRuleTile;

            if (tile == null)
            {
                return;
            }

            CustomRuleTileRuleWrapper rulesWrapper = new CustomRuleTileRuleWrapper();

            rulesWrapper.rules = tile.m_TilingRules;
            var rulesJson = EditorJsonUtility.ToJson(rulesWrapper);

            EditorGUIUtility.systemCopyBuffer = rulesJson;
        }
Пример #2
0
        private static void PasteRules(MenuCommand item)
        {
            CustomRuleTile tile = item.context as CustomRuleTile;

            if (tile == null)
            {
                return;
            }

            try
            {
                CustomRuleTileRuleWrapper rulesWrapper = new CustomRuleTileRuleWrapper();
                EditorJsonUtility.FromJsonOverwrite(EditorGUIUtility.systemCopyBuffer, rulesWrapper);
                tile.m_TilingRules.AddRange(rulesWrapper.rules);
            }
            catch (Exception e)
            {
                Debug.LogError("Unable to paste rules from system copy buffer" + e.Data);
            }
        }