This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class DebugHierarchy | |
{ | |
public static string HierarchyToString(VisualElement root) | |
{ | |
var sb = new StringBuilder(); | |
HierarchyToStringRecursive(root, sb, 0); | |
var s = sb.ToString(); | |
EditorGUIUtility.systemCopyBuffer = s; | |
return s; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using UnityEditor; | |
using UnityEditor.UIElements; | |
using UnityEngine; | |
using UnityEngine.UIElements; | |
// Our Interface. | |
public interface IMyInterface | |
{ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEngine.UIElements; | |
public class Example : MonoBehaviour | |
{ | |
public UIDocument document; | |
void Start() | |
{ | |
var document = GetComponent<UIDocument>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void RemoveLocale(LocaleIdentifier localeIdentifier) | |
{ | |
foreach (var collectionStrings in LocalizationEditorSettings.GetStringTableCollections()) | |
{ | |
var table = collectionStrings.GetTable(localeIdentifier); | |
if (table != null) | |
{ | |
collectionStrings.RemoveTable(table); | |
AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(table)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Text; | |
using System.Text.RegularExpressions; | |
using UnityEditor; | |
using UnityEditor.Localization; | |
using UnityEngine.Localization.Settings; | |
using UnityEngine.Localization.SmartFormat; | |
using UnityEngine.Localization.SmartFormat.Core.Extensions; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEngine.AddressableAssets; | |
using UnityEngine.ResourceManagement.AsyncOperations; | |
using UnityEngine.UIElements; | |
#if UNITY_EDITOR | |
public class AssetReferenceConverter<T> : UnityEditor.UIElements.UxmlAttributeConverter<AssetReferenceT<T>> where T : Object | |
{ | |
public override AssetReferenceT<T> FromString(string value) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEditor; | |
using UnityEditor.Localization; | |
using UnityEngine.Localization.Components; | |
public class MarkSmart | |
{ | |
[MenuItem("CONTEXT/Component/Mark Smart", true)] | |
public static bool MarkEntrySmartValidate(MenuCommand menuCommand) => menuCommand.context is LocalizeStringEvent; | |
[MenuItem("CONTEXT/Component/Mark Smart", false)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using UnityEngine.UIElements; | |
[Serializable] | |
class DictItem | |
{ | |
public int key; | |
public string value; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Reflection; | |
using TMPro; | |
using UnityEngine; | |
using UnityEngine.Localization; | |
/// <summary> | |
/// Sets the default TextMeshPro font to be used. | |
/// </summary> | |
[ExecuteInEditMode] | |
public class DefaultTmpFont : MonoBehaviour |
NewerOlder