From 82439911c651139698e481d2c9e36cad5986d325 Mon Sep 17 00:00:00 2001 From: Chris Marsh Date: Thu, 30 Nov 2017 12:26:11 -0800 Subject: [PATCH] wip update unity example --- examples/button-clicker/.gitignore | 4 +- examples/button-clicker/Assets/BuildHelper.cs | 56 +++++++++++++++++++ .../button-clicker/Assets/BuildHelper.cs.meta | 13 +++++ examples/button-clicker/Assets/Resources.meta | 9 --- .../Assets/Resources/discord-rpc.dll.meta | 27 --------- .../ProjectSettings/DynamicsManager.asset | 1 + .../ProjectSettings/EditorBuildSettings.asset | 5 +- .../ProjectSettings/Physics2DSettings.asset | 1 + .../ProjectSettings/ProjectSettings.asset | 32 ++++++++--- .../ProjectSettings/ProjectVersion.txt | 2 +- .../UnityPackageManager/manifest.json | 4 ++ 11 files changed, 107 insertions(+), 47 deletions(-) create mode 100644 examples/button-clicker/Assets/BuildHelper.cs create mode 100644 examples/button-clicker/Assets/BuildHelper.cs.meta delete mode 100644 examples/button-clicker/Assets/Resources.meta delete mode 100644 examples/button-clicker/Assets/Resources/discord-rpc.dll.meta create mode 100644 examples/button-clicker/UnityPackageManager/manifest.json diff --git a/examples/button-clicker/.gitignore b/examples/button-clicker/.gitignore index 6e47d8f..2695047 100644 --- a/examples/button-clicker/.gitignore +++ b/examples/button-clicker/.gitignore @@ -1,6 +1,8 @@ /Library/ /Temp/ /obj/ +/Assets/Plugins/ +/Assets/Plugins.meta *.sln *.csproj -*.userprefs \ No newline at end of file +*.userprefs diff --git a/examples/button-clicker/Assets/BuildHelper.cs b/examples/button-clicker/Assets/BuildHelper.cs new file mode 100644 index 0000000..d9ce002 --- /dev/null +++ b/examples/button-clicker/Assets/BuildHelper.cs @@ -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); + } + } +} \ No newline at end of file diff --git a/examples/button-clicker/Assets/BuildHelper.cs.meta b/examples/button-clicker/Assets/BuildHelper.cs.meta new file mode 100644 index 0000000..c14e1e8 --- /dev/null +++ b/examples/button-clicker/Assets/BuildHelper.cs.meta @@ -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: diff --git a/examples/button-clicker/Assets/Resources.meta b/examples/button-clicker/Assets/Resources.meta deleted file mode 100644 index 59ba776..0000000 --- a/examples/button-clicker/Assets/Resources.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 4ddcc1759a3a2394fa1fa376963639e0 -folderAsset: yes -timeCreated: 1501697278 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/examples/button-clicker/Assets/Resources/discord-rpc.dll.meta b/examples/button-clicker/Assets/Resources/discord-rpc.dll.meta deleted file mode 100644 index af186c2..0000000 --- a/examples/button-clicker/Assets/Resources/discord-rpc.dll.meta +++ /dev/null @@ -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: diff --git a/examples/button-clicker/ProjectSettings/DynamicsManager.asset b/examples/button-clicker/ProjectSettings/DynamicsManager.asset index 1931946..0be3d78 100644 --- a/examples/button-clicker/ProjectSettings/DynamicsManager.asset +++ b/examples/button-clicker/ProjectSettings/DynamicsManager.asset @@ -17,3 +17,4 @@ PhysicsManager: m_EnablePCM: 1 m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff m_AutoSimulation: 1 + m_AutoSyncTransforms: 1 diff --git a/examples/button-clicker/ProjectSettings/EditorBuildSettings.asset b/examples/button-clicker/ProjectSettings/EditorBuildSettings.asset index 6dc24f7..d8fda84 100644 --- a/examples/button-clicker/ProjectSettings/EditorBuildSettings.asset +++ b/examples/button-clicker/ProjectSettings/EditorBuildSettings.asset @@ -4,4 +4,7 @@ EditorBuildSettings: m_ObjectHideFlags: 0 serializedVersion: 2 - m_Scenes: [] + m_Scenes: + - enabled: 1 + path: Assets/main.unity + guid: 3b03d21bb25fa494e8694cd6e4b6d769 diff --git a/examples/button-clicker/ProjectSettings/Physics2DSettings.asset b/examples/button-clicker/ProjectSettings/Physics2DSettings.asset index e3b2d0b..132ee6b 100644 --- a/examples/button-clicker/ProjectSettings/Physics2DSettings.asset +++ b/examples/button-clicker/ProjectSettings/Physics2DSettings.asset @@ -24,6 +24,7 @@ Physics2DSettings: m_QueriesStartInColliders: 1 m_ChangeStopsCallbacks: 0 m_CallbacksOnDisable: 1 + m_AutoSyncTransforms: 1 m_AlwaysShowColliders: 0 m_ShowColliderSleep: 1 m_ShowColliderContacts: 0 diff --git a/examples/button-clicker/ProjectSettings/ProjectSettings.asset b/examples/button-clicker/ProjectSettings/ProjectSettings.asset index 07a6ce2..f60fe83 100644 --- a/examples/button-clicker/ProjectSettings/ProjectSettings.asset +++ b/examples/button-clicker/ProjectSettings/ProjectSettings.asset @@ -3,14 +3,15 @@ --- !u!129 &1 PlayerSettings: m_ObjectHideFlags: 0 - serializedVersion: 12 + serializedVersion: 13 productGUID: 5eccc60d3e382a346a65f512d6b81b84 AndroidProfiler: 0 + AndroidFilterTouchesWhenObscured: 0 defaultScreenOrientation: 4 targetDevice: 2 useOnDemandResources: 0 accelerometerFrequency: 60 - companyName: DefaultCompany + companyName: Discord Inc. productName: button-clicker defaultCursor: {fileID: 0} cursorHotspot: {x: 0, y: 0} @@ -38,8 +39,6 @@ PlayerSettings: width: 1 height: 1 m_SplashScreenLogos: [] - m_SplashScreenBackgroundLandscape: {fileID: 0} - m_SplashScreenBackgroundPortrait: {fileID: 0} m_VirtualRealitySplashScreen: {fileID: 0} m_HolographicTrackingLossScreen: {fileID: 0} defaultScreenWidth: 1024 @@ -49,7 +48,6 @@ PlayerSettings: m_StereoRenderingPath: 0 m_ActiveColorSpace: 0 m_MTRendering: 1 - m_MobileMTRendering: 0 m_StackTraceTypes: 010000000100000001000000010000000100000001000000 iosShowActivityIndicatorOnLoading: -1 androidShowActivityIndicatorOnLoading: -1 @@ -64,8 +62,10 @@ PlayerSettings: useOSAutorotation: 1 use32BitDisplayBuffer: 1 disableDepthAndStencilBuffers: 0 + androidBlitType: 0 defaultIsFullScreen: 1 defaultIsNativeResolution: 1 + macRetinaSupport: 1 runInBackground: 0 captureSingleScreen: 0 muteOtherAudioSources: 0 @@ -95,6 +95,7 @@ PlayerSettings: xboxEnableHeadOrientation: 0 xboxEnableGuest: 0 xboxEnablePIXSampling: 0 + metalFramebufferOnly: 0 n3dsDisableStereoscopicView: 0 n3dsEnableSharedListOpt: 1 n3dsEnableVSync: 0 @@ -103,6 +104,7 @@ PlayerSettings: xboxOneMonoLoggingLevel: 0 xboxOneLoggingLevel: 1 xboxOneDisableEsram: 0 + xboxOnePresentImmediateThreshold: 0 videoMemoryForVertexBuffers: 0 psp2PowerMode: 0 psp2AcquireBGM: 1 @@ -134,12 +136,17 @@ PlayerSettings: daydream: depthFormat: 0 useSustainedPerformanceMode: 0 + enableVideoLayer: 0 + useProtectedVideoMemory: 0 hololens: depthFormat: 1 protectGraphicsMemory: 0 useHDRDisplay: 0 + m_ColorGamuts: 00000000 targetPixelDensity: 0 resolutionScalingMode: 0 + androidSupportedAspectRatio: 1 + androidMaxAspectRatio: 2.1 applicationIdentifier: {} buildNumber: {} AndroidBundleVersionCode: 1 @@ -160,10 +167,10 @@ PlayerSettings: serializedVersion: 2 m_Bits: 238 iPhoneSdkVersion: 988 - iOSTargetOSVersionString: + iOSTargetOSVersionString: 7.0 tvOSSdkVersion: 0 tvOSRequireExtendedGameController: 0 - tvOSTargetOSVersionString: + tvOSTargetOSVersionString: 9.0 uIPrerenderedIcon: 0 uIRequiresPersistentWiFi: 0 uIRequiresFullScreen: 1 @@ -220,7 +227,9 @@ PlayerSettings: AndroidKeyaliasName: AndroidTVCompatibility: 1 AndroidIsGame: 1 + AndroidEnableTango: 0 androidEnableBanner: 1 + androidUseLowAccuracyLocation: 0 m_AndroidBanners: - width: 320 height: 180 @@ -231,10 +240,14 @@ PlayerSettings: m_BuildTargetBatching: [] m_BuildTargetGraphicsAPIs: [] m_BuildTargetVRSettings: [] + m_BuildTargetEnableVuforiaSettings: [] openGLRequireES31: 0 openGLRequireES31AEP: 0 - webPlayerTemplate: APPLICATION:Default m_TemplateCustomTags: {} + mobileMTRendering: + Android: 1 + iPhone: 1 + tvOS: 1 wiiUTitleID: 0005000011000000 wiiUGroupID: 00010000 wiiUCommonSaveSize: 4096 @@ -368,6 +381,9 @@ PlayerSettings: switchUdpSendBufferSize: 9 switchUdpReceiveBufferSize: 42 switchSocketBufferEfficiency: 4 + switchSocketInitializeEnabled: 1 + switchNetworkInterfaceManagerInitializeEnabled: 1 + switchPlayerConnectionEnabled: 1 ps4NPAgeRating: 12 ps4NPTitleSecret: ps4NPTrophyPackPath: diff --git a/examples/button-clicker/ProjectSettings/ProjectVersion.txt b/examples/button-clicker/ProjectSettings/ProjectVersion.txt index a211ccd..7a6fffb 100644 --- a/examples/button-clicker/ProjectSettings/ProjectVersion.txt +++ b/examples/button-clicker/ProjectSettings/ProjectVersion.txt @@ -1 +1 @@ -m_EditorVersion: 2017.1.1f1 +m_EditorVersion: 2017.2.0f3 diff --git a/examples/button-clicker/UnityPackageManager/manifest.json b/examples/button-clicker/UnityPackageManager/manifest.json new file mode 100644 index 0000000..526aca6 --- /dev/null +++ b/examples/button-clicker/UnityPackageManager/manifest.json @@ -0,0 +1,4 @@ +{ + "dependencies": { + } +}