添加debug工具
This commit is contained in:
@ -0,0 +1,54 @@
|
||||
#if !UNITY_EDITOR && UNITY_ANDROID
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
// Credit: https://stackoverflow.com/a/41018028/2373034
|
||||
namespace IngameDebugConsole
|
||||
{
|
||||
public class DebugLogLogcatListener : AndroidJavaProxy
|
||||
{
|
||||
private Queue<string> queuedLogs;
|
||||
private AndroidJavaObject nativeObject;
|
||||
|
||||
public DebugLogLogcatListener() : base( "com.yasirkula.unity.DebugConsoleLogcatLogReceiver" )
|
||||
{
|
||||
queuedLogs = new Queue<string>( 16 );
|
||||
}
|
||||
|
||||
~DebugLogLogcatListener()
|
||||
{
|
||||
Stop();
|
||||
|
||||
if( nativeObject != null )
|
||||
nativeObject.Dispose();
|
||||
}
|
||||
|
||||
public void Start( string arguments )
|
||||
{
|
||||
if( nativeObject == null )
|
||||
nativeObject = new AndroidJavaObject( "com.yasirkula.unity.DebugConsoleLogcatLogger" );
|
||||
|
||||
nativeObject.Call( "Start", this, arguments );
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
if( nativeObject != null )
|
||||
nativeObject.Call( "Stop" );
|
||||
}
|
||||
|
||||
public void OnLogReceived( string log )
|
||||
{
|
||||
queuedLogs.Enqueue( log );
|
||||
}
|
||||
|
||||
public string GetLog()
|
||||
{
|
||||
if( queuedLogs.Count > 0 )
|
||||
return queuedLogs.Dequeue();
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dd3b7385882055d4a8c2b91deb6b2470
|
||||
timeCreated: 1510076185
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
BIN
Assets/Plugins/IngameDebugConsole/Android/IngameDebugConsole.aar
Normal file
BIN
Assets/Plugins/IngameDebugConsole/Android/IngameDebugConsole.aar
Normal file
Binary file not shown.
@ -0,0 +1,33 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bf909fab1c14af446b0a854de42289b2
|
||||
timeCreated: 1510086220
|
||||
licenseType: Free
|
||||
PluginImporter:
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
platformData:
|
||||
data:
|
||||
first:
|
||||
Android: Android
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
data:
|
||||
first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
data:
|
||||
first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user