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; }
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); } }