mirror of
https://github.com/unity-atoms/unity-atoms.git
synced 2025-01-22 08:08:51 -05:00
Added a debug logger
This commit is contained in:
parent
7f1a44a090
commit
3c35adae82
@ -2,6 +2,9 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityAtoms.Extensions;
|
||||
#if UNITY_EDITOR
|
||||
using UnityAtoms.Logger;
|
||||
#endif
|
||||
|
||||
namespace UnityAtoms
|
||||
{
|
||||
@ -24,7 +27,9 @@ namespace UnityAtoms
|
||||
{
|
||||
if (IsNotUsed == null)
|
||||
{
|
||||
Debug.LogWarning("IsUsed must be defined!");
|
||||
#if UNITY_EDITOR
|
||||
AtomsLogger.Warning("IsUsed must be defined when using GetUnusedGameObject");
|
||||
#endif
|
||||
}
|
||||
|
||||
return List.List.GetOrInstantiate(Prefab, position, quaternion, IsNotUsed.Call);
|
||||
|
8
Source/Logger.meta
Normal file
8
Source/Logger.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f57f1d91e8fe94dd19e2edf81ff68919
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
25
Source/Logger/AtomsLogger.cs
Normal file
25
Source/Logger/AtomsLogger.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityAtoms.Logger
|
||||
{
|
||||
public static class AtomsLogger
|
||||
{
|
||||
private const string logPrefix = "Unity Atoms :: ";
|
||||
|
||||
public static void Log(string msg)
|
||||
{
|
||||
Debug.Log(logPrefix + msg);
|
||||
}
|
||||
|
||||
public static void Warning(string msg)
|
||||
{
|
||||
Debug.LogWarning(logPrefix + msg);
|
||||
}
|
||||
|
||||
public static void Error(string msg)
|
||||
{
|
||||
Debug.LogError(logPrefix + msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
11
Source/Logger/AtomsLogger.cs.meta
Normal file
11
Source/Logger/AtomsLogger.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 16ed097ddeb0a4e598c4d0506251b733
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,14 +1,18 @@
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityAtoms.Examples
|
||||
{
|
||||
[CreateAssetMenu(menuName = "Unity Atoms/Examples/Intro/Health Logger")]
|
||||
public class HealthLogger : IntAction
|
||||
{
|
||||
public override void Do(int health)
|
||||
{
|
||||
Debug.Log("<3: " + health);
|
||||
}
|
||||
}
|
||||
}
|
||||
using UnityEngine;
|
||||
#if UNITY_EDITOR
|
||||
using UnityAtoms.Logger;
|
||||
#endif
|
||||
|
||||
namespace UnityAtoms.Examples
|
||||
{
|
||||
[CreateAssetMenu(menuName = "Unity Atoms/Examples/Intro/Health Logger")]
|
||||
public class HealthLogger : IntAction
|
||||
{
|
||||
public override void Do(int health)
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
AtomsLogger.Log("<3: " + health);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user