diff options
author | chai <chaifix@163.com> | 2021-07-27 09:40:26 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-07-27 09:40:26 +0800 |
commit | 8bbc03542340b4ea7ca1e2beec2f11ff335851e8 (patch) | |
tree | 15a4bdebe7b8d9448c476e0f67b94a5a50bc2ec5 /Assets/Scripts/Utils | |
parent | 4ceee84cd45e4e3ec40ebd888e41bd47a938c2d5 (diff) |
*mic
Diffstat (limited to 'Assets/Scripts/Utils')
-rw-r--r-- | Assets/Scripts/Utils/LogHelper.cs | 17 | ||||
-rw-r--r-- | Assets/Scripts/Utils/LogHelper.cs.meta | 11 | ||||
-rw-r--r-- | Assets/Scripts/Utils/UnityExtends.cs | 16 | ||||
-rw-r--r-- | Assets/Scripts/Utils/UnityExtends.cs.meta | 11 |
4 files changed, 55 insertions, 0 deletions
diff --git a/Assets/Scripts/Utils/LogHelper.cs b/Assets/Scripts/Utils/LogHelper.cs new file mode 100644 index 00000000..9c835bbe --- /dev/null +++ b/Assets/Scripts/Utils/LogHelper.cs @@ -0,0 +1,17 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public static class LogHelper +{ + public static void LogError(string msg) + { + Debug.LogError("[Erika] " + msg); + } + + public static void Log(string msg) + { + Debug.Log("[Erika] " + msg); + } + +} diff --git a/Assets/Scripts/Utils/LogHelper.cs.meta b/Assets/Scripts/Utils/LogHelper.cs.meta new file mode 100644 index 00000000..c8d1f167 --- /dev/null +++ b/Assets/Scripts/Utils/LogHelper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: dd089c734de45ce41b5d8cf87dfbd0bf +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Utils/UnityExtends.cs b/Assets/Scripts/Utils/UnityExtends.cs new file mode 100644 index 00000000..d1a66f48 --- /dev/null +++ b/Assets/Scripts/Utils/UnityExtends.cs @@ -0,0 +1,16 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public static class UnityExtends +{ + public static T GetOrAddComponent<T>(this GameObject go) where T : MonoBehaviour + { + T component = go.GetComponent<T>(); + if (component == null) + component = go.AddComponent<T>(); + return component; + } + + +} diff --git a/Assets/Scripts/Utils/UnityExtends.cs.meta b/Assets/Scripts/Utils/UnityExtends.cs.meta new file mode 100644 index 00000000..44139deb --- /dev/null +++ b/Assets/Scripts/Utils/UnityExtends.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3d655d75a9052fa499fa925877bb9340 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: |