Skip to content

Commit

Permalink
Remove TMPro dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
FejZa committed Nov 18, 2023
1 parent 047d0a6 commit f9b5251
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 35 deletions.
32 changes: 0 additions & 32 deletions Editor/Utilities/RealityToolkitEditorSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Licensed under the MIT License. See LICENSE in the project root for license information.

using System.IO;
using TMPro.EditorUtilities;
using UnityEditor;
using UnityEditor.Build;
using UnityEngine;
Expand Down Expand Up @@ -46,16 +45,6 @@ public static void CheckSettings()

SessionState.SetBool(sessionKey, false);

if (!Directory.Exists($"{Application.dataPath}/TextMesh Pro"))
{
if (EditorUtility.DisplayDialog("Missing Package!",
"The project requires the Text Mesh Pro essential resources, would you like to import them now?",
"OK", "Later"))
{
ImportTMProEssentialResources();
}
}

var message = "The Reality Toolkit needs to apply the following settings to your project:\n\n";

var forceTextSerialization = EditorSettings.serializationMode == SerializationMode.ForceText;
Expand Down Expand Up @@ -129,27 +118,6 @@ void IActiveBuildTargetChanged.OnActiveBuildTargetChanged(BuildTarget previousTa
private static string settingsFilePath;
private static byte[] settingsBackup;

// Copied straight from the TMP_PackageUtilities.cs but we needed to import the assets if in batch mode.
private static void ImportTMProEssentialResources()
{
// Check if the TMP Settings asset is already present in the project.
var settings = AssetDatabase.FindAssets("t:TMP_Settings");

if (settings.Length > 0)
{
// Save assets just in case the TMP Setting were modified before import.
AssetDatabase.SaveAssets();

// Copy existing TMP Settings asset to a byte[]
settingsFilePath = AssetDatabase.GUIDToAssetPath(settings[0]);
settingsBackup = File.ReadAllBytes(settingsFilePath);

AssetDatabase.importPackageCompleted += ImportCallback;
}

AssetDatabase.ImportPackage($"{TMP_EditorUtility.packageFullPath}/Package Resources/TMP Essential Resources.unitypackage", Application.isBatchMode);
}

private static void ImportCallback(string packageName)
{
// Restore backup of TMP Settings from byte[]
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
"dependencies": {
"com.unity.xr.management": "4.4.0",
"com.unity.modules.unitywebrequest": "1.0.0",
"com.unity.textmeshpro": "3.0.6",
"com.realitycollective.service-framework": "1.0.3",
"com.unity.nuget.newtonsoft-json": "3.2.1"
"com.unity.nuget.newtonsoft-json": "3.2.1",
"com.unity.ugui": "1.0.0"
}
}
}

0 comments on commit f9b5251

Please sign in to comment.