Initialer Upload neues Unity-Projekt
This commit is contained in:
@ -0,0 +1 @@
|
||||
TutorialInitialized
|
||||
41
Assets/Convai/Scripts/Editor/Tutorial/PostImportProcess.cs
Normal file
41
Assets/Convai/Scripts/Editor/Tutorial/PostImportProcess.cs
Normal file
@ -0,0 +1,41 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using System.IO;
|
||||
|
||||
[InitializeOnLoad]
|
||||
public class PostImportProcess
|
||||
{
|
||||
private static readonly string processedFilePath = Path.Combine(Application.dataPath, "Convai/Scripts/Editor/Tutorial/.TutorialInitialized");
|
||||
|
||||
static PostImportProcess()
|
||||
{
|
||||
if (HasAlreadyProcessed())
|
||||
return;
|
||||
|
||||
string settingsPath = Path.Combine(Application.dataPath.Substring(0, Application.dataPath.LastIndexOf('/')),
|
||||
"ProjectSettings/Packages/com.unity.learn.iet-framework/Settings.json");
|
||||
|
||||
if (!File.Exists(settingsPath)) return;
|
||||
File.Delete(settingsPath);
|
||||
DestroySelf();
|
||||
MarkAsProcessed();
|
||||
}
|
||||
|
||||
private static void DestroySelf()
|
||||
{
|
||||
string path = Path.Combine(Application.dataPath, "Convai/Scripts/Editor/Tutorial/PostImportProcess.cs");
|
||||
File.Delete(path);
|
||||
File.Delete(path + ".meta");
|
||||
File.Delete(processedFilePath);
|
||||
}
|
||||
|
||||
private static bool HasAlreadyProcessed()
|
||||
{
|
||||
return File.Exists(processedFilePath);
|
||||
}
|
||||
|
||||
private static void MarkAsProcessed()
|
||||
{
|
||||
File.WriteAllText(processedFilePath, "TutorialInitialized");
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e74fa33131314ea40900b3c1f43352bd
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,29 @@
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEditor.PackageManager;
|
||||
using PackageInfo = UnityEditor.PackageManager.PackageInfo;
|
||||
|
||||
public class RemoveTutorialAssets : EditorWindow
|
||||
{
|
||||
private const string TUTORIAL_ASSETS_PATH = "Assets/Convai/Tutorials";
|
||||
private const string TUTORIAL_PACKAGE_NAME = "com.unity.learn.iet-framework";
|
||||
|
||||
[MenuItem("Convai/Remove Tutorial Assets")]
|
||||
private static void StartUninstallProcess()
|
||||
{
|
||||
if (Directory.Exists(TUTORIAL_ASSETS_PATH))
|
||||
{
|
||||
AssetDatabase.DeleteAsset(TUTORIAL_ASSETS_PATH);
|
||||
AssetDatabase.Refresh();
|
||||
|
||||
foreach (PackageInfo packageInfo in PackageInfo.GetAllRegisteredPackages())
|
||||
{
|
||||
// Check if the package name matches
|
||||
if (packageInfo.name == TUTORIAL_PACKAGE_NAME)
|
||||
{
|
||||
Client.Remove(TUTORIAL_PACKAGE_NAME);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 884304efde7585442b24b38748460394
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user