wip update unity example
This commit is contained in:
56
examples/button-clicker/Assets/BuildHelper.cs
Normal file
56
examples/button-clicker/Assets/BuildHelper.cs
Normal file
@ -0,0 +1,56 @@
|
||||
using UnityEditor;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
|
||||
[InitializeOnLoad]
|
||||
public class ScriptBatch
|
||||
{
|
||||
static ScriptBatch()
|
||||
{
|
||||
EnsureDLL();
|
||||
}
|
||||
|
||||
public static bool FileExists(string filename)
|
||||
{
|
||||
return new FileInfo(filename).Exists;
|
||||
}
|
||||
|
||||
public static void EnsureDLL()
|
||||
{
|
||||
UnityEngine.Debug.Log("Make sure Discord dll exists");
|
||||
|
||||
string dstDll32 = "Assets/Plugins/x86/discord-rpc.dll";
|
||||
string dstDll64 = "Assets/Plugins/x86_64/discord-rpc.dll";
|
||||
|
||||
if (!FileExists(dstDll32) || !FileExists(dstDll64))
|
||||
{
|
||||
string srcDll32 = "../../builds/install/win64-dynamic/bin/discord-rpc.dll";
|
||||
string srcDll64 = "../../builds/install/win64-dynamic/bin/discord-rpc.dll";
|
||||
|
||||
if (!FileExists(srcDll32) || !FileExists(srcDll64))
|
||||
{
|
||||
UnityEngine.Debug.Log("Try to run build script");
|
||||
Process proc = new Process();
|
||||
proc.StartInfo.FileName = "python";
|
||||
proc.StartInfo.Arguments = "build.py";
|
||||
proc.StartInfo.WorkingDirectory = "../..";
|
||||
proc.Start();
|
||||
proc.WaitForExit();
|
||||
if (proc.ExitCode != 0)
|
||||
{
|
||||
UnityEngine.Debug.LogError("Build failed");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// make sure the dirs exist
|
||||
Directory.CreateDirectory("Assets/Plugins");
|
||||
Directory.CreateDirectory("Assets/Plugins/x86");
|
||||
Directory.CreateDirectory("Assets/Plugins/x86_64");
|
||||
|
||||
// Copy dlls
|
||||
FileUtil.CopyFileOrDirectory("../../builds/install/win64-dynamic/bin/discord-rpc.dll", dstDll64);
|
||||
FileUtil.CopyFileOrDirectory("../../builds/install/win32-dynamic/bin/discord-rpc.dll", dstDll32);
|
||||
}
|
||||
}
|
||||
}
|
13
examples/button-clicker/Assets/BuildHelper.cs.meta
Normal file
13
examples/button-clicker/Assets/BuildHelper.cs.meta
Normal file
@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e5aecc4633e5f594b85eaa39f49bb402
|
||||
timeCreated: 1512071254
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,9 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4ddcc1759a3a2394fa1fa376963639e0
|
||||
folderAsset: yes
|
||||
timeCreated: 1501697278
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,27 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2aadd6305b09fa94dab94261a8bb8caf
|
||||
timeCreated: 1501697340
|
||||
licenseType: Free
|
||||
PluginImporter:
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
platformData:
|
||||
data:
|
||||
first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
data:
|
||||
first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user