feat:1、添加项目

This commit is contained in:
2026-06-02 10:26:44 +08:00
commit dfead2c461
7518 changed files with 748693 additions and 0 deletions
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 993d153cb945c41439ff18e397de1d73
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN-->
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.unity3d.player"
xmlns:tools="http://schemas.android.com/tools">
<application>
<activity android:name="com.unity3d.player.UnityPlayerActivity"
android:theme="@style/UnityThemeSelector">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
</activity>
</application>
</manifest>
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 5eea3d4fa71d3594ebc484be36832997
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,32 @@
fileFormatVersion: 2
guid: 480ab794634c2944d944c5f3ac5cf15e
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Android: Android
second:
enabled: 1
settings: {}
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.firebase.app.unity"
android:versionCode="1"
android:versionName="1.0">
</manifest>
@@ -0,0 +1,2 @@
target=android-9
android.library=true
@@ -0,0 +1,9 @@
<?xml version='1.0' encoding='utf-8'?>
<resources xmlns:tools="http://schemas.android.com/tools" tools:keep="@string/gcm_defaultSenderId,@string/google_storage_bucket,@string/project_id,@string/google_api_key,@string/google_crash_reporting_api_key,@string/google_app_id">
<string name="gcm_defaultSenderId" translatable="false">339238925993</string>
<string name="google_storage_bucket" translatable="false">ball-kingdom-crush.firebasestorage.app</string>
<string name="project_id" translatable="false">ball-kingdom-crush</string>
<string name="google_api_key" translatable="false">AIzaSyDxHji1beIuNjNbilpGCU8Knn_e7uPZO4Q</string>
<string name="google_crash_reporting_api_key" translatable="false">AIzaSyDxHji1beIuNjNbilpGCU8Knn_e7uPZO4Q</string>
<string name="google_app_id" translatable="false">1:339238925993:android:811016faebac0501da5bb8</string>
</resources>
@@ -0,0 +1,32 @@
fileFormatVersion: 2
guid: 49cafa14e5e14ad4399fe1dd0918f35c
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Android: Android
second:
enabled: 1
settings: {}
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.firebase.crashlytics.unity"
android:versionCode="1"
android:versionName="1.0">
</manifest>
@@ -0,0 +1,2 @@
target=android-9
android.library=true
@@ -0,0 +1 @@
<?xml version="1.0" encoding="utf-8"?><resources><string name="com.crashlytics.android.build_id" translatable="false">7ee01aac-7ff8-45e0-af00-e878e21c22e1</string></resources>
@@ -0,0 +1 @@
<?xml version="1.0" encoding="utf-8"?><resources><string name="com.google.firebase.crashlytics.unity_version" translatable="false">2022.3.62f2</string></resources>
@@ -0,0 +1,32 @@
fileFormatVersion: 2
guid: bc7ca36701d22f14ab56cac8b3fd7d74
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Android: Android
second:
enabled: 1
settings: {}
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.google.unity.ads">
<uses-sdk android:minSdkVersion="23" />
<uses-permission android:name="android.permission.INTERNET" />
<application>
<uses-library android:required="false" android:name="org.apache.http.legacy" />
<meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="ca-app-pub-3940256099942544~3347511713" />
<meta-data android:name="com.google.unity.ads.UNITY_VERSION" android:value="2022.3.62f2" />
</application>
</manifest>
@@ -0,0 +1,5 @@
android {
packagingOptions {
pickFirst "META-INF/kotlinx_coroutines_core.version"
}
}
@@ -0,0 +1,2 @@
target=android-31
android.library=true
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN-->
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.unity3d.player"
xmlns:tools="http://schemas.android.com/tools"
android:installLocation="preferExternal">
<supports-screens
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:xlargeScreens="true"
android:anyDensity="true"/>
<application android:extractNativeLibs="true"
android:label="@string/app_name"
android:icon="@mipmap/app_icon"/>
</manifest>
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 7409fae52bf1254479ea33489af7c957
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,82 @@
/*
* This file is generated by the FirebaseMessagingActivityGenerator script.
* Refer to that script for more information.
*/
package com.google.firebase;
import android.content.Intent;
import android.os.Bundle;
import com.google.firebase.messaging.MessageForwardingService;
import com.unity3d.player.UnityPlayerActivity;
/**
* MessagingUnityPlayerActivity is a UnityPlayerActivity that updates its intent when new intents
* are sent to it.
*
* This is a workaround for a known issue that prevents Firebase Cloud Messaging from responding to
* data payloads when both a data and notification payload are sent to the app while it is in the
* background.
*/
public class MessagingUnityPlayerActivity extends UnityPlayerActivity {
// The key in the intent's extras that maps to the incoming message's message ID. Only sent by
// the server, GmsCore sends EXTRA_MESSAGE_ID_KEY below. Server can't send that as it would get
// stripped by the client.
private static final String EXTRA_MESSAGE_ID_KEY_SERVER = "message_id";
// An alternate key value in the intent's extras that also maps to the incoming message's message
// ID. Used by upstream, and set by GmsCore.
private static final String EXTRA_MESSAGE_ID_KEY = "google.message_id";
// The key in the intent's extras that maps to the incoming message's sender value.
private static final String EXTRA_FROM = "google.message_id";
/**
* Workaround for when a message is sent containing both a Data and Notification payload.
*
* <p>When the app is in the background, if a message with both a data and notification payload is
* received the data payload is stored on the Intent passed to onNewIntent. By default, that
* intent does not get set as the Intent that started the app, so when the app comes back online
* it doesn't see a new FCM message to respond to. As a workaround, we override onNewIntent so
* that it sends the intent to the MessageForwardingService which forwards the message to the
* FirebaseMessagingService which in turn sends the message to the application.
*/
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
// If we do not have a 'from' field this intent was not a message and should not be handled. It
// probably means this intent was fired by tapping on the app icon.
Bundle extras = intent.getExtras();
if (extras == null) {
return;
}
String from = extras.getString(EXTRA_FROM);
String messageId = extras.getString(EXTRA_MESSAGE_ID_KEY);
if (messageId == null) {
messageId = extras.getString(EXTRA_MESSAGE_ID_KEY_SERVER);
}
if (from != null && messageId != null) {
Intent message = new Intent(this, MessageForwardingService.class);
message.setAction(MessageForwardingService.ACTION_REMOTE_INTENT);
message.putExtras(intent);
message.setData(intent.getData());
MessageForwardingService.enqueueWork(this, message);
}
setIntent(intent);
}
/**
* Dispose of the mUnityPlayer when restarting the app.
*
* <p>This ensures that when the app starts up again it does not start with stale data.
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
if (mUnityPlayer != null) {
mUnityPlayer.quit();
mUnityPlayer = null;
}
super.onCreate(savedInstanceState);
}
}
@@ -0,0 +1,34 @@
fileFormatVersion: 2
guid: 2bfe1e2f6ccf50649b6b50becea1293f
labels:
- FirebaseMessagingActivityGenerated
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Android: Android
second:
enabled: 1
settings: {}
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.
@@ -0,0 +1,32 @@
fileFormatVersion: 2
guid: 83ac6835a57b65c46baf954874e80de1
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Android: Android
second:
enabled: 1
settings: {}
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 59b3f9343bdac42318926c7944365bb9
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: ea6387b3379b4458498b339bcd316c7c
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,18 @@
buildscript {
dependencies {
classpath("com.android.tools:r8:8.2.42") // Fix R8
}
}
plugins {
// If you are changing the Android Gradle Plugin version, make sure it is compatible with the Gradle version preinstalled with Unity
// See which Gradle version is preinstalled with Unity here https://docs.unity3d.com/Manual/android-gradle-overview.html
// See official Gradle and Android Gradle Plugin compatibility table here https://developer.android.com/studio/releases/gradle-plugin#updating-gradle
// To specify a custom Gradle version in Unity, go do "Preferences > External Tools", uncheck "Gradle Installed with Unity (recommended)" and specify a path to a custom Gradle version
id 'com.android.application' version '7.4.2' apply false
id 'com.android.library' version '7.4.2' apply false
**BUILD_SCRIPT_DEPS**
}
task clean(type: Delete) {
delete rootProject.buildDir
}
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 3a51beb565bd11c4dbe803d326570b88
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 70fc6af576ac24f6aa283eecbf393621
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.
@@ -0,0 +1,81 @@
fileFormatVersion: 2
guid: c318684db3e949ee938fbe37ab78acbb
labels:
- gvh
- gvh_version-10.6.0
- gvhp_exportpath-Plugins/Android/googlemobileads-unity.aar
timeCreated: 1480838400
PluginImporter:
serializedVersion: 1
iconMap: {}
executionOrder: {}
isPreloaded: 0
platformData:
Android:
enabled: 1
settings:
CPU: AnyCPU
Any:
enabled: 0
settings: {}
Editor:
enabled: 1
settings:
CPU: AnyCPU
DefaultValueInitialized: true
OS: AnyOS
Linux:
enabled: 1
settings:
CPU: x86
Linux64:
enabled: 1
settings:
CPU: x86_64
LinuxUniversal:
enabled: 1
settings:
CPU: AnyCPU
OSXIntel:
enabled: 1
settings:
CPU: x86
OSXIntel64:
enabled: 1
settings:
CPU: x86_64
OSXUniversal:
enabled: 1
settings:
CPU: AnyCPU
Web:
enabled: 0
settings: {}
WebStreamed:
enabled: 0
settings: {}
Win:
enabled: 1
settings:
CPU: x86
Win64:
enabled: 1
settings:
CPU: x86_64
WindowsStoreApps:
enabled: 0
settings:
CPU: AnyCPU
iOS:
enabled: 0
settings:
CompileFlags:
FrameworkDependencies:
tvOS:
enabled: 0
settings:
CompileFlags:
FrameworkDependencies:
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,12 @@
org.gradle.jvmargs=-Xmx**JVM_HEAP_SIZE**M
org.gradle.parallel=true
unityStreamingAssets=**STREAMING_ASSETS**
# Android Resolver Properties Start
android.useAndroidX=true
android.enableJetifier=true
# Android Resolver Properties End
**ADDITIONAL_PROPERTIES**
android.jetifier.ignorelist=annotation-experimental-1.4.0.aar
android.enableLint=false
android.lint.disableLintTasks=true
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 40825427c859b6746a5509597a58a1f2
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,64 @@
apply plugin: 'com.android.application'
dependencies {
implementation 'androidx.multidex:multidex:2.0.1'
implementation project(':unityLibrary')
}
android {
namespace "**NAMESPACE**"
ndkPath "**NDKPATH**"
compileSdkVersion **APIVERSION**
buildToolsVersion '**BUILDTOOLS**'
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
defaultConfig {
minSdkVersion **MINSDKVERSION**
targetSdkVersion **TARGETSDKVERSION**
applicationId '**APPLICATIONID**'
ndk {
abiFilters **ABIFILTERS**
}
versionCode **VERSIONCODE**
versionName '**VERSIONNAME**'
multiDexEnabled true // 添加
}
aaptOptions {
noCompress = **BUILTIN_NOCOMPRESS** + unityStreamingAssets.tokenize(', ')
ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:!CVS:!thumbs.db:!picasa.ini:!*~"
}**SIGN**
lintOptions {
abortOnError false
}
buildTypes {
debug {
minifyEnabled **MINIFY_DEBUG**
proguardFiles getDefaultProguardFile('proguard-android.txt')**SIGNCONFIG**
jniDebuggable true
}
release {
minifyEnabled **MINIFY_RELEASE**
proguardFiles getDefaultProguardFile('proguard-android.txt')**SIGNCONFIG**
}
}**PACKAGING_OPTIONS****PLAY_ASSET_PACKS****SPLITS**
**BUILT_APK_LOCATION**
bundle {
language {
enableSplit = false
}
density {
enableSplit = false
}
abi {
enableSplit = true
}
}
}**SPLITS_VERSION_CODE****LAUNCHER_SOURCE_BUILD_SETUP**
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 9e912912ee5108e4992059f4898a1c5d
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: ce27eea5dc4d2994090175237f56e154
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,50 @@
pluginManagement {
repositories {
**ARTIFACTORYREPOSITORY**
gradlePluginPortal()
google()
mavenCentral()
}
}
include ':launcher', ':unityLibrary'
**INCLUDES**
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
repositories {
**ARTIFACTORYREPOSITORY**
google()
mavenCentral()
// Android Resolver Repos Start
maven {
url "https://artifactory.bidmachine.io/bidmachine" // Assets/ThinkupTpnPlugin/AnyThinkAds/Plugins/Android/NonChina/mediation/bidmachine/Editor/Dependencies.xml:5
}
maven {
url "https://cboost.jfrog.io/artifactory/chartboost-ads" // Assets/ThinkupTpnPlugin/AnyThinkAds/Plugins/Android/NonChina/mediation/chartboost/Editor/Dependencies.xml:6
}
maven {
url "https://cboost.jfrog.io/artifactory/chartboost-mediation" // Assets/ThinkupTpnPlugin/AnyThinkAds/Plugins/Android/NonChina/mediation/chartboost/Editor/Dependencies.xml:6
}
maven {
url "https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea" // Assets/ThinkupTpnPlugin/AnyThinkAds/Plugins/Android/NonChina/mediation/gtm/Editor/Dependencies.xml:5
}
maven {
url "https://android-sdk.is.com/" // Assets/ThinkupTpnPlugin/AnyThinkAds/Plugins/Android/NonChina/mediation/ironsource/Editor/Dependencies.xml:5
}
maven {
url "https://artifact.bytedance.com/repository/pangle" // Assets/ThinkupTpnPlugin/AnyThinkAds/Plugins/Android/NonChina/mediation/pangle/Editor/Dependencies.xml:5
}
maven {
url "file:///C:/WorkSpace/tron_gp/BallCrushBest_GP/Assets/GeneratedLocalRepo/Firebase/m2repository" // Assets/Firebase/Editor/AnalyticsDependencies.xml:18, Assets/Firebase/Editor/AppDependencies.xml:22, Assets/Firebase/Editor/CrashlyticsDependencies.xml:20, Assets/Firebase/Editor/MessagingDependencies.xml:24
}
maven {
url "https://maven.aliyun.com/repository/google" // Assets/GoogleMobileAds/Editor/GoogleMobileAdsDependencies.xml:7, Assets/GoogleMobileAds/Editor/GoogleMobileAdsDependencies.xml:12, Assets/GoogleMobileAds/Editor/GoogleMobileAdsDependencies.xml:17, Assets/GoogleMobileAds/Editor/GoogleUmpDependencies.xml:7
}
mavenLocal()
// Android Resolver Repos End
flatDir {
dirs "${project(':unityLibrary').projectDir}/libs"
}
}
}
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: a08fd354071782f4fb8aa5efd09c9867
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5415c2bc4488c42739b36767bc7f8c83
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,539 @@
#if UNITY_EDITOR
using System.Collections.Generic;
using System.Collections;
using System.IO;
using System.Reflection;
using System.Text.RegularExpressions;
using System.Text;
using System.Xml;
using System;
using UnityEditor.Android;
#if UNITY_2018_1_OR_NEWER
using UnityEditor.Build;
#endif
using UnityEditor.Callbacks;
using UnityEditor;
using UnityEngine;
#if UNITY_2018_1_OR_NEWER
public class UnityWebViewPostprocessBuild : IPreprocessBuild, IPostGenerateGradleAndroidProject
#else
public class UnityWebViewPostprocessBuild
#endif
{
private static bool nofragment = false;
//// for android/unity 2018.1 or newer
//// cf. https://forum.unity.com/threads/android-hardwareaccelerated-is-forced-false-in-all-activities.532786/
//// cf. https://github.com/Over17/UnityAndroidManifestCallback
#if UNITY_2018_1_OR_NEWER
public void OnPreprocessBuild(BuildTarget buildTarget, string path) {
if (buildTarget == BuildTarget.Android) {
var dev = "Packages/net.gree.unity-webview/Assets/Plugins/Android/WebViewPlugin-development.aar.tmpl";
var rel = "Packages/net.gree.unity-webview/Assets/Plugins/Android/WebViewPlugin-release.aar.tmpl";
if (!File.Exists(dev) || !File.Exists(rel)) {
dev = "Assets/Plugins/Android/WebViewPlugin-development.aar.tmpl";
rel = "Assets/Plugins/Android/WebViewPlugin-release.aar.tmpl";
}
var src = (EditorUserBuildSettings.development) ? dev : rel;
//Directory.CreateDirectory("Temp/StagingArea/aar");
//File.Copy(src, "Temp/StagingArea/aar/WebViewPlugin.aar", true);
Directory.CreateDirectory("Assets/Plugins/Android");
File.Copy(src, "Assets/Plugins/Android/WebViewPlugin.aar", true);
}
}
public void OnPostGenerateGradleAndroidProject(string basePath) {
var changed = false;
var androidManifest = new AndroidManifest(GetManifestPath(basePath));
if (!nofragment) {
changed = (androidManifest.AddFileProvider(basePath) || changed);
{
var path = GetBuildGradlePath(basePath);
var lines0 = File.ReadAllText(path).Replace("\r\n", "\n").Replace("\r", "\n").Split(new[]{'\n'});
{
var lines = new List<string>();
var independencies = false;
foreach (var line in lines0) {
if (line == "dependencies {") {
independencies = true;
} else if (independencies && line == "}") {
independencies = false;
lines.Add(" implementation 'androidx.core:core:1.6.0'");
} else if (independencies) {
if (line.Contains("implementation(name: 'core")
|| line.Contains("implementation(name: 'androidx.core.core")
|| line.Contains("implementation 'androidx.core:core")) {
break;
}
}
lines.Add(line);
}
if (lines.Count > lines0.Length) {
File.WriteAllText(path, string.Join("\n", lines) + "\n");
}
}
}
{
var path = GetGradlePropertiesPath(basePath);
var lines0 = "";
var lines = "";
if (File.Exists(path)) {
lines0 = File.ReadAllText(path).Replace("\r\n", "\n").Replace("\r", "\n") + "\n";
lines = lines0;
}
if (!lines.Contains("android.useAndroidX=true")) {
lines += "android.useAndroidX=true\n";
}
if (!lines.Contains("android.enableJetifier=true")) {
lines += "android.enableJetifier=true\n";
}
if (lines != lines0) {
File.WriteAllText(path, lines);
}
}
}
changed = (androidManifest.SetExported(true) || changed);
changed = (androidManifest.SetWindowSoftInputMode("adjustPan") || changed);
changed = (androidManifest.SetHardwareAccelerated(true) || changed);
#if UNITYWEBVIEW_ANDROID_USES_CLEARTEXT_TRAFFIC
changed = (androidManifest.SetUsesCleartextTraffic(true) || changed);
#endif
#if UNITYWEBVIEW_ANDROID_ENABLE_CAMERA
changed = (androidManifest.AddCamera() || changed);
changed = (androidManifest.AddGallery() || changed);
#endif
#if UNITYWEBVIEW_ANDROID_ENABLE_MICROPHONE
changed = (androidManifest.AddMicrophone() || changed);
#endif
if (changed) {
androidManifest.Save();
Debug.Log("unitywebview: adjusted AndroidManifest.xml.");
}
}
#endif
public int callbackOrder {
get {
return 1;
}
}
private string GetManifestPath(string basePath) {
var pathBuilder = new StringBuilder(basePath);
pathBuilder.Append(Path.DirectorySeparatorChar).Append("src");
pathBuilder.Append(Path.DirectorySeparatorChar).Append("main");
pathBuilder.Append(Path.DirectorySeparatorChar).Append("AndroidManifest.xml");
return pathBuilder.ToString();
}
private string GetBuildGradlePath(string basePath) {
var pathBuilder = new StringBuilder(basePath);
pathBuilder.Append(Path.DirectorySeparatorChar).Append("build.gradle");
return pathBuilder.ToString();
}
private string GetGradlePropertiesPath(string basePath) {
var pathBuilder = new StringBuilder(basePath);
if (basePath.EndsWith("unityLibrary")) {
pathBuilder.Append(Path.DirectorySeparatorChar).Append("..");
}
pathBuilder.Append(Path.DirectorySeparatorChar).Append("gradle.properties");
return pathBuilder.ToString();
}
//// for others
[PostProcessBuild(100)]
public static void OnPostprocessBuild(BuildTarget buildTarget, string path) {
#if UNITY_2018_1_OR_NEWER
try {
File.Delete("Assets/Plugins/Android/WebViewPlugin.aar");
File.Delete("Assets/Plugins/Android/WebViewPlugin.aar.meta");
Directory.Delete("Assets/Plugins/Android");
File.Delete("Assets/Plugins/Android.meta");
Directory.Delete("Assets/Plugins");
File.Delete("Assets/Plugins.meta");
} catch (Exception) {
}
#else
if (buildTarget == BuildTarget.Android) {
string manifest = Path.Combine(Application.dataPath, "Plugins/Android/AndroidManifest.xml");
if (!File.Exists(manifest)) {
string manifest0 = Path.Combine(Application.dataPath, "../Temp/StagingArea/AndroidManifest-main.xml");
if (!File.Exists(manifest0)) {
Debug.LogError("unitywebview: cannot find both Assets/Plugins/Android/AndroidManifest.xml and Temp/StagingArea/AndroidManifest-main.xml. please build the app to generate Assets/Plugins/Android/AndroidManifest.xml and then rebuild it again.");
return;
} else {
File.Copy(manifest0, manifest, true);
}
}
var changed = false;
if (EditorUserBuildSettings.development) {
if (!File.Exists("Assets/Plugins/Android/WebView.aar")
|| !File.ReadAllBytes("Assets/Plugins/Android/WebView.aar").SequenceEqual(File.ReadAllBytes("Assets/Plugins/Android/WebViewPlugin-development.aar.tmpl"))) {
File.Copy("Assets/Plugins/Android/WebViewPlugin-development.aar.tmpl", "Assets/Plugins/Android/WebView.aar", true);
changed = true;
}
} else {
if (!File.Exists("Assets/Plugins/Android/WebView.aar")
|| !File.ReadAllBytes("Assets/Plugins/Android/WebView.aar").SequenceEqual(File.ReadAllBytes("Assets/Plugins/Android/WebViewPlugin-release.aar.tmpl"))) {
File.Copy("Assets/Plugins/Android/WebViewPlugin-release.aar.tmpl", "Assets/Plugins/Android/WebView.aar", true);
changed = true;
}
}
var androidManifest = new AndroidManifest(manifest);
if (!nofragment) {
changed = (androidManifest.AddFileProvider("Assets/Plugins/Android") || changed);
var files = Directory.GetFiles("Assets/Plugins/Android/");
var found = false;
foreach (var file in files) {
if (Regex.IsMatch(file, @"^Assets/Plugins/Android/(androidx\.core\.)?core-.*.aar$")) {
found = true;
break;
}
}
if (!found) {
foreach (var file in files) {
var match = Regex.Match(file, @"^Assets/Plugins/Android/(core.*.aar).tmpl$");
if (match.Success) {
var name = match.Groups[1].Value;
File.Copy(file, "Assets/Plugins/Android/" + name, true);
break;
}
}
}
}
changed = (androidManifest.SetWindowSoftInputMode("adjustPan") || changed);
changed = (androidManifest.SetHardwareAccelerated(true) || changed);
#if UNITYWEBVIEW_ANDROID_USES_CLEARTEXT_TRAFFIC
changed = (androidManifest.SetUsesCleartextTraffic(true) || changed);
#endif
#if UNITYWEBVIEW_ANDROID_ENABLE_CAMERA
changed = (androidManifest.AddCamera() || changed);
changed = (androidManifest.AddGallery() || changed);
#endif
#if UNITYWEBVIEW_ANDROID_ENABLE_MICROPHONE
changed = (androidManifest.AddMicrophone() || changed);
#endif
#if UNITY_5_6_0 || UNITY_5_6_1
changed = (androidManifest.SetActivityName("net.gree.unitywebview.CUnityPlayerActivity") || changed);
#endif
if (changed) {
androidManifest.Save();
Debug.LogError("unitywebview: adjusted AndroidManifest.xml and/or WebView.aar. Please rebuild the app.");
}
}
#endif
if (buildTarget == BuildTarget.iOS) {
string projPath = path + "/Unity-iPhone.xcodeproj/project.pbxproj";
var type = Type.GetType("UnityEditor.iOS.Xcode.PBXProject, UnityEditor.iOS.Extensions.Xcode");
if (type == null)
{
Debug.LogError("unitywebview: failed to get PBXProject. please install iOS build support.");
return;
}
var src = File.ReadAllText(projPath);
//dynamic proj = type.GetConstructor(Type.EmptyTypes).Invoke(null);
var proj = type.GetConstructor(Type.EmptyTypes).Invoke(null);
//proj.ReadFromString(src);
{
var method = type.GetMethod("ReadFromString");
method.Invoke(proj, new object[]{src});
}
var target = "";
#if UNITY_2019_3_OR_NEWER
//target = proj.GetUnityFrameworkTargetGuid();
{
var method = type.GetMethod("GetUnityFrameworkTargetGuid");
target = (string)method.Invoke(proj, null);
}
#else
//target = proj.TargetGuidByName("Unity-iPhone");
{
var method = type.GetMethod("TargetGuidByName");
target = (string)method.Invoke(proj, new object[]{"Unity-iPhone"});
}
#endif
//proj.AddFrameworkToProject(target, "WebKit.framework", false);
{
var method = type.GetMethod("AddFrameworkToProject");
method.Invoke(proj, new object[]{target, "WebKit.framework", false});
}
var cflags = "";
if (EditorUserBuildSettings.development) {
cflags += " -DUNITYWEBVIEW_DEVELOPMENT";
}
#if UNITYWEBVIEW_IOS_ALLOW_FILE_URLS
cflags += " -DUNITYWEBVIEW_IOS_ALLOW_FILE_URLS";
#endif
cflags = cflags.Trim();
if (!string.IsNullOrEmpty(cflags)) {
// proj.AddBuildProperty(target, "OTHER_LDFLAGS", cflags);
var method = type.GetMethod("AddBuildProperty", new Type[]{typeof(string), typeof(string), typeof(string)});
method.Invoke(proj, new object[]{target, "OTHER_CFLAGS", cflags});
}
var dst = "";
//dst = proj.WriteToString();
{
var method = type.GetMethod("WriteToString");
dst = (string)method.Invoke(proj, null);
}
File.WriteAllText(projPath, dst);
}
}
}
internal class AndroidXmlDocument : XmlDocument {
private string m_Path;
protected XmlNamespaceManager nsMgr;
public readonly string AndroidXmlNamespace = "http://schemas.android.com/apk/res/android";
public AndroidXmlDocument(string path) {
m_Path = path;
using (var reader = new XmlTextReader(m_Path)) {
reader.Read();
Load(reader);
}
nsMgr = new XmlNamespaceManager(NameTable);
nsMgr.AddNamespace("android", AndroidXmlNamespace);
}
public string Save() {
return SaveAs(m_Path);
}
public string SaveAs(string path) {
using (var writer = new XmlTextWriter(path, new UTF8Encoding(false))) {
writer.Formatting = Formatting.Indented;
Save(writer);
}
return path;
}
}
internal class AndroidManifest : AndroidXmlDocument {
private readonly XmlElement ManifestElement;
private readonly XmlElement ApplicationElement;
public AndroidManifest(string path) : base(path) {
ManifestElement = SelectSingleNode("/manifest") as XmlElement;
ApplicationElement = SelectSingleNode("/manifest/application") as XmlElement;
}
private XmlAttribute CreateAndroidAttribute(string key, string value) {
XmlAttribute attr = CreateAttribute("android", key, AndroidXmlNamespace);
attr.Value = value;
return attr;
}
internal XmlNode GetActivityWithLaunchIntent() {
return
SelectSingleNode(
"/manifest/application/activity[intent-filter/action/@android:name='android.intent.action.MAIN' and "
+ "intent-filter/category/@android:name='android.intent.category.LAUNCHER']",
nsMgr);
}
internal bool SetUsesCleartextTraffic(bool enabled) {
// android:usesCleartextTraffic
bool changed = false;
if (ApplicationElement.GetAttribute("usesCleartextTraffic", AndroidXmlNamespace) != ((enabled) ? "true" : "false")) {
ApplicationElement.SetAttribute("usesCleartextTraffic", AndroidXmlNamespace, (enabled) ? "true" : "false");
changed = true;
}
return changed;
}
// for api level 33
internal bool SetExported(bool enabled) {
bool changed = false;
var activity = GetActivityWithLaunchIntent() as XmlElement;
if (activity.GetAttribute("exported", AndroidXmlNamespace) != ((enabled) ? "true" : "false")) {
activity.SetAttribute("exported", AndroidXmlNamespace, (enabled) ? "true" : "false");
changed = true;
}
return changed;
}
internal bool SetWindowSoftInputMode(string mode) {
bool changed = false;
var activity = GetActivityWithLaunchIntent() as XmlElement;
if (activity.GetAttribute("windowSoftInputMode", AndroidXmlNamespace) != mode) {
activity.SetAttribute("windowSoftInputMode", AndroidXmlNamespace, mode);
changed = true;
}
return changed;
}
internal bool SetHardwareAccelerated(bool enabled) {
bool changed = false;
var activity = GetActivityWithLaunchIntent() as XmlElement;
if (activity.GetAttribute("hardwareAccelerated", AndroidXmlNamespace) != ((enabled) ? "true" : "false")) {
activity.SetAttribute("hardwareAccelerated", AndroidXmlNamespace, (enabled) ? "true" : "false");
changed = true;
}
return changed;
}
internal bool SetActivityName(string name) {
bool changed = false;
var activity = GetActivityWithLaunchIntent() as XmlElement;
if (activity.GetAttribute("name", AndroidXmlNamespace) != name) {
activity.SetAttribute("name", AndroidXmlNamespace, name);
changed = true;
}
return changed;
}
internal bool AddFileProvider(string basePath) {
bool changed = false;
var authorities = PlayerSettings.applicationIdentifier + ".unitywebview.fileprovider";
if (SelectNodes("/manifest/application/provider[@android:authorities='" + authorities + "']", nsMgr).Count == 0) {
var elem = CreateElement("provider");
elem.Attributes.Append(CreateAndroidAttribute("name", "androidx.core.content.FileProvider"));
elem.Attributes.Append(CreateAndroidAttribute("authorities", authorities));
elem.Attributes.Append(CreateAndroidAttribute("exported", "false"));
elem.Attributes.Append(CreateAndroidAttribute("grantUriPermissions", "true"));
var meta = CreateElement("meta-data");
meta.Attributes.Append(CreateAndroidAttribute("name", "android.support.FILE_PROVIDER_PATHS"));
meta.Attributes.Append(CreateAndroidAttribute("resource", "@xml/unitywebview_file_provider_paths"));
elem.AppendChild(meta);
ApplicationElement.AppendChild(elem);
changed = true;
var xml = GetFileProviderSettingPath(basePath);
if (!File.Exists(xml)) {
Directory.CreateDirectory(Path.GetDirectoryName(xml));
File.WriteAllText(
xml,
"<paths xmlns:android=\"http://schemas.android.com/apk/res/android\">\n" +
" <external-path name=\"unitywebview_file_provider_images\" path=\".\"/>\n" +
"</paths>\n");
}
}
return changed;
}
private string GetFileProviderSettingPath(string basePath) {
var pathBuilder = new StringBuilder(basePath);
pathBuilder.Append(Path.DirectorySeparatorChar).Append("src");
pathBuilder.Append(Path.DirectorySeparatorChar).Append("main");
pathBuilder.Append(Path.DirectorySeparatorChar).Append("res");
pathBuilder.Append(Path.DirectorySeparatorChar).Append("xml");
pathBuilder.Append(Path.DirectorySeparatorChar).Append("unitywebview_file_provider_paths.xml");
return pathBuilder.ToString();
}
internal bool AddCamera() {
bool changed = false;
if (SelectNodes("/manifest/uses-permission[@android:name='android.permission.CAMERA']", nsMgr).Count == 0) {
var elem = CreateElement("uses-permission");
elem.Attributes.Append(CreateAndroidAttribute("name", "android.permission.CAMERA"));
ManifestElement.AppendChild(elem);
changed = true;
}
if (SelectNodes("/manifest/uses-feature[@android:name='android.hardware.camera']", nsMgr).Count == 0) {
var elem = CreateElement("uses-feature");
elem.Attributes.Append(CreateAndroidAttribute("name", "android.hardware.camera"));
ManifestElement.AppendChild(elem);
changed = true;
}
// cf. https://developer.android.com/training/data-storage/shared/media#media-location-permission
if (SelectNodes("/manifest/uses-permission[@android:name='android.permission.ACCESS_MEDIA_LOCATION']", nsMgr).Count == 0) {
var elem = CreateElement("uses-permission");
elem.Attributes.Append(CreateAndroidAttribute("name", "android.permission.ACCESS_MEDIA_LOCATION"));
ManifestElement.AppendChild(elem);
changed = true;
}
// cf. https://developer.android.com/training/package-visibility/declaring
if (SelectNodes("/manifest/queries", nsMgr).Count == 0) {
var elem = CreateElement("queries");
ManifestElement.AppendChild(elem);
changed = true;
}
if (SelectNodes("/manifest/queries/intent/action[@android:name='android.media.action.IMAGE_CAPTURE']", nsMgr).Count == 0) {
var action = CreateElement("action");
action.Attributes.Append(CreateAndroidAttribute("name", "android.media.action.IMAGE_CAPTURE"));
var intent = CreateElement("intent");
intent.AppendChild(action);
var queries = SelectSingleNode("/manifest/queries") as XmlElement;
queries.AppendChild(intent);
changed = true;
}
return changed;
}
internal bool AddGallery() {
bool changed = false;
// for api level 33
if (SelectNodes("/manifest/uses-permission[@android:name='android.permission.READ_MEDIA_IMAGES']", nsMgr).Count == 0) {
var elem = CreateElement("uses-permission");
elem.Attributes.Append(CreateAndroidAttribute("name", "android.permission.READ_MEDIA_IMAGES"));
ManifestElement.AppendChild(elem);
changed = true;
}
if (SelectNodes("/manifest/uses-permission[@android:name='android.permission.READ_MEDIA_VIDEO']", nsMgr).Count == 0) {
var elem = CreateElement("uses-permission");
elem.Attributes.Append(CreateAndroidAttribute("name", "android.permission.READ_MEDIA_VIDEO"));
ManifestElement.AppendChild(elem);
changed = true;
}
if (SelectNodes("/manifest/uses-permission[@android:name='android.permission.READ_MEDIA_AUDIO']", nsMgr).Count == 0) {
var elem = CreateElement("uses-permission");
elem.Attributes.Append(CreateAndroidAttribute("name", "android.permission.READ_MEDIA_AUDIO"));
ManifestElement.AppendChild(elem);
changed = true;
}
// cf. https://developer.android.com/training/package-visibility/declaring
if (SelectNodes("/manifest/queries", nsMgr).Count == 0) {
var elem = CreateElement("queries");
ManifestElement.AppendChild(elem);
changed = true;
}
if (SelectNodes("/manifest/queries/intent/action[@android:name='android.media.action.GET_CONTENT']", nsMgr).Count == 0) {
var action = CreateElement("action");
action.Attributes.Append(CreateAndroidAttribute("name", "android.media.action.GET_CONTENT"));
var intent = CreateElement("intent");
intent.AppendChild(action);
var queries = SelectSingleNode("/manifest/queries") as XmlElement;
queries.AppendChild(intent);
changed = true;
}
return changed;
}
internal bool AddMicrophone() {
bool changed = false;
if (SelectNodes("/manifest/uses-permission[@android:name='android.permission.MICROPHONE']", nsMgr).Count == 0) {
var elem = CreateElement("uses-permission");
elem.Attributes.Append(CreateAndroidAttribute("name", "android.permission.MICROPHONE"));
ManifestElement.AppendChild(elem);
changed = true;
}
if (SelectNodes("/manifest/uses-feature[@android:name='android.hardware.microphone']", nsMgr).Count == 0) {
var elem = CreateElement("uses-feature");
elem.Attributes.Append(CreateAndroidAttribute("name", "android.hardware.microphone"));
ManifestElement.AppendChild(elem);
changed = true;
}
// cf. https://github.com/gree/unity-webview/issues/679
// cf. https://github.com/fluttercommunity/flutter_webview_plugin/issues/138#issuecomment-559307558
// cf. https://stackoverflow.com/questions/38917751/webview-webrtc-not-working/68024032#68024032
// cf. https://stackoverflow.com/questions/40236925/allowing-microphone-accesspermission-in-webview-android-studio-java/47410311#47410311
if (SelectNodes("/manifest/uses-permission[@android:name='android.permission.MODIFY_AUDIO_SETTINGS']", nsMgr).Count == 0) {
var elem = CreateElement("uses-permission");
elem.Attributes.Append(CreateAndroidAttribute("name", "android.permission.MODIFY_AUDIO_SETTINGS"));
ManifestElement.AppendChild(elem);
changed = true;
}
if (SelectNodes("/manifest/uses-permission[@android:name='android.permission.RECORD_AUDIO']", nsMgr).Count == 0) {
var elem = CreateElement("uses-permission");
elem.Attributes.Append(CreateAndroidAttribute("name", "android.permission.RECORD_AUDIO"));
ManifestElement.AppendChild(elem);
changed = true;
}
return changed;
}
}
#endif
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0b2f5f306eb6e4afcbc074e6efccc188
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+9
View File
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 3c57523b63ddb094b835b6613da12763
folderAsset: yes
timeCreated: 1596819199
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 3d7d7a61a5341904eb3c65af025b1d86
folderAsset: yes
timeCreated: 1510075633
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,55 @@
#if (UNITY_EDITOR || UNITY_ANDROID) && UNITY_ANDROID_JNI
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" );
}
[UnityEngine.Scripting.Preserve]
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: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: bf909fab1c14af446b0a854de42289b2
timeCreated: 1510086220
licenseType: Store
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:
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 86f54622630720f4abe279acdbb8886f
folderAsset: yes
timeCreated: 1561217660
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,181 @@
using UnityEditor;
using UnityEngine;
namespace IngameDebugConsole
{
[CustomEditor( typeof( DebugLogManager ) )]
public class DebugLogManagerEditor : Editor
{
private SerializedProperty singleton;
private SerializedProperty minimumHeight;
private SerializedProperty enableHorizontalResizing;
private SerializedProperty resizeFromRight;
private SerializedProperty minimumWidth;
private SerializedProperty logWindowOpacity;
private SerializedProperty popupOpacity;
private SerializedProperty popupVisibility;
private SerializedProperty popupVisibilityLogFilter;
private SerializedProperty startMinimized;
private SerializedProperty toggleWithKey;
private SerializedProperty toggleKey;
private SerializedProperty enableSearchbar;
private SerializedProperty topSearchbarMinWidth;
private SerializedProperty receiveLogsWhileInactive;
private SerializedProperty receiveInfoLogs;
private SerializedProperty receiveWarningLogs;
private SerializedProperty receiveErrorLogs;
private SerializedProperty receiveExceptionLogs;
private SerializedProperty captureLogTimestamps;
private SerializedProperty alwaysDisplayTimestamps;
private SerializedProperty maxLogCount;
private SerializedProperty logsToRemoveAfterMaxLogCount;
private SerializedProperty queuedLogLimit;
private SerializedProperty clearCommandAfterExecution;
private SerializedProperty commandHistorySize;
private SerializedProperty showCommandSuggestions;
private SerializedProperty receiveLogcatLogsInAndroid;
private SerializedProperty logcatArguments;
private SerializedProperty avoidScreenCutout;
private SerializedProperty popupAvoidsScreenCutout;
private SerializedProperty autoFocusOnCommandInputField;
private readonly GUIContent popupVisibilityLogFilterLabel = new GUIContent( "Log Filter", "Determines which log types will show the popup on screen" );
private readonly GUIContent receivedLogTypesLabel = new GUIContent( "Received Log Types", "Only these logs will be received by the console window, other logs will simply be skipped" );
private readonly GUIContent receiveInfoLogsLabel = new GUIContent( "Info" );
private readonly GUIContent receiveWarningLogsLabel = new GUIContent( "Warning" );
private readonly GUIContent receiveErrorLogsLabel = new GUIContent( "Error" );
private readonly GUIContent receiveExceptionLogsLabel = new GUIContent( "Exception" );
private void OnEnable()
{
singleton = serializedObject.FindProperty( "singleton" );
minimumHeight = serializedObject.FindProperty( "minimumHeight" );
enableHorizontalResizing = serializedObject.FindProperty( "enableHorizontalResizing" );
resizeFromRight = serializedObject.FindProperty( "resizeFromRight" );
minimumWidth = serializedObject.FindProperty( "minimumWidth" );
logWindowOpacity = serializedObject.FindProperty( "logWindowOpacity" );
popupOpacity = serializedObject.FindProperty( "popupOpacity" );
popupVisibility = serializedObject.FindProperty( "popupVisibility" );
popupVisibilityLogFilter = serializedObject.FindProperty( "popupVisibilityLogFilter" );
startMinimized = serializedObject.FindProperty( "startMinimized" );
toggleWithKey = serializedObject.FindProperty( "toggleWithKey" );
#if ENABLE_INPUT_SYSTEM && !ENABLE_LEGACY_INPUT_MANAGER
toggleKey = serializedObject.FindProperty( "toggleBinding" );
#else
toggleKey = serializedObject.FindProperty( "toggleKey" );
#endif
enableSearchbar = serializedObject.FindProperty( "enableSearchbar" );
topSearchbarMinWidth = serializedObject.FindProperty( "topSearchbarMinWidth" );
receiveLogsWhileInactive = serializedObject.FindProperty( "receiveLogsWhileInactive" );
receiveInfoLogs = serializedObject.FindProperty( "receiveInfoLogs" );
receiveWarningLogs = serializedObject.FindProperty( "receiveWarningLogs" );
receiveErrorLogs = serializedObject.FindProperty( "receiveErrorLogs" );
receiveExceptionLogs = serializedObject.FindProperty( "receiveExceptionLogs" );
captureLogTimestamps = serializedObject.FindProperty( "captureLogTimestamps" );
alwaysDisplayTimestamps = serializedObject.FindProperty( "alwaysDisplayTimestamps" );
maxLogCount = serializedObject.FindProperty( "maxLogCount" );
logsToRemoveAfterMaxLogCount = serializedObject.FindProperty( "logsToRemoveAfterMaxLogCount" );
queuedLogLimit = serializedObject.FindProperty( "queuedLogLimit" );
clearCommandAfterExecution = serializedObject.FindProperty( "clearCommandAfterExecution" );
commandHistorySize = serializedObject.FindProperty( "commandHistorySize" );
showCommandSuggestions = serializedObject.FindProperty( "showCommandSuggestions" );
receiveLogcatLogsInAndroid = serializedObject.FindProperty( "receiveLogcatLogsInAndroid" );
logcatArguments = serializedObject.FindProperty( "logcatArguments" );
avoidScreenCutout = serializedObject.FindProperty( "avoidScreenCutout" );
popupAvoidsScreenCutout = serializedObject.FindProperty( "popupAvoidsScreenCutout" );
autoFocusOnCommandInputField = serializedObject.FindProperty( "autoFocusOnCommandInputField" );
}
public override void OnInspectorGUI()
{
serializedObject.Update();
EditorGUILayout.PropertyField( singleton );
EditorGUILayout.Space();
EditorGUILayout.PropertyField( minimumHeight );
EditorGUILayout.PropertyField( enableHorizontalResizing );
if( enableHorizontalResizing.boolValue )
{
DrawSubProperty( resizeFromRight );
DrawSubProperty( minimumWidth );
}
EditorGUILayout.PropertyField( avoidScreenCutout );
DrawSubProperty( popupAvoidsScreenCutout );
EditorGUILayout.Space();
EditorGUILayout.PropertyField( startMinimized );
EditorGUILayout.PropertyField( logWindowOpacity );
EditorGUILayout.PropertyField( popupOpacity );
EditorGUILayout.PropertyField( popupVisibility );
if( popupVisibility.intValue == (int) PopupVisibility.WhenLogReceived )
{
EditorGUI.indentLevel++;
Rect rect = EditorGUILayout.GetControlRect();
EditorGUI.BeginProperty( rect, GUIContent.none, popupVisibilityLogFilter );
popupVisibilityLogFilter.intValue = (int) (DebugLogFilter) EditorGUI.EnumFlagsField( rect, popupVisibilityLogFilterLabel, (DebugLogFilter) popupVisibilityLogFilter.intValue );
EditorGUI.EndProperty();
EditorGUI.indentLevel--;
}
EditorGUILayout.PropertyField( toggleWithKey );
if( toggleWithKey.boolValue )
DrawSubProperty( toggleKey );
EditorGUILayout.Space();
EditorGUILayout.PropertyField( enableSearchbar );
if( enableSearchbar.boolValue )
DrawSubProperty( topSearchbarMinWidth );
EditorGUILayout.Space();
EditorGUILayout.PropertyField( receiveLogsWhileInactive );
EditorGUILayout.PrefixLabel( receivedLogTypesLabel );
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField( receiveInfoLogs, receiveInfoLogsLabel );
EditorGUILayout.PropertyField( receiveWarningLogs, receiveWarningLogsLabel );
EditorGUILayout.PropertyField( receiveErrorLogs, receiveErrorLogsLabel );
EditorGUILayout.PropertyField( receiveExceptionLogs, receiveExceptionLogsLabel );
EditorGUI.indentLevel--;
EditorGUILayout.PropertyField( receiveLogcatLogsInAndroid );
if( receiveLogcatLogsInAndroid.boolValue )
DrawSubProperty( logcatArguments );
EditorGUILayout.PropertyField( captureLogTimestamps );
if( captureLogTimestamps.boolValue )
DrawSubProperty( alwaysDisplayTimestamps );
EditorGUILayout.PropertyField( maxLogCount );
DrawSubProperty( logsToRemoveAfterMaxLogCount );
EditorGUILayout.PropertyField( queuedLogLimit );
EditorGUILayout.Space();
EditorGUILayout.PropertyField( clearCommandAfterExecution );
EditorGUILayout.PropertyField( commandHistorySize );
EditorGUILayout.PropertyField( showCommandSuggestions );
EditorGUILayout.PropertyField( autoFocusOnCommandInputField );
EditorGUILayout.Space();
DrawPropertiesExcluding( serializedObject, "m_Script" );
serializedObject.ApplyModifiedProperties();
}
private void DrawSubProperty( SerializedProperty property )
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField( property );
EditorGUI.indentLevel--;
}
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 4c23e5c521cb0c54b9a638b2a653d1d3
timeCreated: 1561217671
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,17 @@
{
"name": "IngameDebugConsole.Editor",
"references": [
"IngameDebugConsole.Runtime"
],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 466e67dabd1db22468246c39eddb6c3f
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,23 @@
{
"name": "IngameDebugConsole.Runtime",
"rootNamespace": "",
"references": [
"Unity.InputSystem",
"Unity.TextMeshPro"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [
{
"name": "com.unity.modules.androidjni",
"expression": "",
"define": "UNITY_ANDROID_JNI"
}
],
"noEngineReferences": false
}
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 3de88c88fbbb8f944b9210d496af9762
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 67117722a812a2e46ab8cb8eafbf5f5e
timeCreated: 1466014755
licenseType: Store
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 7dbc36665bc0d684db9a4447e27a7a4b
folderAsset: yes
timeCreated: 1520417401
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,137 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &1386426139070838
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 224955737853170496}
- component: {fileID: 222541766812100524}
- component: {fileID: 6838696818539158795}
m_Layer: 5
m_Name: CommandSuggestion
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &224955737853170496
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1386426139070838}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &222541766812100524
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1386426139070838}
m_CullTransparentMesh: 1
--- !u!114 &6838696818539158795
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1386426139070838}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: help
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4292335574
m_fontColor: {r: 0.83823526, g: 0.84439874, b: 0.84439874, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 16
m_fontSizeBase: 16
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 1
m_fontSizeMax: 40
m_fontStyle: 0
m_HorizontalAlignment: 1
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 3
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 5e66896448428cf46a1854dbdc014914
timeCreated: 1601390136
licenseType: Store
NativeFormatImporter:
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,834 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &104862
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 22461494}
- component: {fileID: 22233942}
- component: {fileID: 11411806}
m_Layer: 5
m_Name: LogCount
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &22461494
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 104862}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 22420350}
m_Father: {fileID: 22479264}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0.5}
m_AnchorMax: {x: 1, y: 0.5}
m_AnchoredPosition: {x: -20, y: 0}
m_SizeDelta: {x: 30, y: 25}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &22233942
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 104862}
m_CullTransparentMesh: 1
--- !u!114 &11411806
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 104862}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.42647058, g: 0.42647058, b: 0.42647058, a: 1}
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: b3f0d976f6d6802479d6465d11b3aa68, type: 3}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1.3
--- !u!1 &151462
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 22420350}
- component: {fileID: 22200920}
- component: {fileID: 5450305048240168820}
m_Layer: 5
m_Name: LogCountText
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &22420350
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 151462}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 22461494}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: -2, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &22200920
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 151462}
m_CullTransparentMesh: 1
--- !u!114 &5450305048240168820
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 151462}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: 2
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: ebc67c409e5c4403fa46351fcd7760cc, type: 2}
m_sharedMaterial: {fileID: 5652167517337330150, guid: ebc67c409e5c4403fa46351fcd7760cc, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4292335574
m_fontColor: {r: 0.83823526, g: 0.84439874, b: 0.84439874, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 14
m_fontSizeBase: 36
m_fontWeight: 400
m_enableAutoSizing: 1
m_fontSizeMin: 8
m_fontSizeMax: 14
m_fontStyle: 0
m_HorizontalAlignment: 2
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 0
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!1 &152362
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 22427300}
- component: {fileID: 22262284}
- component: {fileID: 11404142}
m_Layer: 5
m_Name: LogType
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &22427300
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 152362}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 22479264}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 0, y: 0.5}
m_AnchoredPosition: {x: 15, y: 0}
m_SizeDelta: {x: 25, y: 25}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &22262284
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 152362}
m_CullTransparentMesh: 1
--- !u!114 &11404142
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 152362}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 5a97d5afa6254804f81b7ba956296996, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &166880
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 22479264}
- component: {fileID: 22288988}
- component: {fileID: 11459012}
- component: {fileID: 11408050}
- component: {fileID: 11456372}
- component: {fileID: 225819852034701160}
m_Layer: 5
m_Name: DebugLogItem
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &22479264
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 166880}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 22427300}
- {fileID: 224737693311518052}
- {fileID: 22461494}
- {fileID: 224006190298411330}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 35}
m_Pivot: {x: 0, y: 1}
--- !u!222 &22288988
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 166880}
m_CullTransparentMesh: 1
--- !u!114 &11459012
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 166880}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.23529412, g: 0.23529412, b: 0.23529412, a: 0.697}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 98e8e1cf8dc7dbf469617c2e40c8a944, type: 3}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!114 &11408050
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 166880}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d2ea291be9de70a4abfec595203c96c1, type: 3}
m_Name:
m_EditorClassIdentifier:
transformComponent: {fileID: 22479264}
imageComponent: {fileID: 11459012}
canvasGroupComponent: {fileID: 225819852034701160}
logText: {fileID: 3887244321031527211}
logTypeImage: {fileID: 11404142}
logCountParent: {fileID: 104862}
logCountText: {fileID: 5450305048240168820}
copyLogButton: {fileID: 114694923173451186}
--- !u!114 &11456372
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 166880}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Highlighted
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 11459012}
m_OnClick:
m_PersistentCalls:
m_Calls: []
--- !u!225 &225819852034701160
CanvasGroup:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 166880}
m_Enabled: 1
m_Alpha: 1
m_Interactable: 1
m_BlocksRaycasts: 1
m_IgnoreParentGroups: 0
--- !u!1 &1396836967994216
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 224006190298411330}
- component: {fileID: 222870443111501910}
- component: {fileID: 114119781176956926}
- component: {fileID: 114694923173451186}
m_Layer: 5
m_Name: CopyLogButton
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!224 &224006190298411330
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1396836967994216}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 224887990600088790}
m_Father: {fileID: 22479264}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: 0, y: 2}
m_SizeDelta: {x: -80, y: 36}
m_Pivot: {x: 0.5, y: 0}
--- !u!222 &222870443111501910
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1396836967994216}
m_CullTransparentMesh: 1
--- !u!114 &114119781176956926
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1396836967994216}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.42647058, g: 0.42647058, b: 0.42647058, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 066d3840badf4d24dba1d42b4c59b888, type: 3}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!114 &114694923173451186
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1396836967994216}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Highlighted
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 114119781176956926}
m_OnClick:
m_PersistentCalls:
m_Calls: []
--- !u!1 &1503640463151286
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 224887990600088790}
- component: {fileID: 222313182602304162}
- component: {fileID: 6497267641603342931}
m_Layer: 5
m_Name: Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &224887990600088790
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1503640463151286}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 224006190298411330}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &222313182602304162
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1503640463151286}
m_CullTransparentMesh: 1
--- !u!114 &6497267641603342931
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1503640463151286}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: Copy
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: ebc67c409e5c4403fa46351fcd7760cc, type: 2}
m_sharedMaterial: {fileID: 5776729652219808394, guid: 9d96f17a256c243ccb487f2ef162b90b, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4292335574
m_fontColor: {r: 0.83823526, g: 0.84439874, b: 0.84439874, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 16
m_fontSizeBase: 16
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 1
m_fontSizeMax: 40
m_fontStyle: 0
m_HorizontalAlignment: 2
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 0
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 1
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!1 &1785910143472904
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 224737693311518052}
- component: {fileID: 222175805939703770}
- component: {fileID: 3887244321031527211}
m_Layer: 5
m_Name: LogText
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &224737693311518052
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1785910143472904}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 22479264}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 12.5, y: 0}
m_SizeDelta: {x: -35, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &222175805939703770
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1785910143472904}
m_CullTransparentMesh: 1
--- !u!114 &3887244321031527211
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1785910143472904}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: "8\u4E2D\u6492\u53D1\u58F0\u65B9\u6CD5"
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: ebc67c409e5c4403fa46351fcd7760cc, type: 2}
m_sharedMaterial: {fileID: 5652167517337330150, guid: ebc67c409e5c4403fa46351fcd7760cc, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4292335574
m_fontColor: {r: 0.83823526, g: 0.84439874, b: 0.84439874, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 13.5
m_fontSizeBase: 13.5
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 1
m_fontSizeMax: 40
m_fontStyle: 0
m_HorizontalAlignment: 1
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 1
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 391be5df5ef62f345bb76a1051c04da7
timeCreated: 1465919887
licenseType: Store
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,7 @@
= In-game Debug Console (v1.8.0) =
Documentation: https://github.com/yasirkula/UnityIngameDebugConsole
FAQ: https://github.com/yasirkula/UnityIngameDebugConsole#faq
E-mail: yasirkula@gmail.com
You can simply place the IngameDebugConsole prefab to your scene. Hovering the cursor over its properties in the Inspector will reveal explanatory tooltips.
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: edf2ac73f7bc3064c96d53009106dc53
timeCreated: 1563307881
licenseType: Store
TextScriptImporter:
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 860c08388401a6d4e858fe4910ea9337
folderAsset: yes
timeCreated: 1465930645
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7de74709c0f949d42853e89b41f0c939
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,21 @@
using System;
using System.Reflection;
namespace IngameDebugConsole
{
public abstract class ConsoleAttribute : Attribute
{
public MethodInfo Method { get; private set; }
public abstract int Order { get; }
public void SetMethod(MethodInfo method)
{
if (Method != null)
throw new Exception("Method was already initialized.");
Method = method;
}
public abstract void Load();
}
}
@@ -0,0 +1,24 @@
using System;
namespace IngameDebugConsole
{
[AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = false)]
public class ConsoleCustomTypeParserAttribute : ConsoleAttribute
{
public readonly Type type;
public readonly string readableName;
public override int Order { get { return 0; } }
public ConsoleCustomTypeParserAttribute(Type type, string readableName = null)
{
this.type = type;
this.readableName = readableName;
}
public override void Load()
{
DebugLogConsole.AddCustomParameterType(type, (DebugLogConsole.ParseFunction)Delegate.CreateDelegate(typeof(DebugLogConsole.ParseFunction), Method), readableName);
}
}
}
@@ -0,0 +1,30 @@
using System;
namespace IngameDebugConsole
{
[AttributeUsage( AttributeTargets.Method, Inherited = false, AllowMultiple = true )]
public class ConsoleMethodAttribute : ConsoleAttribute
{
private string m_command;
private string m_description;
private string[] m_parameterNames;
public string Command { get { return m_command; } }
public string Description { get { return m_description; } }
public string[] ParameterNames { get { return m_parameterNames; } }
public override int Order { get { return 1; } }
public ConsoleMethodAttribute( string command, string description, params string[] parameterNames )
{
m_command = command;
m_description = description;
m_parameterNames = parameterNames;
}
public override void Load()
{
DebugLogConsole.AddCommand(Command, Description, Method, null, ParameterNames);
}
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 324bb39c0bff0f74fa42f83e91f07e3a
timeCreated: 1520710946
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,304 @@
using System;
using UnityEngine;
namespace IngameDebugConsole
{
public class CircularBuffer<T>
{
private readonly T[] array;
private int startIndex;
public int Count { get; private set; }
public T this[int index] { get { return array[( startIndex + index ) % array.Length]; } }
public CircularBuffer( int capacity )
{
array = new T[capacity];
}
// Old elements are overwritten when capacity is reached
public void Add( T value )
{
if( Count < array.Length )
array[Count++] = value;
else
{
array[startIndex] = value;
if( ++startIndex >= array.Length )
startIndex = 0;
}
}
}
public class DynamicCircularBuffer<T>
{
private T[] array;
private int startIndex;
public int Count { get; private set; }
public int Capacity { get { return array.Length; } }
public T this[int index]
{
get { return array[( startIndex + index ) % array.Length]; }
set { array[( startIndex + index ) % array.Length] = value; }
}
public DynamicCircularBuffer( int initialCapacity = 2 )
{
array = new T[initialCapacity];
}
private void SetCapacity( int capacity )
{
T[] newArray = new T[capacity];
if( Count > 0 )
{
int elementsBeforeWrap = Mathf.Min( Count, array.Length - startIndex );
Array.Copy( array, startIndex, newArray, 0, elementsBeforeWrap );
if( elementsBeforeWrap < Count )
Array.Copy( array, 0, newArray, elementsBeforeWrap, Count - elementsBeforeWrap );
}
array = newArray;
startIndex = 0;
}
/// <summary>Inserts the value to the beginning of the collection.</summary>
public void AddFirst( T value )
{
if( array.Length == Count )
SetCapacity( Mathf.Max( array.Length * 2, 4 ) );
startIndex = ( startIndex > 0 ) ? ( startIndex - 1 ) : ( array.Length - 1 );
array[startIndex] = value;
Count++;
}
/// <summary>Adds the value to the end of the collection.</summary>
public void Add( T value )
{
if( array.Length == Count )
SetCapacity( Mathf.Max( array.Length * 2, 4 ) );
this[Count++] = value;
}
public void AddRange( DynamicCircularBuffer<T> other )
{
if( other.Count == 0 )
return;
if( array.Length < Count + other.Count )
SetCapacity( Mathf.Max( array.Length * 2, Count + other.Count ) );
int insertStartIndex = ( startIndex + Count ) % array.Length;
int elementsBeforeWrap = Mathf.Min( other.Count, array.Length - insertStartIndex );
int otherElementsBeforeWrap = Mathf.Min( other.Count, other.array.Length - other.startIndex );
Array.Copy( other.array, other.startIndex, array, insertStartIndex, Mathf.Min( elementsBeforeWrap, otherElementsBeforeWrap ) );
if( elementsBeforeWrap < otherElementsBeforeWrap ) // This array wrapped before the other array
Array.Copy( other.array, other.startIndex + elementsBeforeWrap, array, 0, otherElementsBeforeWrap - elementsBeforeWrap );
else if( elementsBeforeWrap > otherElementsBeforeWrap ) // The other array wrapped before this array
Array.Copy( other.array, 0, array, insertStartIndex + otherElementsBeforeWrap, elementsBeforeWrap - otherElementsBeforeWrap );
int copiedElements = Mathf.Max( elementsBeforeWrap, otherElementsBeforeWrap );
if( copiedElements < other.Count ) // Both arrays wrapped and there's still some elements left to copy
Array.Copy( other.array, copiedElements - otherElementsBeforeWrap, array, copiedElements - elementsBeforeWrap, other.Count - copiedElements );
Count += other.Count;
}
public T RemoveFirst()
{
T element = array[startIndex];
array[startIndex] = default( T );
if( ++startIndex == array.Length )
startIndex = 0;
Count--;
return element;
}
public T RemoveLast()
{
int index = ( startIndex + Count - 1 ) % array.Length;
T element = array[index];
array[index] = default( T );
Count--;
return element;
}
public int RemoveAll( Predicate<T> shouldRemoveElement )
{
return RemoveAll<T>( shouldRemoveElement, null, null );
}
public int RemoveAll<Y>( Predicate<T> shouldRemoveElement, Action<T, int> onElementIndexChanged, DynamicCircularBuffer<Y> synchronizedBuffer )
{
Y[] synchronizedArray = ( synchronizedBuffer != null ) ? synchronizedBuffer.array : null;
int elementsBeforeWrap = Mathf.Min( Count, array.Length - startIndex );
int removedElements = 0;
int i = startIndex, newIndex = startIndex, endIndex = startIndex + elementsBeforeWrap;
for( ; i < endIndex; i++ )
{
if( shouldRemoveElement( array[i] ) )
removedElements++;
else
{
if( removedElements > 0 )
{
T element = array[i];
array[newIndex] = element;
if( synchronizedArray != null )
synchronizedArray[newIndex] = synchronizedArray[i];
if( onElementIndexChanged != null )
onElementIndexChanged( element, newIndex - startIndex );
}
newIndex++;
}
}
i = 0;
endIndex = Count - elementsBeforeWrap;
if( newIndex < array.Length )
{
for( ; i < endIndex; i++ )
{
if( shouldRemoveElement( array[i] ) )
removedElements++;
else
{
T element = array[i];
array[newIndex] = element;
if( synchronizedArray != null )
synchronizedArray[newIndex] = synchronizedArray[i];
if( onElementIndexChanged != null )
onElementIndexChanged( element, newIndex - startIndex );
if( ++newIndex == array.Length )
{
i++;
break;
}
}
}
}
if( newIndex == array.Length )
{
newIndex = 0;
for( ; i < endIndex; i++ )
{
if( shouldRemoveElement( array[i] ) )
removedElements++;
else
{
if( removedElements > 0 )
{
T element = array[i];
array[newIndex] = element;
if( synchronizedArray != null )
synchronizedArray[newIndex] = synchronizedArray[i];
if( onElementIndexChanged != null )
onElementIndexChanged( element, newIndex + elementsBeforeWrap );
}
newIndex++;
}
}
}
TrimEnd( removedElements );
if( synchronizedBuffer != null )
synchronizedBuffer.TrimEnd( removedElements );
return removedElements;
}
public void TrimStart( int trimCount, Action<T> perElementCallback = null )
{
TrimInternal( trimCount, startIndex, perElementCallback );
startIndex = ( startIndex + trimCount ) % array.Length;
}
public void TrimEnd( int trimCount, Action<T> perElementCallback = null )
{
TrimInternal( trimCount, ( startIndex + Count - trimCount ) % array.Length, perElementCallback );
}
private void TrimInternal( int trimCount, int startIndex, Action<T> perElementCallback )
{
int elementsBeforeWrap = Mathf.Min( trimCount, array.Length - startIndex );
if( perElementCallback == null )
{
Array.Clear( array, startIndex, elementsBeforeWrap );
if( elementsBeforeWrap < trimCount )
Array.Clear( array, 0, trimCount - elementsBeforeWrap );
}
else
{
for( int i = startIndex, endIndex = startIndex + elementsBeforeWrap; i < endIndex; i++ )
{
perElementCallback( array[i] );
array[i] = default( T );
}
for( int i = 0, endIndex = trimCount - elementsBeforeWrap; i < endIndex; i++ )
{
perElementCallback( array[i] );
array[i] = default( T );
}
}
Count -= trimCount;
}
public void Clear()
{
int elementsBeforeWrap = Mathf.Min( Count, array.Length - startIndex );
Array.Clear( array, startIndex, elementsBeforeWrap );
if( elementsBeforeWrap < Count )
Array.Clear( array, 0, Count - elementsBeforeWrap );
startIndex = 0;
Count = 0;
}
public int IndexOf( T value )
{
int elementsBeforeWrap = Mathf.Min( Count, array.Length - startIndex );
int index = Array.IndexOf( array, value, startIndex, elementsBeforeWrap );
if( index >= 0 )
return index - startIndex;
if( elementsBeforeWrap < Count )
{
index = Array.IndexOf( array, value, 0, Count - elementsBeforeWrap );
if( index >= 0 )
return index + elementsBeforeWrap;
}
return -1;
}
public void ForEach( Action<T> action )
{
int elementsBeforeWrap = Mathf.Min( Count, array.Length - startIndex );
for( int i = startIndex, endIndex = startIndex + elementsBeforeWrap; i < endIndex; i++ )
action( array[i] );
for( int i = 0, endIndex = Count - elementsBeforeWrap; i < endIndex; i++ )
action( array[i] );
}
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 6136cb3c00eac0149901b8e7f2fecef8
timeCreated: 1550943949
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: d15693a03d0d33b4892c6365a2a97e19
timeCreated: 1472036503
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,187 @@
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using UnityEngine;
// Container for a simple debug entry
namespace IngameDebugConsole
{
public class DebugLogEntry
{
private const int HASH_NOT_CALCULATED = -623218;
public string logString;
public string stackTrace;
private string completeLog;
// Sprite to show with this entry
public LogType logType;
// Collapsed count
public int count;
// Index of this entry among all collapsed entries
public int collapsedIndex;
private int hashValue;
public void Initialize( string logString, string stackTrace )
{
this.logString = logString;
this.stackTrace = stackTrace;
completeLog = null;
count = 1;
hashValue = HASH_NOT_CALCULATED;
}
public void Clear()
{
logString = null;
stackTrace = null;
completeLog = null;
}
// Checks if logString or stackTrace contains the search term
public bool MatchesSearchTerm( string searchTerm )
{
return ( logString != null && DebugLogConsole.caseInsensitiveComparer.IndexOf( logString, searchTerm, CompareOptions.IgnoreCase | CompareOptions.IgnoreNonSpace ) >= 0 ) ||
( stackTrace != null && DebugLogConsole.caseInsensitiveComparer.IndexOf( stackTrace, searchTerm, CompareOptions.IgnoreCase | CompareOptions.IgnoreNonSpace ) >= 0 );
}
// Return a string containing complete information about this debug entry
public override string ToString()
{
if( completeLog == null )
completeLog = string.Concat( logString, "\n", stackTrace );
return completeLog;
}
// Credit: https://stackoverflow.com/a/19250516/2373034
public int GetContentHashCode()
{
if( hashValue == HASH_NOT_CALCULATED )
{
unchecked
{
hashValue = 17;
hashValue = hashValue * 23 + ( logString == null ? 0 : logString.GetHashCode() );
hashValue = hashValue * 23 + ( stackTrace == null ? 0 : stackTrace.GetHashCode() );
}
}
return hashValue;
}
}
public struct QueuedDebugLogEntry
{
public readonly string logString;
public readonly string stackTrace;
public readonly LogType logType;
public QueuedDebugLogEntry( string logString, string stackTrace, LogType logType )
{
this.logString = logString;
this.stackTrace = stackTrace;
this.logType = logType;
}
// Checks if logString or stackTrace contains the search term
public bool MatchesSearchTerm( string searchTerm )
{
return ( logString != null && DebugLogConsole.caseInsensitiveComparer.IndexOf( logString, searchTerm, CompareOptions.IgnoreCase | CompareOptions.IgnoreNonSpace ) >= 0 ) ||
( stackTrace != null && DebugLogConsole.caseInsensitiveComparer.IndexOf( stackTrace, searchTerm, CompareOptions.IgnoreCase | CompareOptions.IgnoreNonSpace ) >= 0 );
}
}
public struct DebugLogEntryTimestamp
{
public readonly System.DateTime dateTime;
#if !IDG_OMIT_ELAPSED_TIME
public readonly float elapsedSeconds;
#endif
#if !IDG_OMIT_FRAMECOUNT
public readonly int frameCount;
#endif
#if !IDG_OMIT_ELAPSED_TIME && !IDG_OMIT_FRAMECOUNT
public DebugLogEntryTimestamp( System.DateTime dateTime, float elapsedSeconds, int frameCount )
#elif !IDG_OMIT_ELAPSED_TIME
public DebugLogEntryTimestamp( System.DateTime dateTime, float elapsedSeconds )
#elif !IDG_OMIT_FRAMECOUNT
public DebugLogEntryTimestamp( System.DateTime dateTime, int frameCount )
#else
public DebugLogEntryTimestamp( System.DateTime dateTime )
#endif
{
this.dateTime = dateTime;
#if !IDG_OMIT_ELAPSED_TIME
this.elapsedSeconds = elapsedSeconds;
#endif
#if !IDG_OMIT_FRAMECOUNT
this.frameCount = frameCount;
#endif
}
public void AppendTime( StringBuilder sb )
{
// Add DateTime in format: [HH:mm:ss]
sb.Append( "[" );
int hour = dateTime.Hour;
if( hour >= 10 )
sb.Append( hour );
else
sb.Append( "0" ).Append( hour );
sb.Append( ":" );
int minute = dateTime.Minute;
if( minute >= 10 )
sb.Append( minute );
else
sb.Append( "0" ).Append( minute );
sb.Append( ":" );
int second = dateTime.Second;
if( second >= 10 )
sb.Append( second );
else
sb.Append( "0" ).Append( second );
sb.Append( "]" );
}
public void AppendFullTimestamp( StringBuilder sb )
{
AppendTime( sb );
#if !IDG_OMIT_ELAPSED_TIME && !IDG_OMIT_FRAMECOUNT
// Append elapsed seconds and frame count in format: [1.0s at #Frame]
sb.Append( "[" ).Append( elapsedSeconds.ToString( "F1" ) ).Append( "s at " ).Append( "#" ).Append( frameCount ).Append( "]" );
#elif !IDG_OMIT_ELAPSED_TIME
// Append elapsed seconds in format: [1.0s]
sb.Append( "[" ).Append( elapsedSeconds.ToString( "F1" ) ).Append( "s]" );
#elif !IDG_OMIT_FRAMECOUNT
// Append frame count in format: [#Frame]
sb.Append( "[#" ).Append( frameCount ).Append( "]" );
#endif
}
}
public class DebugLogEntryContentEqualityComparer : EqualityComparer<DebugLogEntry>
{
public override bool Equals( DebugLogEntry x, DebugLogEntry y )
{
return x.logString == y.logString && x.stackTrace == y.stackTrace;
}
public override int GetHashCode( DebugLogEntry obj )
{
return obj.GetContentHashCode();
}
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: e7b1a420c564be040bf73b8a377fc2c2
timeCreated: 1466375168
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,241 @@
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using System.Text;
using TMPro;
#if UNITY_EDITOR
using UnityEditor;
using System.Text.RegularExpressions;
#endif
// A UI element to show information about a debug entry
namespace IngameDebugConsole
{
public class DebugLogItem : MonoBehaviour, IPointerClickHandler
{
#pragma warning disable 0649
// Cached components
[SerializeField]
private RectTransform transformComponent;
public RectTransform Transform { get { return transformComponent; } }
[SerializeField]
private Image imageComponent;
public Image Image { get { return imageComponent; } }
[SerializeField]
private CanvasGroup canvasGroupComponent;
public CanvasGroup CanvasGroup { get { return canvasGroupComponent; } }
[SerializeField]
private TextMeshProUGUI logText;
[SerializeField]
private Image logTypeImage;
// Objects related to the collapsed count of the debug entry
[SerializeField]
private GameObject logCountParent;
[SerializeField]
private TextMeshProUGUI logCountText;
[SerializeField]
private Button copyLogButton;
#pragma warning restore 0649
// Debug entry to show with this log item
private DebugLogEntry logEntry;
public DebugLogEntry Entry { get { return logEntry; } }
private DebugLogEntryTimestamp? logEntryTimestamp;
public DebugLogEntryTimestamp? Timestamp { get { return logEntryTimestamp; } }
// Index of the entry in the list of entries
[System.NonSerialized] public int Index;
private bool isExpanded;
public bool Expanded { get { return isExpanded; } }
private Vector2 logTextOriginalPosition;
private Vector2 logTextOriginalSize;
private float copyLogButtonHeight;
private DebugLogRecycledListView listView;
public void Initialize( DebugLogRecycledListView listView )
{
this.listView = listView;
logTextOriginalPosition = logText.rectTransform.anchoredPosition;
logTextOriginalSize = logText.rectTransform.sizeDelta;
copyLogButtonHeight = ( copyLogButton.transform as RectTransform ).anchoredPosition.y + ( copyLogButton.transform as RectTransform ).sizeDelta.y + 2f; // 2f: space between text and button
logText.maxVisibleCharacters = listView.manager.maxLogLength;
copyLogButton.onClick.AddListener( CopyLog );
#if !UNITY_EDITOR && UNITY_WEBGL
copyLogButton.gameObject.AddComponent<DebugLogItemCopyWebGL>().Initialize( this );
#endif
}
public void SetContent( DebugLogEntry logEntry, DebugLogEntryTimestamp? logEntryTimestamp, int entryIndex, bool isExpanded )
{
this.logEntry = logEntry;
this.logEntryTimestamp = logEntryTimestamp;
this.Index = entryIndex;
this.isExpanded = isExpanded;
Vector2 size = transformComponent.sizeDelta;
if( isExpanded )
{
size.y = listView.SelectedItemHeight;
if( !copyLogButton.gameObject.activeSelf )
{
copyLogButton.gameObject.SetActive( true );
logText.rectTransform.anchoredPosition = new Vector2( logTextOriginalPosition.x, logTextOriginalPosition.y + copyLogButtonHeight * 0.5f );
logText.rectTransform.sizeDelta = logTextOriginalSize - new Vector2( 0f, copyLogButtonHeight );
}
}
else
{
size.y = listView.ItemHeight;
if( copyLogButton.gameObject.activeSelf )
{
copyLogButton.gameObject.SetActive( false );
logText.rectTransform.anchoredPosition = logTextOriginalPosition;
logText.rectTransform.sizeDelta = logTextOriginalSize;
}
}
transformComponent.sizeDelta = size;
SetText( logEntry, logEntryTimestamp, isExpanded );
logTypeImage.sprite = DebugLogManager.logSpriteRepresentations[(int) logEntry.logType];
}
// Show the collapsed count of the debug entry
public void ShowCount()
{
logCountText.SetText( "{0}", logEntry.count );
if( !logCountParent.activeSelf )
logCountParent.SetActive( true );
}
// Hide the collapsed count of the debug entry
public void HideCount()
{
if( logCountParent.activeSelf )
logCountParent.SetActive( false );
}
// Update the debug entry's displayed timestamp
public void UpdateTimestamp( DebugLogEntryTimestamp timestamp )
{
logEntryTimestamp = timestamp;
if( isExpanded || listView.manager.alwaysDisplayTimestamps )
SetText( logEntry, timestamp, isExpanded );
}
private void SetText( DebugLogEntry logEntry, DebugLogEntryTimestamp? logEntryTimestamp, bool isExpanded )
{
if( !logEntryTimestamp.HasValue || ( !isExpanded && !listView.manager.alwaysDisplayTimestamps ) )
logText.text = isExpanded ? logEntry.ToString() : logEntry.logString;
else
{
StringBuilder sb = listView.manager.sharedStringBuilder;
sb.Length = 0;
if( isExpanded )
{
logEntryTimestamp.Value.AppendFullTimestamp( sb );
sb.Append( ": " ).Append( logEntry.ToString() );
}
else
{
logEntryTimestamp.Value.AppendTime( sb );
sb.Append( " " ).Append( logEntry.logString );
}
logText.text = sb.ToString();
}
}
// This log item is clicked, show the debug entry's stack trace
public void OnPointerClick( PointerEventData eventData )
{
#if UNITY_EDITOR
if( eventData.button == PointerEventData.InputButton.Right )
{
Match regex = Regex.Match( logEntry.stackTrace, @"\(at .*\.cs:[0-9]+\)$", RegexOptions.Multiline );
if( regex.Success )
{
string line = logEntry.stackTrace.Substring( regex.Index + 4, regex.Length - 5 );
int lineSeparator = line.IndexOf( ':' );
MonoScript script = AssetDatabase.LoadAssetAtPath<MonoScript>( line.Substring( 0, lineSeparator ) );
if( script != null )
AssetDatabase.OpenAsset( script, int.Parse( line.Substring( lineSeparator + 1 ) ) );
}
}
else
listView.OnLogItemClicked( this );
#else
listView.OnLogItemClicked( this );
#endif
}
private void CopyLog()
{
#if UNITY_EDITOR || !UNITY_WEBGL
string log = GetCopyContent();
if( !string.IsNullOrEmpty( log ) )
GUIUtility.systemCopyBuffer = log;
#endif
}
internal string GetCopyContent()
{
if( !logEntryTimestamp.HasValue )
return logEntry.ToString();
else
{
StringBuilder sb = listView.manager.sharedStringBuilder;
sb.Length = 0;
logEntryTimestamp.Value.AppendFullTimestamp( sb );
sb.Append( ": " ).Append( logEntry.ToString() );
return sb.ToString();
}
}
/// Here, we're using <see cref="TMP_Text.GetRenderedValues(bool)"/> instead of <see cref="TMP_Text.preferredHeight"/> because the latter doesn't take
/// <see cref="TMP_Text.maxVisibleCharacters"/> into account. However, for <see cref="TMP_Text.GetRenderedValues(bool)"/> to work, we need to give it
/// enough space (increase log item's height) and let it regenerate its mesh <see cref="TMP_Text.ForceMeshUpdate"/>.
public float CalculateExpandedHeight( DebugLogEntry logEntry, DebugLogEntryTimestamp? logEntryTimestamp )
{
string text = logText.text;
Vector2 size = ( transform as RectTransform ).sizeDelta;
( transform as RectTransform ).sizeDelta = new Vector2( size.x, 10000f );
SetText( logEntry, logEntryTimestamp, true );
logText.ForceMeshUpdate();
float result = logText.GetRenderedValues( true ).y + copyLogButtonHeight;
( transform as RectTransform ).sizeDelta = size;
logText.text = text;
return Mathf.Max( listView.ItemHeight, result );
}
// Return a string containing complete information about the debug entry
public override string ToString()
{
return logEntry.ToString();
}
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: d2ea291be9de70a4abfec595203c96c1
timeCreated: 1465919949
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,36 @@
#if !UNITY_EDITOR && UNITY_WEBGL
using System.Runtime.InteropServices;
using UnityEngine;
using UnityEngine.EventSystems;
namespace IngameDebugConsole
{
public class DebugLogItemCopyWebGL : MonoBehaviour, IPointerDownHandler, IPointerUpHandler
{
[DllImport( "__Internal" )]
private static extern void IngameDebugConsoleStartCopy( string textToCopy );
[DllImport( "__Internal" )]
private static extern void IngameDebugConsoleCancelCopy();
private DebugLogItem logItem;
public void Initialize( DebugLogItem logItem )
{
this.logItem = logItem;
}
public void OnPointerDown( PointerEventData eventData )
{
string log = logItem.GetCopyContent();
if( !string.IsNullOrEmpty( log ) )
IngameDebugConsoleStartCopy( log );
}
public void OnPointerUp( PointerEventData eventData )
{
if( eventData.dragging )
IngameDebugConsoleCancelCopy();
}
}
}
#endif
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5a7d9d894141e704d8160fb4632121ac
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 6a4f16ed905adcd4ab0d7c8c11f0d72c
timeCreated: 1522092746
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: -9869
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,282 @@
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using System.Collections;
using TMPro;
#if UNITY_EDITOR && UNITY_2021_1_OR_NEWER
using Screen = UnityEngine.Device.Screen; // To support Device Simulator on Unity 2021.1+
#endif
// Manager class for the debug popup
namespace IngameDebugConsole
{
public class DebugLogPopup : MonoBehaviour, IPointerClickHandler, IBeginDragHandler, IDragHandler, IEndDragHandler
{
private RectTransform popupTransform;
// Dimensions of the popup divided by 2
private Vector2 halfSize;
// Background image that will change color to indicate an alert
private Image backgroundImage;
// Canvas group to modify visibility of the popup
private CanvasGroup canvasGroup;
#pragma warning disable 0649
[SerializeField]
private DebugLogManager debugManager;
[SerializeField]
private TextMeshProUGUI newInfoCountText;
[SerializeField]
private TextMeshProUGUI newWarningCountText;
[SerializeField]
private TextMeshProUGUI newErrorCountText;
[SerializeField]
private Color alertColorInfo;
[SerializeField]
private Color alertColorWarning;
[SerializeField]
private Color alertColorError;
#pragma warning restore 0649
// Number of new debug entries since the log window has been closed
private int newInfoCount = 0, newWarningCount = 0, newErrorCount = 0;
private Color normalColor;
private bool isPopupBeingDragged = false;
private Vector2 normalizedPosition;
// Coroutines for simple code-based animations
private IEnumerator moveToPosCoroutine = null;
public bool IsVisible { get; private set; }
private void Awake()
{
popupTransform = (RectTransform) transform;
backgroundImage = GetComponent<Image>();
canvasGroup = GetComponent<CanvasGroup>();
normalColor = backgroundImage.color;
halfSize = popupTransform.sizeDelta * 0.5f;
Vector2 pos = popupTransform.anchoredPosition;
if( pos.x != 0f || pos.y != 0f )
normalizedPosition = pos.normalized; // Respect the initial popup position set in the prefab
else
normalizedPosition = new Vector2( 0.5f, 0f ); // Right edge by default
}
public void NewLogsArrived( int newInfo, int newWarning, int newError )
{
if( newInfo > 0 )
{
newInfoCount += newInfo;
newInfoCountText.text = newInfoCount.ToString();
}
if( newWarning > 0 )
{
newWarningCount += newWarning;
newWarningCountText.text = newWarningCount.ToString();
}
if( newError > 0 )
{
newErrorCount += newError;
newErrorCountText.text = newErrorCount.ToString();
}
if( newErrorCount > 0 )
backgroundImage.color = alertColorError;
else if( newWarningCount > 0 )
backgroundImage.color = alertColorWarning;
else
backgroundImage.color = alertColorInfo;
}
private void ResetValues()
{
newInfoCount = 0;
newWarningCount = 0;
newErrorCount = 0;
newInfoCountText.text = "0";
newWarningCountText.text = "0";
newErrorCountText.text = "0";
backgroundImage.color = normalColor;
}
// A simple smooth movement animation
private IEnumerator MoveToPosAnimation( Vector2 targetPos )
{
float modifier = 0f;
Vector2 initialPos = popupTransform.anchoredPosition;
while( modifier < 1f )
{
modifier += 4f * Time.unscaledDeltaTime;
popupTransform.anchoredPosition = Vector2.Lerp( initialPos, targetPos, modifier );
yield return null;
}
}
// Popup is clicked
public void OnPointerClick( PointerEventData data )
{
// Hide the popup and show the log window
if( !isPopupBeingDragged )
debugManager.ShowLogWindow();
}
// Hides the log window and shows the popup
public void Show()
{
canvasGroup.blocksRaycasts = true;
canvasGroup.alpha = debugManager.popupOpacity;
IsVisible = true;
// Reset the counters
ResetValues();
// Update position in case resolution was changed while the popup was hidden
UpdatePosition( true );
}
// Hide the popup
public void Hide()
{
canvasGroup.blocksRaycasts = false;
canvasGroup.alpha = 0f;
IsVisible = false;
isPopupBeingDragged = false;
}
public void OnBeginDrag( PointerEventData data )
{
isPopupBeingDragged = true;
// If a smooth movement animation is in progress, cancel it
if( moveToPosCoroutine != null )
{
StopCoroutine( moveToPosCoroutine );
moveToPosCoroutine = null;
}
}
// Reposition the popup
public void OnDrag( PointerEventData data )
{
Vector2 localPoint;
if( RectTransformUtility.ScreenPointToLocalPointInRectangle( debugManager.canvasTR, data.position, data.pressEventCamera, out localPoint ) )
popupTransform.anchoredPosition = localPoint;
}
// Smoothly translate the popup to the nearest edge
public void OnEndDrag( PointerEventData data )
{
isPopupBeingDragged = false;
UpdatePosition( false );
}
// There are 2 different spaces used in these calculations:
// RectTransform space: raw anchoredPosition of the popup that's in range [-canvasSize/2, canvasSize/2]
// Safe area space: Screen.safeArea space that's in range [safeAreaBottomLeft, safeAreaTopRight] where these corner positions
// are all positive (calculated from bottom left corner of the screen instead of the center of the screen)
public void UpdatePosition( bool immediately )
{
Vector2 canvasRawSize = debugManager.canvasTR.rect.size;
// Calculate safe area bounds
float canvasWidth = canvasRawSize.x;
float canvasHeight = canvasRawSize.y;
float canvasBottomLeftX = 0f;
float canvasBottomLeftY = 0f;
if( debugManager.popupAvoidsScreenCutout )
{
#if UNITY_EDITOR || UNITY_ANDROID || UNITY_IOS
Rect safeArea = Screen.safeArea;
int screenWidth = Screen.width;
int screenHeight = Screen.height;
canvasWidth *= safeArea.width / screenWidth;
canvasHeight *= safeArea.height / screenHeight;
canvasBottomLeftX = canvasRawSize.x * ( safeArea.x / screenWidth );
canvasBottomLeftY = canvasRawSize.y * ( safeArea.y / screenHeight );
#endif
}
// Calculate safe area position of the popup
// normalizedPosition allows us to glue the popup to a specific edge of the screen. It becomes useful when
// the popup is at the right edge and we switch from portrait screen orientation to landscape screen orientation.
// Without normalizedPosition, popup could jump to bottom or top edges instead of staying at the right edge
Vector2 pos = canvasRawSize * 0.5f + ( immediately ? new Vector2( normalizedPosition.x * canvasWidth, normalizedPosition.y * canvasHeight ) : ( popupTransform.anchoredPosition - new Vector2( canvasBottomLeftX, canvasBottomLeftY ) ) );
// Find distances to all four edges of the safe area
float distToLeft = pos.x;
float distToRight = canvasWidth - distToLeft;
float distToBottom = pos.y;
float distToTop = canvasHeight - distToBottom;
float horDistance = Mathf.Min( distToLeft, distToRight );
float vertDistance = Mathf.Min( distToBottom, distToTop );
// Find the nearest edge's safe area coordinates
if( horDistance < vertDistance )
{
if( distToLeft < distToRight )
pos = new Vector2( halfSize.x, pos.y );
else
pos = new Vector2( canvasWidth - halfSize.x, pos.y );
pos.y = Mathf.Clamp( pos.y, halfSize.y, canvasHeight - halfSize.y );
}
else
{
if( distToBottom < distToTop )
pos = new Vector2( pos.x, halfSize.y );
else
pos = new Vector2( pos.x, canvasHeight - halfSize.y );
pos.x = Mathf.Clamp( pos.x, halfSize.x, canvasWidth - halfSize.x );
}
pos -= canvasRawSize * 0.5f;
normalizedPosition.Set( pos.x / canvasWidth, pos.y / canvasHeight );
// Safe area's bottom left coordinates are added to pos only after normalizedPosition's value
// is set because normalizedPosition is in range [-canvasWidth / 2, canvasWidth / 2]
pos += new Vector2( canvasBottomLeftX, canvasBottomLeftY );
// If another smooth movement animation is in progress, cancel it
if( moveToPosCoroutine != null )
{
StopCoroutine( moveToPosCoroutine );
moveToPosCoroutine = null;
}
if( immediately )
popupTransform.anchoredPosition = pos;
else
{
// Smoothly translate the popup to the specified position
moveToPosCoroutine = MoveToPosAnimation( pos );
StartCoroutine( moveToPosCoroutine );
}
}
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 05cc4b1999716644c9308528e38e7081
timeCreated: 1466533184
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,485 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
// Handles the log items in an optimized way such that existing log items are
// recycled within the list instead of creating a new log item at each chance
namespace IngameDebugConsole
{
public class DebugLogRecycledListView : MonoBehaviour
{
#pragma warning disable 0649
// Cached components
[SerializeField]
private RectTransform transformComponent;
[SerializeField]
private RectTransform viewportTransform;
[SerializeField]
private Color logItemNormalColor1;
[SerializeField]
private Color logItemNormalColor2;
[SerializeField]
private Color logItemSelectedColor;
#pragma warning restore 0649
internal DebugLogManager manager;
private ScrollRect scrollView;
private float logItemHeight;
private DynamicCircularBuffer<DebugLogEntry> entriesToShow = null;
private DynamicCircularBuffer<DebugLogEntryTimestamp> timestampsOfEntriesToShow = null;
private DebugLogEntry selectedLogEntry;
private int indexOfSelectedLogEntry = int.MaxValue;
private float heightOfSelectedLogEntry;
private float DeltaHeightOfSelectedLogEntry { get { return heightOfSelectedLogEntry - logItemHeight; } }
/// These properties are used by <see cref="OnBeforeFilterLogs"/> and <see cref="OnAfterFilterLogs"/>.
private int collapsedOrderOfSelectedLogEntry;
private float scrollDistanceToSelectedLogEntry;
// Log items used to visualize the visible debug entries
private readonly DynamicCircularBuffer<DebugLogItem> visibleLogItems = new DynamicCircularBuffer<DebugLogItem>( 32 );
private bool isCollapseOn = false;
// Current indices of debug entries shown on screen
private int currentTopIndex = -1, currentBottomIndex = -1;
private System.Predicate<DebugLogItem> shouldRemoveLogItemPredicate;
private System.Action<DebugLogItem> poolLogItemAction;
public float ItemHeight { get { return logItemHeight; } }
public float SelectedItemHeight { get { return heightOfSelectedLogEntry; } }
private void Awake()
{
scrollView = viewportTransform.GetComponentInParent<ScrollRect>();
scrollView.onValueChanged.AddListener( ( pos ) =>
{
if( manager.IsLogWindowVisible )
UpdateItemsInTheList( false );
} );
}
public void Initialize( DebugLogManager manager, DynamicCircularBuffer<DebugLogEntry> entriesToShow, DynamicCircularBuffer<DebugLogEntryTimestamp> timestampsOfEntriesToShow, float logItemHeight )
{
this.manager = manager;
this.entriesToShow = entriesToShow;
this.timestampsOfEntriesToShow = timestampsOfEntriesToShow;
this.logItemHeight = logItemHeight;
shouldRemoveLogItemPredicate = ShouldRemoveLogItem;
poolLogItemAction = manager.PoolLogItem;
}
public void SetCollapseMode( bool collapse )
{
isCollapseOn = collapse;
}
// A log item is clicked, highlight it
public void OnLogItemClicked( DebugLogItem item )
{
OnLogItemClickedInternal( item.Index, item );
}
// Force expand the log item at specified index
public void SelectAndFocusOnLogItemAtIndex( int itemIndex )
{
if( indexOfSelectedLogEntry != itemIndex ) // Make sure that we aren't deselecting the target log item
OnLogItemClickedInternal( itemIndex );
float viewportHeight = viewportTransform.rect.height;
float transformComponentCenterYAtTop = viewportHeight * 0.5f;
float transformComponentCenterYAtBottom = transformComponent.sizeDelta.y - viewportHeight * 0.5f;
float transformComponentTargetCenterY = itemIndex * logItemHeight + viewportHeight * 0.5f;
if( transformComponentCenterYAtTop == transformComponentCenterYAtBottom )
scrollView.verticalNormalizedPosition = 0.5f;
else
scrollView.verticalNormalizedPosition = Mathf.Clamp01( Mathf.InverseLerp( transformComponentCenterYAtBottom, transformComponentCenterYAtTop, transformComponentTargetCenterY ) );
manager.SnapToBottom = false;
}
private void OnLogItemClickedInternal( int itemIndex, DebugLogItem referenceItem = null )
{
int indexOfPreviouslySelectedLogEntry = indexOfSelectedLogEntry;
DeselectSelectedLogItem();
if( indexOfPreviouslySelectedLogEntry != itemIndex )
{
selectedLogEntry = entriesToShow[itemIndex];
indexOfSelectedLogEntry = itemIndex;
CalculateSelectedLogEntryHeight( referenceItem );
manager.SnapToBottom = false;
}
CalculateContentHeight();
UpdateItemsInTheList( true );
manager.ValidateScrollPosition();
}
// Deselect the currently selected log item
public void DeselectSelectedLogItem()
{
selectedLogEntry = null;
indexOfSelectedLogEntry = int.MaxValue;
heightOfSelectedLogEntry = 0f;
}
/// <summary>
/// Cache the currently selected log item's properties so that its position can be restored after <see cref="OnAfterFilterLogs"/> is called.
/// </summary>
public void OnBeforeFilterLogs()
{
collapsedOrderOfSelectedLogEntry = 0;
scrollDistanceToSelectedLogEntry = 0f;
if( selectedLogEntry != null )
{
if( !isCollapseOn )
{
for( int i = 0; i < indexOfSelectedLogEntry; i++ )
{
if( entriesToShow[i] == selectedLogEntry )
collapsedOrderOfSelectedLogEntry++;
}
}
scrollDistanceToSelectedLogEntry = indexOfSelectedLogEntry * ItemHeight - transformComponent.anchoredPosition.y;
}
}
/// <summary>
/// See <see cref="OnBeforeFilterLogs"/>.
/// </summary>
public void OnAfterFilterLogs()
{
// Refresh selected log entry's index
int newIndexOfSelectedLogEntry = -1;
if( selectedLogEntry != null )
{
for( int i = 0; i < entriesToShow.Count; i++ )
{
if( entriesToShow[i] == selectedLogEntry && collapsedOrderOfSelectedLogEntry-- == 0 )
{
newIndexOfSelectedLogEntry = i;
break;
}
}
}
if( newIndexOfSelectedLogEntry < 0 )
DeselectSelectedLogItem();
else
{
indexOfSelectedLogEntry = newIndexOfSelectedLogEntry;
transformComponent.anchoredPosition = new Vector2( 0f, newIndexOfSelectedLogEntry * ItemHeight - scrollDistanceToSelectedLogEntry );
}
}
// Number of debug entries may have changed, update the list
public void OnLogEntriesUpdated( bool updateAllVisibleItemContents )
{
CalculateContentHeight();
UpdateItemsInTheList( updateAllVisibleItemContents );
}
// A single collapsed log entry at specified index is updated, refresh its item if visible
public void OnCollapsedLogEntryAtIndexUpdated( int index )
{
if( index >= currentTopIndex && index <= currentBottomIndex )
{
DebugLogItem logItem = GetLogItemAtIndex( index );
logItem.ShowCount();
if( timestampsOfEntriesToShow != null )
logItem.UpdateTimestamp( timestampsOfEntriesToShow[index] );
}
}
public void RefreshCollapsedLogEntryCounts()
{
for( int i = 0; i < visibleLogItems.Count; i++ )
visibleLogItems[i].ShowCount();
}
public void OnLogEntriesRemoved( int removedLogCount )
{
if( selectedLogEntry != null )
{
bool isSelectedLogEntryRemoved = isCollapseOn ? ( selectedLogEntry.count == 0 ) : ( indexOfSelectedLogEntry < removedLogCount );
if( isSelectedLogEntryRemoved )
DeselectSelectedLogItem();
else
indexOfSelectedLogEntry = isCollapseOn ? FindIndexOfLogEntryInReverseDirection( selectedLogEntry, indexOfSelectedLogEntry ) : ( indexOfSelectedLogEntry - removedLogCount );
}
if( !manager.IsLogWindowVisible && manager.SnapToBottom )
{
// When log window becomes visible, it refreshes all logs. So unless snap to bottom is disabled, we don't need to
// keep track of either the scroll position or the visible log items' positions.
visibleLogItems.TrimStart( visibleLogItems.Count, poolLogItemAction );
}
else if( !isCollapseOn )
visibleLogItems.TrimStart( Mathf.Clamp( removedLogCount - currentTopIndex, 0, visibleLogItems.Count ), poolLogItemAction );
else
{
visibleLogItems.RemoveAll( shouldRemoveLogItemPredicate );
if( visibleLogItems.Count > 0 )
removedLogCount = currentTopIndex - FindIndexOfLogEntryInReverseDirection( visibleLogItems[0].Entry, visibleLogItems[0].Index );
}
if( visibleLogItems.Count == 0 )
{
currentTopIndex = -1;
if( !manager.SnapToBottom )
transformComponent.anchoredPosition = Vector2.zero;
}
else
{
currentTopIndex = Mathf.Max( 0, currentTopIndex - removedLogCount );
currentBottomIndex = currentTopIndex + visibleLogItems.Count - 1;
float firstVisibleLogItemInitialYPos = visibleLogItems[0].Transform.anchoredPosition.y;
for( int i = 0; i < visibleLogItems.Count; i++ )
{
DebugLogItem logItem = visibleLogItems[i];
logItem.Index = currentTopIndex + i;
// If log window is visible, we need to manually refresh the visible items' visual properties. Otherwise, all log items will be refreshed when log window is opened
if( manager.IsLogWindowVisible )
{
RepositionLogItem( logItem );
ColorLogItem( logItem );
// Update collapsed count of the log items in collapsed mode
if( isCollapseOn )
logItem.ShowCount();
}
}
// Shift the ScrollRect
if( !manager.SnapToBottom )
transformComponent.anchoredPosition = new Vector2( 0f, Mathf.Max( 0f, transformComponent.anchoredPosition.y - ( visibleLogItems[0].Transform.anchoredPosition.y - firstVisibleLogItemInitialYPos ) ) );
}
}
private bool ShouldRemoveLogItem( DebugLogItem logItem )
{
if( logItem.Entry.count == 0 )
{
poolLogItemAction( logItem );
return true;
}
return false;
}
private int FindIndexOfLogEntryInReverseDirection( DebugLogEntry logEntry, int startIndex )
{
for( int i = Mathf.Min( startIndex, entriesToShow.Count - 1 ); i >= 0; i-- )
{
if( entriesToShow[i] == logEntry )
return i;
}
return -1;
}
// Log window's width has changed, update the expanded (currently selected) log's height
public void OnViewportWidthChanged()
{
if( indexOfSelectedLogEntry >= entriesToShow.Count )
return;
CalculateSelectedLogEntryHeight();
CalculateContentHeight();
UpdateItemsInTheList( true );
manager.ValidateScrollPosition();
}
// Log window's height has changed, update the list
public void OnViewportHeightChanged()
{
UpdateItemsInTheList( false );
}
private void CalculateContentHeight()
{
float newHeight = Mathf.Max( 1f, entriesToShow.Count * logItemHeight );
if( selectedLogEntry != null )
newHeight += DeltaHeightOfSelectedLogEntry;
transformComponent.sizeDelta = new Vector2( 0f, newHeight );
}
private void CalculateSelectedLogEntryHeight( DebugLogItem referenceItem = null )
{
if( !referenceItem )
{
if( visibleLogItems.Count == 0 )
{
UpdateItemsInTheList( false ); // Try to generate some DebugLogItems, we need one DebugLogItem to calculate the text height
if( visibleLogItems.Count == 0 ) // No DebugLogItems are generated, weird
return;
}
referenceItem = visibleLogItems[0];
}
heightOfSelectedLogEntry = referenceItem.CalculateExpandedHeight( selectedLogEntry, ( timestampsOfEntriesToShow != null ) ? timestampsOfEntriesToShow[indexOfSelectedLogEntry] : (DebugLogEntryTimestamp?) null );
}
// Calculate the indices of log entries to show
// and handle log items accordingly
private void UpdateItemsInTheList( bool updateAllVisibleItemContents )
{
if( entriesToShow.Count > 0 )
{
float contentPosTop = transformComponent.anchoredPosition.y - 1f;
float contentPosBottom = contentPosTop + viewportTransform.rect.height + 2f;
float positionOfSelectedLogEntry = indexOfSelectedLogEntry * logItemHeight;
if( positionOfSelectedLogEntry <= contentPosBottom )
{
if( positionOfSelectedLogEntry <= contentPosTop )
{
contentPosTop = Mathf.Max( contentPosTop - DeltaHeightOfSelectedLogEntry, positionOfSelectedLogEntry - 1f );
contentPosBottom = Mathf.Max( contentPosBottom - DeltaHeightOfSelectedLogEntry, contentPosTop + 2f );
}
else
contentPosBottom = Mathf.Max( contentPosBottom - DeltaHeightOfSelectedLogEntry, positionOfSelectedLogEntry + 1f );
}
int newBottomIndex = Mathf.Min( (int) ( contentPosBottom / logItemHeight ), entriesToShow.Count - 1 );
int newTopIndex = Mathf.Clamp( (int) ( contentPosTop / logItemHeight ), 0, newBottomIndex );
if( currentTopIndex == -1 )
{
// There are no log items visible on screen,
// just create the new log items
updateAllVisibleItemContents = true;
for( int i = 0, count = newBottomIndex - newTopIndex + 1; i < count; i++ )
visibleLogItems.Add( manager.PopLogItem() );
}
else
{
// There are some log items visible on screen
if( newBottomIndex < currentTopIndex || newTopIndex > currentBottomIndex )
{
// If user scrolled a lot such that, none of the log items are now within
// the bounds of the scroll view, pool all the previous log items and create
// new log items for the new list of visible debug entries
updateAllVisibleItemContents = true;
visibleLogItems.TrimStart( visibleLogItems.Count, poolLogItemAction );
for( int i = 0, count = newBottomIndex - newTopIndex + 1; i < count; i++ )
visibleLogItems.Add( manager.PopLogItem() );
}
else
{
// User did not scroll a lot such that, there are still some log items within
// the bounds of the scroll view. Don't destroy them but update their content,
// if necessary
if( newTopIndex > currentTopIndex )
visibleLogItems.TrimStart( newTopIndex - currentTopIndex, poolLogItemAction );
if( newBottomIndex < currentBottomIndex )
visibleLogItems.TrimEnd( currentBottomIndex - newBottomIndex, poolLogItemAction );
if( newTopIndex < currentTopIndex )
{
for( int i = 0, count = currentTopIndex - newTopIndex; i < count; i++ )
visibleLogItems.AddFirst( manager.PopLogItem() );
// If it is not necessary to update all the log items,
// then just update the newly created log items. Otherwise,
// wait for the major update
if( !updateAllVisibleItemContents )
UpdateLogItemContentsBetweenIndices( newTopIndex, currentTopIndex - 1, newTopIndex );
}
if( newBottomIndex > currentBottomIndex )
{
for( int i = 0, count = newBottomIndex - currentBottomIndex; i < count; i++ )
visibleLogItems.Add( manager.PopLogItem() );
// If it is not necessary to update all the log items,
// then just update the newly created log items. Otherwise,
// wait for the major update
if( !updateAllVisibleItemContents )
UpdateLogItemContentsBetweenIndices( currentBottomIndex + 1, newBottomIndex, newTopIndex );
}
}
}
currentTopIndex = newTopIndex;
currentBottomIndex = newBottomIndex;
if( updateAllVisibleItemContents )
{
// Update all the log items
UpdateLogItemContentsBetweenIndices( currentTopIndex, currentBottomIndex, newTopIndex );
}
}
else if( currentTopIndex != -1 )
{
// There is nothing to show but some log items are still visible; pool them
visibleLogItems.TrimStart( visibleLogItems.Count, poolLogItemAction );
currentTopIndex = -1;
}
}
private DebugLogItem GetLogItemAtIndex( int index )
{
return visibleLogItems[index - currentTopIndex];
}
private void UpdateLogItemContentsBetweenIndices( int topIndex, int bottomIndex, int logItemOffset )
{
for( int i = topIndex; i <= bottomIndex; i++ )
{
DebugLogItem logItem = visibleLogItems[i - logItemOffset];
logItem.SetContent( entriesToShow[i], ( timestampsOfEntriesToShow != null ) ? timestampsOfEntriesToShow[i] : (DebugLogEntryTimestamp?) null, i, i == indexOfSelectedLogEntry );
RepositionLogItem( logItem );
ColorLogItem( logItem );
if( isCollapseOn )
logItem.ShowCount();
else
logItem.HideCount();
}
}
private void RepositionLogItem( DebugLogItem logItem )
{
int index = logItem.Index;
Vector2 anchoredPosition = new Vector2( 1f, -index * logItemHeight );
if( index > indexOfSelectedLogEntry )
anchoredPosition.y -= DeltaHeightOfSelectedLogEntry;
logItem.Transform.anchoredPosition = anchoredPosition;
}
private void ColorLogItem( DebugLogItem logItem )
{
int index = logItem.Index;
if( index == indexOfSelectedLogEntry )
logItem.Image.color = logItemSelectedColor;
else if( index % 2 == 0 )
logItem.Image.color = logItemNormalColor1;
else
logItem.Image.color = logItemNormalColor2;
}
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: ce231987d32488f43b6fb798f7df43f6
timeCreated: 1466373025
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,24 @@
using UnityEngine;
using UnityEngine.EventSystems;
// Listens to drag event on the DebugLogManager's resize button
namespace IngameDebugConsole
{
public class DebugLogResizeListener : MonoBehaviour, IBeginDragHandler, IDragHandler
{
#pragma warning disable 0649
[SerializeField]
private DebugLogManager debugManager;
#pragma warning restore 0649
// This interface must be implemented in order to receive drag events
void IBeginDragHandler.OnBeginDrag( PointerEventData eventData )
{
}
void IDragHandler.OnDrag( PointerEventData eventData )
{
debugManager.Resize( eventData );
}
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 6565f2084f5aef44abe57c988745b9c3
timeCreated: 1601221093
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,47 @@
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
// Listens to scroll events on the scroll rect that debug items are stored
// and decides whether snap to bottom should be true or not
//
// Procedure: if, after a user input (drag or scroll), scrollbar is at the bottom, then
// snap to bottom shall be true, otherwise it shall be false
namespace IngameDebugConsole
{
public class DebugsOnScrollListener : MonoBehaviour, IScrollHandler, IBeginDragHandler, IEndDragHandler
{
public ScrollRect debugsScrollRect;
public DebugLogManager debugLogManager;
public void OnScroll( PointerEventData data )
{
debugLogManager.SnapToBottom = IsScrollbarAtBottom();
}
public void OnBeginDrag( PointerEventData data )
{
debugLogManager.SnapToBottom = false;
}
public void OnEndDrag( PointerEventData data )
{
debugLogManager.SnapToBottom = IsScrollbarAtBottom();
}
public void OnScrollbarDragStart( BaseEventData data )
{
debugLogManager.SnapToBottom = false;
}
public void OnScrollbarDragEnd( BaseEventData data )
{
debugLogManager.SnapToBottom = IsScrollbarAtBottom();
}
private bool IsScrollbarAtBottom()
{
return debugsScrollRect.verticalNormalizedPosition <= 1E-6f;
}
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: cb564dcb180e586429c57456166a76b5
timeCreated: 1466004663
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,73 @@
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.SceneManagement;
#if ENABLE_INPUT_SYSTEM && !ENABLE_LEGACY_INPUT_MANAGER
using UnityEngine.InputSystem.UI;
#endif
namespace IngameDebugConsole
{
// Avoid multiple EventSystems in the scene by activating the embedded EventSystem only if one doesn't already exist in the scene
[DefaultExecutionOrder( 1000 )]
public class EventSystemHandler : MonoBehaviour
{
#pragma warning disable 0649
[SerializeField]
private GameObject embeddedEventSystem;
#pragma warning restore 0649
#if ENABLE_INPUT_SYSTEM && !ENABLE_LEGACY_INPUT_MANAGER
private void Awake()
{
StandaloneInputModule legacyInputModule = embeddedEventSystem.GetComponent<StandaloneInputModule>();
if( legacyInputModule )
{
DestroyImmediate( legacyInputModule );
embeddedEventSystem.AddComponent<InputSystemUIInputModule>();
}
}
#endif
private void OnEnable()
{
SceneManager.sceneLoaded -= OnSceneLoaded;
SceneManager.sceneLoaded += OnSceneLoaded;
SceneManager.sceneUnloaded -= OnSceneUnloaded;
SceneManager.sceneUnloaded += OnSceneUnloaded;
ActivateEventSystemIfNeeded();
}
private void OnDisable()
{
SceneManager.sceneLoaded -= OnSceneLoaded;
SceneManager.sceneUnloaded -= OnSceneUnloaded;
DeactivateEventSystem();
}
private void OnSceneLoaded( Scene scene, LoadSceneMode mode )
{
DeactivateEventSystem();
ActivateEventSystemIfNeeded();
}
private void OnSceneUnloaded( Scene current )
{
// Deactivate the embedded EventSystem before changing scenes because the new scene might have its own EventSystem
DeactivateEventSystem();
}
private void ActivateEventSystemIfNeeded()
{
if( embeddedEventSystem && !EventSystem.current )
embeddedEventSystem.SetActive( true );
}
private void DeactivateEventSystem()
{
if( embeddedEventSystem )
embeddedEventSystem.SetActive( false );
}
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: c3cc1b407f337e641ad32a2e91d5b478
timeCreated: 1658741613
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
File diff suppressed because one or more lines are too long
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ebc67c409e5c4403fa46351fcd7760cc
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,21 @@
fileFormatVersion: 2
guid: c79a8049596974cdf803c6cd5e869914
TrueTypeFontImporter:
externalObjects: {}
serializedVersion: 4
fontSize: 16
forceTextureCase: -2
characterSpacing: 0
characterPadding: 1
includeFontData: 1
fontNames:
- Source Han Sans SC
fallbackFontReferences: []
customCharacters:
fontRenderingMode: 0
ascentCalculationMode: 1
useLegacyBoundsCalculation: 0
shouldRoundAdvanceValue: 1
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: cb5d7b23a9e684a41a6a5d4f300eb1e6
folderAsset: yes
timeCreated: 1465925237
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,135 @@
fileFormatVersion: 2
guid: 7a9e374666ad6cc47807bb001844f3d8
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 5
maxTextureSize: 32
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 16
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 1
cookieLightType: 1
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 1
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 1
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 1
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 1
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
spritePackingTag: DebugLogUI
pSDRemoveMatte: 1
pSDShowRemoveMatteOption: 1
userData:
assetBundleName:
assetBundleVariant:

Some files were not shown because too many files have changed in this diff Show More