├── ProjectSettings ├── ProjectVersion.txt ├── TagManager.asset ├── AudioManager.asset ├── InputManager.asset ├── NavMeshAreas.asset ├── NavMeshLayers.asset ├── TimeManager.asset ├── DynamicsManager.asset ├── EditorSettings.asset ├── NetworkManager.asset ├── ProjectSettings.asset ├── QualitySettings.asset ├── GraphicsSettings.asset ├── Physics2DSettings.asset ├── UnityAdsSettings.asset ├── ClusterInputManager.asset ├── EditorBuildSettings.asset └── UnityConnectSettings.asset ├── imgs ├── asset-store.png └── screen-logger.png ├── Assets ├── ScreenLogger │ ├── Readme.txt.meta │ ├── Example │ │ ├── Materials │ │ │ ├── Red.mat │ │ │ ├── Grid.mat │ │ │ ├── Grid.mat.meta │ │ │ ├── Red.mat.meta │ │ │ ├── CheckerMaterial.mat.meta │ │ │ └── CheckerMaterial.mat │ │ ├── Models │ │ │ ├── Room.fbx │ │ │ ├── Sphere.fbx │ │ │ ├── Room.fbx.meta │ │ │ └── Sphere.fbx.meta │ │ ├── Textures │ │ │ ├── Grid.png │ │ │ ├── Checkerboard.png │ │ │ ├── Grid.png.meta │ │ │ └── Checkerboard.png.meta │ │ ├── ExampleScene.unity │ │ ├── LoadingScene.unity │ │ ├── LoadingScene.unity.meta │ │ ├── Models.meta │ │ ├── Scripts.meta │ │ ├── Textures.meta │ │ ├── Materials.meta │ │ ├── ExampleScene.unity.meta │ │ └── Scripts │ │ │ ├── Rotator.cs.meta │ │ │ ├── BouncingBall.cs.meta │ │ │ ├── Test.cs.meta │ │ │ ├── Rotator.cs │ │ │ ├── Test.cs │ │ │ └── BouncingBall.cs │ ├── Editor.meta │ ├── Resources │ │ ├── ScreenLoggerPrefab.prefab │ │ └── ScreenLoggerPrefab.prefab.meta │ ├── Editor │ │ ├── ScreenLoggerEditor.cs.meta │ │ └── ScreenLoggerEditor.cs │ ├── Example.meta │ ├── Resources.meta │ ├── ScreenLogger.cs.meta │ ├── Readme.txt │ └── ScreenLogger.cs └── ScreenLogger.meta ├── .gitignore ├── README.md └── LICENSE /ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 5.5.0f3 2 | -------------------------------------------------------------------------------- /imgs/asset-store.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gportelli/UnityScreenLogger/HEAD/imgs/asset-store.png -------------------------------------------------------------------------------- /imgs/screen-logger.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gportelli/UnityScreenLogger/HEAD/imgs/screen-logger.png -------------------------------------------------------------------------------- /ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gportelli/UnityScreenLogger/HEAD/ProjectSettings/TagManager.asset -------------------------------------------------------------------------------- /ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gportelli/UnityScreenLogger/HEAD/ProjectSettings/AudioManager.asset -------------------------------------------------------------------------------- /ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gportelli/UnityScreenLogger/HEAD/ProjectSettings/InputManager.asset -------------------------------------------------------------------------------- /ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gportelli/UnityScreenLogger/HEAD/ProjectSettings/NavMeshAreas.asset -------------------------------------------------------------------------------- /ProjectSettings/NavMeshLayers.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gportelli/UnityScreenLogger/HEAD/ProjectSettings/NavMeshLayers.asset -------------------------------------------------------------------------------- /ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gportelli/UnityScreenLogger/HEAD/ProjectSettings/TimeManager.asset -------------------------------------------------------------------------------- /ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gportelli/UnityScreenLogger/HEAD/ProjectSettings/DynamicsManager.asset -------------------------------------------------------------------------------- /ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gportelli/UnityScreenLogger/HEAD/ProjectSettings/EditorSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gportelli/UnityScreenLogger/HEAD/ProjectSettings/NetworkManager.asset -------------------------------------------------------------------------------- /ProjectSettings/ProjectSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gportelli/UnityScreenLogger/HEAD/ProjectSettings/ProjectSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gportelli/UnityScreenLogger/HEAD/ProjectSettings/QualitySettings.asset -------------------------------------------------------------------------------- /ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gportelli/UnityScreenLogger/HEAD/ProjectSettings/GraphicsSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gportelli/UnityScreenLogger/HEAD/ProjectSettings/Physics2DSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/UnityAdsSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gportelli/UnityScreenLogger/HEAD/ProjectSettings/UnityAdsSettings.asset -------------------------------------------------------------------------------- /Assets/ScreenLogger/Readme.txt.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9437396a5b562834caaafbf470b9de6f 3 | TextScriptImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gportelli/UnityScreenLogger/HEAD/ProjectSettings/ClusterInputManager.asset -------------------------------------------------------------------------------- /ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gportelli/UnityScreenLogger/HEAD/ProjectSettings/EditorBuildSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gportelli/UnityScreenLogger/HEAD/ProjectSettings/UnityConnectSettings.asset -------------------------------------------------------------------------------- /Assets/ScreenLogger.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fe0641e669a749f4981d096f4778a75b 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/ScreenLogger/Example/Materials/Red.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gportelli/UnityScreenLogger/HEAD/Assets/ScreenLogger/Example/Materials/Red.mat -------------------------------------------------------------------------------- /Assets/ScreenLogger/Example/Models/Room.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gportelli/UnityScreenLogger/HEAD/Assets/ScreenLogger/Example/Models/Room.fbx -------------------------------------------------------------------------------- /Assets/ScreenLogger/Example/Models/Sphere.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gportelli/UnityScreenLogger/HEAD/Assets/ScreenLogger/Example/Models/Sphere.fbx -------------------------------------------------------------------------------- /Assets/ScreenLogger/Example/Textures/Grid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gportelli/UnityScreenLogger/HEAD/Assets/ScreenLogger/Example/Textures/Grid.png -------------------------------------------------------------------------------- /Assets/ScreenLogger/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f32fe085c754fa04b91b3a6c43bc2ce4 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/ScreenLogger/Example/ExampleScene.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gportelli/UnityScreenLogger/HEAD/Assets/ScreenLogger/Example/ExampleScene.unity -------------------------------------------------------------------------------- /Assets/ScreenLogger/Example/LoadingScene.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gportelli/UnityScreenLogger/HEAD/Assets/ScreenLogger/Example/LoadingScene.unity -------------------------------------------------------------------------------- /Assets/ScreenLogger/Example/LoadingScene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3b83d53789e09804ba3778eea2dbe451 3 | DefaultImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/ScreenLogger/Example/Materials/Grid.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gportelli/UnityScreenLogger/HEAD/Assets/ScreenLogger/Example/Materials/Grid.mat -------------------------------------------------------------------------------- /Assets/ScreenLogger/Example/Materials/Grid.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 05c91246f190d8042996f5ec820bfaf3 3 | NativeFormatImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/ScreenLogger/Example/Materials/Red.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fd59189be81451f458764bf1cdd25a9e 3 | NativeFormatImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/ScreenLogger/Example/Models.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 181262267965c3d44ae3205bcac871ba 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/ScreenLogger/Example/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a851d2b288f579b4497912edd5624a63 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/ScreenLogger/Example/Textures.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2cf65be3fa9cd4548a45a13aca75abc0 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/ScreenLogger/Example/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e3e10b0e7cfda824084a919971bf508e 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/ScreenLogger/Example/Materials/CheckerMaterial.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 888f526cf4c0c9040bf022c4061c571b 3 | NativeFormatImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/ScreenLogger/Example/Textures/Checkerboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gportelli/UnityScreenLogger/HEAD/Assets/ScreenLogger/Example/Textures/Checkerboard.png -------------------------------------------------------------------------------- /Assets/ScreenLogger/Resources/ScreenLoggerPrefab.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gportelli/UnityScreenLogger/HEAD/Assets/ScreenLogger/Resources/ScreenLoggerPrefab.prefab -------------------------------------------------------------------------------- /Assets/ScreenLogger/Resources/ScreenLoggerPrefab.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e0aeafd6ca709b5449035c42f4e3879e 3 | NativeFormatImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/ScreenLogger/Example/Materials/CheckerMaterial.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gportelli/UnityScreenLogger/HEAD/Assets/ScreenLogger/Example/Materials/CheckerMaterial.mat -------------------------------------------------------------------------------- /Assets/ScreenLogger/Example/ExampleScene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9e0c31a9f19b4fd4696a1a66845e232b 3 | timeCreated: 1446160084 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/ScreenLogger/Editor/ScreenLoggerEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e0180b985be6c854285448ae9f8a74f7 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/ScreenLogger/Example/Scripts/Rotator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ebd309e04018d3e4a93bbc26b1eaebad 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/ScreenLogger/Example/Scripts/BouncingBall.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 07433b73324ea6048a600d42874207b4 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/ScreenLogger/Example.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 74286654e6c9d044d8e4be75e0237599 3 | folderAsset: yes 4 | timeCreated: 1446318809 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/ScreenLogger/Resources.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 82f7e660f0fac1641b2d70733c7c31c8 3 | folderAsset: yes 4 | timeCreated: 1462023438 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/ScreenLogger/ScreenLogger.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: aa0afa61f775305429a6c5930482c488 3 | timeCreated: 1446157576 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/ScreenLogger/Example/Scripts/Test.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8274712347e6d9f488347bc3a4ec2c82 3 | timeCreated: 1446157641 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # =============== # 2 | # Unity generated # 3 | # =============== # 4 | Temp/ 5 | Obj/ 6 | UnityGenerated/ 7 | Library/ 8 | ProjectSettings/ProjectVersion.txt 9 | AssetStore/ 10 | Assets/AssetStoreTools/ 11 | Assets/AssetStoreTools.meta 12 | 13 | # ===================================== # 14 | # Visual Studio / MonoDevelop generated # 15 | # ===================================== # 16 | ExportedObj/ 17 | *.svd 18 | *.userprefs 19 | *.csproj 20 | *.pidb 21 | *.suo 22 | *.sln 23 | *.user 24 | *.unityproj 25 | *.booproj 26 | .vs 27 | 28 | # ============ # 29 | # OS generated # 30 | # ============ # 31 | .DS_Store 32 | .DS_Store? 33 | ._* 34 | .Spotlight-V100 35 | .Trashes 36 | Icon? 37 | ehthumbs.db 38 | Thumbs.db 39 | 40 | ExternalAssets/ 41 | Video/ 42 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Unity Screen Logger 2 | A simple on-screen logger for Unity 3D. 3 | 4 | ![Screen Logger](https://raw.githubusercontent.com/gportelli/UnityScreenLogger/master/imgs/screen-logger.png) 5 | 6 | Editor parameters: 7 | - Persistent script 8 | - Font size 9 | - Text colors (normal, warnings, errors) 10 | - Log filtering by type 11 | - Logger box width and height in screen percentage 12 | - Logger box anchor position (top left, top right, bottom left, botom right) 13 | - Background color and opacity 14 | - Show in editor flag 15 | - Enable stack trace logging for each message type 16 | 17 | [![Download on asset store](https://raw.githubusercontent.com/gportelli/UnityScreenLogger/master/imgs/asset-store.png)](https://www.assetstore.unity3d.com/en/#!/content/49114) 18 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright © 2016 Screen Logger - Giuseppe Portelli 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /Assets/ScreenLogger/Example/Textures/Grid.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c7d4983e5d5306d4da230fa287d9d0cd 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | serializedVersion: 2 6 | mipmaps: 7 | mipMapMode: 0 8 | enableMipMap: 1 9 | linearTexture: 0 10 | correctGamma: 0 11 | fadeOut: 0 12 | borderMipMap: 0 13 | mipMapFadeDistanceStart: 1 14 | mipMapFadeDistanceEnd: 3 15 | bumpmap: 16 | convertToNormalMap: 0 17 | externalNormalMap: 0 18 | heightScale: .25 19 | normalMapFilter: 0 20 | isReadable: 0 21 | grayScaleToAlpha: 0 22 | generateCubemap: 0 23 | seamlessCubemap: 0 24 | textureFormat: -1 25 | maxTextureSize: 1024 26 | textureSettings: 27 | filterMode: -1 28 | aniso: 2 29 | mipBias: -1 30 | wrapMode: -1 31 | nPOTScale: 1 32 | lightmap: 0 33 | compressionQuality: 50 34 | spriteMode: 0 35 | spriteExtrude: 1 36 | spriteMeshType: 1 37 | alignment: 0 38 | spritePivot: {x: .5, y: .5} 39 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 40 | spritePixelsToUnits: 100 41 | alphaIsTransparency: 0 42 | textureType: -1 43 | buildTargetSettings: [] 44 | spriteSheet: 45 | sprites: [] 46 | spritePackingTag: 47 | userData: 48 | -------------------------------------------------------------------------------- /Assets/ScreenLogger/Example/Textures/Checkerboard.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8f170bc12f6c3004ea6357ce9e86d958 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | serializedVersion: 2 6 | mipmaps: 7 | mipMapMode: 0 8 | enableMipMap: 1 9 | linearTexture: 0 10 | correctGamma: 0 11 | fadeOut: 0 12 | borderMipMap: 0 13 | mipMapFadeDistanceStart: 1 14 | mipMapFadeDistanceEnd: 3 15 | bumpmap: 16 | convertToNormalMap: 0 17 | externalNormalMap: 0 18 | heightScale: .25 19 | normalMapFilter: 0 20 | isReadable: 0 21 | grayScaleToAlpha: 0 22 | generateCubemap: 0 23 | seamlessCubemap: 0 24 | textureFormat: -1 25 | maxTextureSize: 1024 26 | textureSettings: 27 | filterMode: -1 28 | aniso: -1 29 | mipBias: -1 30 | wrapMode: -1 31 | nPOTScale: 1 32 | lightmap: 0 33 | compressionQuality: 50 34 | spriteMode: 0 35 | spriteExtrude: 1 36 | spriteMeshType: 1 37 | alignment: 0 38 | spritePivot: {x: .5, y: .5} 39 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 40 | spritePixelsToUnits: 100 41 | alphaIsTransparency: 0 42 | textureType: -1 43 | buildTargetSettings: [] 44 | spriteSheet: 45 | sprites: [] 46 | spritePackingTag: 47 | userData: 48 | -------------------------------------------------------------------------------- /Assets/ScreenLogger/Example/Scripts/Rotator.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | public class Rotator : MonoBehaviour { 5 | public float RotationSpeed = 70; 6 | 7 | // Use this for initialization 8 | void Start () { 9 | 10 | } 11 | 12 | // Update is called once per frame 13 | void Update () { 14 | transform.Rotate(new Vector3(0, RotationSpeed * Time.deltaTime, 0)); 15 | } 16 | } 17 | 18 | /* 19 | The MIT License 20 | 21 | Copyright © 2016 Screen Logger - Giuseppe Portelli 22 | 23 | Permission is hereby granted, free of charge, to any person obtaining a copy 24 | of this software and associated documentation files (the "Software"), to deal 25 | in the Software without restriction, including without limitation the rights 26 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 27 | copies of the Software, and to permit persons to whom the Software is 28 | furnished to do so, subject to the following conditions: 29 | 30 | The above copyright notice and this permission notice shall be included in 31 | all copies or substantial portions of the Software. 32 | 33 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 34 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 35 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 36 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 37 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 38 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 39 | THE SOFTWARE. 40 | */ -------------------------------------------------------------------------------- /Assets/ScreenLogger/Example/Models/Room.fbx.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2c24b244d67b2564da433617359e63aa 3 | ModelImporter: 4 | serializedVersion: 16 5 | fileIDToRecycleName: 6 | 100000: //RootNode 7 | 400000: //RootNode 8 | 2300000: //RootNode 9 | 3300000: //RootNode 10 | 4300000: Box001 11 | 9500000: //RootNode 12 | materials: 13 | importMaterials: 1 14 | materialName: 0 15 | materialSearch: 1 16 | animations: 17 | legacyGenerateAnimations: 4 18 | bakeSimulation: 0 19 | optimizeGameObjects: 0 20 | motionNodeName: 21 | animationCompression: 1 22 | animationRotationError: .5 23 | animationPositionError: .5 24 | animationScaleError: .5 25 | animationWrapMode: 0 26 | extraExposedTransformPaths: [] 27 | clipAnimations: [] 28 | isReadable: 1 29 | meshes: 30 | lODScreenPercentages: [] 31 | globalScale: .200000003 32 | meshCompression: 0 33 | addColliders: 0 34 | importBlendShapes: 1 35 | swapUVChannels: 0 36 | generateSecondaryUV: 0 37 | useFileUnits: 1 38 | optimizeMeshForGPU: 1 39 | weldVertices: 1 40 | secondaryUVAngleDistortion: 8 41 | secondaryUVAreaDistortion: 15.000001 42 | secondaryUVHardAngle: 88 43 | secondaryUVPackMargin: 4 44 | tangentSpace: 45 | normalSmoothAngle: 60 46 | splitTangentsAcrossUV: 1 47 | normalImportMode: 0 48 | tangentImportMode: 1 49 | importAnimation: 1 50 | copyAvatar: 0 51 | humanDescription: 52 | human: [] 53 | skeleton: [] 54 | armTwist: .5 55 | foreArmTwist: .5 56 | upperLegTwist: .5 57 | legTwist: .5 58 | armStretch: .0500000007 59 | legStretch: .0500000007 60 | feetSpacing: 0 61 | rootMotionBoneName: 62 | lastHumanDescriptionAvatarSource: {instanceID: 0} 63 | animationType: 0 64 | additionalBone: 0 65 | userData: 66 | -------------------------------------------------------------------------------- /Assets/ScreenLogger/Example/Models/Sphere.fbx.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c55467fe07970984a9bfdcde40bfe4e4 3 | ModelImporter: 4 | serializedVersion: 16 5 | fileIDToRecycleName: 6 | 100000: //RootNode 7 | 400000: //RootNode 8 | 2300000: //RootNode 9 | 3300000: //RootNode 10 | 4300000: Sphere001 11 | 9500000: //RootNode 12 | materials: 13 | importMaterials: 1 14 | materialName: 0 15 | materialSearch: 1 16 | animations: 17 | legacyGenerateAnimations: 4 18 | bakeSimulation: 0 19 | optimizeGameObjects: 0 20 | motionNodeName: 21 | animationCompression: 1 22 | animationRotationError: .5 23 | animationPositionError: .5 24 | animationScaleError: .5 25 | animationWrapMode: 0 26 | extraExposedTransformPaths: [] 27 | clipAnimations: [] 28 | isReadable: 1 29 | meshes: 30 | lODScreenPercentages: [] 31 | globalScale: .100000001 32 | meshCompression: 0 33 | addColliders: 0 34 | importBlendShapes: 1 35 | swapUVChannels: 0 36 | generateSecondaryUV: 0 37 | useFileUnits: 1 38 | optimizeMeshForGPU: 1 39 | weldVertices: 1 40 | secondaryUVAngleDistortion: 8 41 | secondaryUVAreaDistortion: 15.000001 42 | secondaryUVHardAngle: 88 43 | secondaryUVPackMargin: 4 44 | tangentSpace: 45 | normalSmoothAngle: 60 46 | splitTangentsAcrossUV: 1 47 | normalImportMode: 0 48 | tangentImportMode: 1 49 | importAnimation: 1 50 | copyAvatar: 0 51 | humanDescription: 52 | human: [] 53 | skeleton: [] 54 | armTwist: .5 55 | foreArmTwist: .5 56 | upperLegTwist: .5 57 | legTwist: .5 58 | armStretch: .0500000007 59 | legStretch: .0500000007 60 | feetSpacing: 0 61 | rootMotionBoneName: 62 | lastHumanDescriptionAvatarSource: {instanceID: 0} 63 | animationType: 0 64 | additionalBone: 0 65 | userData: 66 | -------------------------------------------------------------------------------- /Assets/ScreenLogger/Editor/ScreenLoggerEditor.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | using UnityEditor; 4 | 5 | namespace AClockworkBerry 6 | { 7 | [CustomEditor(typeof(ScreenLogger))] 8 | public class ScreenLoggerEditor : Editor 9 | { 10 | [MenuItem("GameObject/Create Other/Screen Logger")] 11 | static void AddScreenLogger() 12 | { 13 | if (GameObject.FindObjectOfType() == null) 14 | { 15 | GameObject gameObject = new GameObject(); 16 | gameObject.name = "ScreenLogger"; 17 | gameObject.AddComponent(); 18 | } 19 | else 20 | { 21 | Debug.LogError("ScreenLogger already added to the scene."); 22 | } 23 | } 24 | 25 | public override void OnInspectorGUI() 26 | { 27 | base.DrawDefaultInspector(); 28 | 29 | ScreenLogger.Instance.InspectorGUIUpdated(); 30 | } 31 | } 32 | } 33 | 34 | /* 35 | The MIT License 36 | 37 | Copyright © 2016 Screen Logger - Giuseppe Portelli 38 | 39 | Permission is hereby granted, free of charge, to any person obtaining a copy 40 | of this software and associated documentation files (the "Software"), to deal 41 | in the Software without restriction, including without limitation the rights 42 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 43 | copies of the Software, and to permit persons to whom the Software is 44 | furnished to do so, subject to the following conditions: 45 | 46 | The above copyright notice and this permission notice shall be included in 47 | all copies or substantial portions of the Software. 48 | 49 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 50 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 51 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 52 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 53 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 54 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 55 | THE SOFTWARE. 56 | */ -------------------------------------------------------------------------------- /Assets/ScreenLogger/Example/Scripts/Test.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | using AClockworkBerry; 4 | using UnityEngine.SceneManagement; 5 | 6 | public class Test : MonoBehaviour 7 | { 8 | float timeout = 5, lasttime = -1; 9 | 10 | void Start() 11 | { 12 | ScreenLogger.Instance.ShowLog = true; 13 | 14 | TestMessageTypes(); 15 | } 16 | 17 | void Update() 18 | { 19 | if (timeout > 0) 20 | timeout -= Time.deltaTime; 21 | 22 | if ((int)lasttime != (int)timeout && timeout > 0) 23 | Debug.Log("-" + ((int)timeout + 1)); 24 | 25 | lasttime = timeout; 26 | 27 | if (timeout <= 0 && timeout != -1) 28 | { 29 | timeout = -1; 30 | Debug.Log("Loading new scene..."); 31 | SceneManager.LoadScene("ExampleScene"); 32 | } 33 | } 34 | 35 | void TestMessageTypes() 36 | { 37 | Debug.Log("Log message..."); 38 | Debug.LogWarning("Warning message..."); 39 | Debug.LogError("Error message..."); 40 | } 41 | } 42 | 43 | /* 44 | The MIT License 45 | 46 | Copyright © 2016 Screen Logger - Giuseppe Portelli 47 | 48 | Permission is hereby granted, free of charge, to any person obtaining a copy 49 | of this software and associated documentation files (the "Software"), to deal 50 | in the Software without restriction, including without limitation the rights 51 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 52 | copies of the Software, and to permit persons to whom the Software is 53 | furnished to do so, subject to the following conditions: 54 | 55 | The above copyright notice and this permission notice shall be included in 56 | all copies or substantial portions of the Software. 57 | 58 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 59 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 60 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 61 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 62 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 63 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 64 | THE SOFTWARE. 65 | */ -------------------------------------------------------------------------------- /Assets/ScreenLogger/Example/Scripts/BouncingBall.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | using AClockworkBerry; 4 | 5 | public class BouncingBall : MonoBehaviour { 6 | public float Acceleration = -1; 7 | public float HorizVelocity = 1; 8 | public float Wall = 5; 9 | public float Radius = 1; 10 | public float RotationSpeed = 1; 11 | 12 | private Vector3 Velocity; 13 | private float MaxVelocity; 14 | 15 | void Start () { 16 | Velocity = new Vector3(HorizVelocity, 0, 0); 17 | 18 | MaxVelocity = Mathf.Sqrt(2 * -Acceleration * (transform.position.y - Radius)); 19 | transform.position = new Vector3(0, transform.position.y, 0); 20 | 21 | Debug.LogWarning("Start..."); 22 | } 23 | 24 | void Update () { 25 | if (Input.GetButtonDown("Fire1")) 26 | ScreenLogger.Instance.ShowLog = !ScreenLogger.Instance.ShowLog; 27 | 28 | Velocity.y += Acceleration * Time.deltaTime; 29 | transform.position += Velocity * Time.deltaTime; 30 | 31 | if (transform.position.y - Radius < 0) 32 | { 33 | transform.position = new Vector3(transform.position.x, Radius, 0); 34 | Velocity.y = MaxVelocity; 35 | 36 | Debug.Log("Boing at " + transform.position.x + "..."); 37 | } 38 | 39 | if (Mathf.Abs(transform.position.x) + Radius > Wall) 40 | { 41 | transform.position = new Vector3( 42 | transform.position.x > 0 ? Wall - Radius : -Wall + Radius, 43 | transform.position.y, 44 | 0); 45 | 46 | Velocity.x *= -1; 47 | } 48 | 49 | transform.Rotate(new Vector3(0, RotationSpeed * Time.deltaTime, 0)); 50 | } 51 | } 52 | 53 | /* 54 | The MIT License 55 | 56 | Copyright © 2016 Screen Logger - Giuseppe Portelli 57 | 58 | Permission is hereby granted, free of charge, to any person obtaining a copy 59 | of this software and associated documentation files (the "Software"), to deal 60 | in the Software without restriction, including without limitation the rights 61 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 62 | copies of the Software, and to permit persons to whom the Software is 63 | furnished to do so, subject to the following conditions: 64 | 65 | The above copyright notice and this permission notice shall be included in 66 | all copies or substantial portions of the Software. 67 | 68 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 69 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 70 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 71 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 72 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 73 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 74 | THE SOFTWARE. 75 | */ -------------------------------------------------------------------------------- /Assets/ScreenLogger/Readme.txt: -------------------------------------------------------------------------------- 1 | Screen Logger for Unity 3D 2 | Version 1.1 3 | Giuseppe Portelli - giuseppe@aclockworkberry.com 4 | 5 | Requires Unity 4.5 or higher. 6 | 7 | Screen Logger is a simple and fully customizable screen logger. Just put it on a scene and you will see on screen output for each call to Debug.Log/LogWarning/LogError. 8 | 9 | Features 10 | * Persistent 11 | * Filter by message type 12 | * Adjust font size 13 | * Adjust color for each message type 14 | * Adjust overlay size, anchoring and background color/opacity 15 | * Toggle stack trace logging for each message type 16 | * Toggle in editor visualization 17 | 18 | Documentation 19 | Screen logging is very useful when you are debugging a build of your game, for example when you are building for mobile or game consoles, or when you are testing things like screen resolution management which you cannot test directly in editor. 20 | 21 | Screen Logger intercepts every call to Debug.Log / Debug.LogWarning / Debug.LogError and displays each log message on a customizable screen overlay, you won't need to add extra logging logic to your code, you will get on-screen the same output you have in editor including stack traces. 22 | 23 | Open a scene and select from main menu: GameObject > Create Other > Screen Logger. A new ScreenLogger game object will be added to your scene. From this object you can customize all the logging features using the inspector. If you add the Screen Logger to the game's first scene and you keep the "Is Persistent" flag set to true, the object will persist over all the game scenes and you will always see logs on screen even when you load a new scene. 24 | 25 | You can also add the logger to your scene by code. The ScreenLogger class implements a Singleton pattern, you can access the unique instance of ScreenLogger from ScreenLogger.Instance. 26 | If no logger has been added to the scene yet, the first call to ScreenLogger.Instance will create a new ScreenLogger and add it to the scene. 27 | 28 | // Shows the screen logger (creates and adds it to the scene if it doesn't exist) 29 | ScreenLogger.Instance.ShowLog = true; 30 | 31 | // Hides the screen logger 32 | ScreenLogger.Instance.ShowLog = false; 33 | 34 | Screen Logger Properties 35 | * Is Persistent - if set to true, the Screen Logger object will persist when you load a new scene 36 | * Show in Editor - useful to preview the log overlay in editor 37 | * Height - the height of the log overlay as a percentage of the screen height 38 | * Width - the hwidth of the log overlay as a percentage of the screen width 39 | * Margin - margin of the log overlay in pixels from the screen borders 40 | * Anchor Position - top-left, top-right, bottom-left, bottom-right 41 | * Font Size - log text font size 42 | * Background Opacity - 0 is transparent, 1 is totally opaque 43 | * Background Color - background color for the log overlay 44 | * Log Messages - toggles log messages output 45 | * Log Warnings - toggles warning messages output 46 | * Log Errors - toggles errors/asserts/exceptions output 47 | * Message Color - text color for log messages 48 | * Warning Color - text color for warning messages 49 | * Error Color - text color for error/assert/exception messages 50 | * Stack Trace Messages - toggles stack trace log for messages 51 | * Stack Trace Warnings - toggles stack trace log for warnings 52 | * Stack Trace Errors - toggles stack trace log for errors/asserts/exceptions 53 | 54 | 55 | -------------------------------------------------------------------------------- /Assets/ScreenLogger/ScreenLogger.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections.Generic; 3 | using System; 4 | using UnityEngine.SceneManagement; 5 | 6 | namespace AClockworkBerry 7 | { 8 | 9 | public class ScreenLogger : MonoBehaviour 10 | { 11 | public static bool IsPersistent = true; 12 | 13 | private static ScreenLogger instance; 14 | private static bool instantiated = false; 15 | 16 | class LogMessage 17 | { 18 | public string Message; 19 | public LogType Type; 20 | 21 | public LogMessage(string msg, LogType type) 22 | { 23 | Message = msg; 24 | Type = type; 25 | } 26 | } 27 | 28 | public enum LogAnchor 29 | { 30 | TopLeft, 31 | TopRight, 32 | BottomLeft, 33 | BottomRight 34 | } 35 | 36 | public bool ShowLog = true; 37 | public bool ShowInEditor = true; 38 | 39 | 40 | [Tooltip("Height of the log area as a percentage of the screen height")] 41 | [Range(0.3f, 1.0f)] 42 | public float Height = 0.5f; 43 | 44 | [Tooltip("Width of the log area as a percentage of the screen width")] 45 | [Range(0.3f, 1.0f)] 46 | public float Width = 0.5f; 47 | 48 | public int Margin = 20; 49 | 50 | public LogAnchor AnchorPosition = LogAnchor.BottomLeft; 51 | 52 | public int FontSize = 14; 53 | 54 | [Range(0f, 01f)] 55 | public float BackgroundOpacity = 0.5f; 56 | public Color BackgroundColor = Color.black; 57 | 58 | public bool LogMessages = true; 59 | public bool LogWarnings = true; 60 | public bool LogErrors = true; 61 | 62 | public Color MessageColor = Color.white; 63 | public Color WarningColor = Color.yellow; 64 | public Color ErrorColor = new Color(1, 0.5f, 0.5f); 65 | 66 | public bool StackTraceMessages = false; 67 | public bool StackTraceWarnings = false; 68 | public bool StackTraceErrors = true; 69 | 70 | static Queue queue = new Queue(); 71 | 72 | GUIStyle styleContainer, styleText; 73 | int padding = 5; 74 | 75 | private bool destroying = false; 76 | private bool styleChanged = true; 77 | 78 | public static ScreenLogger Instance 79 | { 80 | get 81 | { 82 | if (instantiated) return instance; 83 | 84 | instance = GameObject.FindObjectOfType(typeof(ScreenLogger)) as ScreenLogger; 85 | 86 | // Object not found, we create a new one 87 | if (instance == null) 88 | { 89 | // Try to load the default prefab 90 | try 91 | { 92 | instance = Instantiate(Resources.Load("ScreenLoggerPrefab", typeof(ScreenLogger))) as ScreenLogger; 93 | } 94 | catch 95 | { 96 | Debug.Log("Failed to load default Screen Logger prefab..."); 97 | instance = new GameObject("ScreenLogger", typeof(ScreenLogger)).GetComponent(); 98 | } 99 | 100 | // Problem during the creation, this should not happen 101 | if (instance == null) 102 | { 103 | Debug.LogError("Problem during the creation of ScreenLogger"); 104 | } 105 | else instantiated = true; 106 | } 107 | else 108 | { 109 | instantiated = true; 110 | } 111 | 112 | return instance; 113 | } 114 | } 115 | 116 | public void Awake() 117 | { 118 | ScreenLogger[] obj = GameObject.FindObjectsOfType(); 119 | 120 | if (obj.Length > 1) 121 | { 122 | Debug.Log("Destroying ScreenLogger, already exists..."); 123 | 124 | destroying = true; 125 | 126 | Destroy(gameObject); 127 | return; 128 | } 129 | 130 | InitStyles(); 131 | 132 | if (IsPersistent) 133 | DontDestroyOnLoad(this); 134 | 135 | SceneManager.sceneLoaded += OnSceneLoaded; 136 | } 137 | 138 | void OnSceneLoaded(Scene scene, LoadSceneMode mode) 139 | { 140 | styleChanged = true; 141 | } 142 | 143 | private void InitStyles() 144 | { 145 | Texture2D back = new Texture2D(1, 1); 146 | BackgroundColor.a = BackgroundOpacity; 147 | back.SetPixel(0, 0, BackgroundColor); 148 | back.Apply(); 149 | 150 | styleContainer = new GUIStyle(); 151 | styleContainer.normal.background = back; 152 | styleContainer.wordWrap = false; 153 | styleContainer.padding = new RectOffset(padding, padding, padding, padding); 154 | 155 | styleText = new GUIStyle(); 156 | styleText.fontSize = FontSize; 157 | 158 | styleChanged = false; 159 | } 160 | 161 | void OnEnable() 162 | { 163 | if (!ShowInEditor && Application.isEditor) return; 164 | 165 | queue = new Queue(); 166 | 167 | #if UNITY_4_5 || UNITY_4_6 || UNITY_4_7 168 | Application.RegisterLogCallback(HandleLog); 169 | #else 170 | //Application.logMessageReceived += HandleLog; 171 | Application.logMessageReceivedThreaded += HandleLog; 172 | #endif 173 | } 174 | 175 | void OnDisable() 176 | { 177 | // If destroyed because already exists, don't need to de-register callback 178 | if (destroying) return; 179 | 180 | #if UNITY_4_5 || UNITY_4_6 || UNITY_4_7 181 | Application.RegisterLogCallback(null); 182 | #else 183 | //Application.logMessageReceived -= HandleLog; 184 | Application.logMessageReceivedThreaded -= HandleLog; 185 | #endif 186 | } 187 | 188 | void Update() 189 | { 190 | if (!ShowInEditor && Application.isEditor) return; 191 | 192 | float InnerHeight = (Screen.height - 2 * Margin) * Height - 2 * padding; 193 | int TotalRows = (int)(InnerHeight / styleText.lineHeight); 194 | 195 | // Remove overflowing rows 196 | while (queue.Count > TotalRows) 197 | queue.Dequeue(); 198 | } 199 | 200 | void OnGUI() 201 | { 202 | if (!ShowLog) return; 203 | if (!ShowInEditor && Application.isEditor) return; 204 | 205 | if (styleChanged) InitStyles(); 206 | 207 | float w = (Screen.width - 2 * Margin) * Width; 208 | float h = (Screen.height - 2 * Margin) * Height; 209 | float x = 1, y = 1; 210 | 211 | switch (AnchorPosition) 212 | { 213 | case LogAnchor.BottomLeft: 214 | x = Margin; 215 | y = Margin + (Screen.height - 2 * Margin) * (1 - Height); 216 | break; 217 | 218 | case LogAnchor.BottomRight: 219 | x = Margin + (Screen.width - 2 * Margin) * (1 - Width); 220 | y = Margin + (Screen.height - 2 * Margin) * (1 - Height); 221 | break; 222 | 223 | case LogAnchor.TopLeft: 224 | x = Margin; 225 | y = Margin; 226 | break; 227 | 228 | case LogAnchor.TopRight: 229 | x = Margin + (Screen.width - 2 * Margin) * (1 - Width); 230 | y = Margin; 231 | break; 232 | } 233 | 234 | GUILayout.BeginArea(new Rect(x, y, w, h), styleContainer); 235 | 236 | foreach (LogMessage m in queue) 237 | { 238 | switch (m.Type) 239 | { 240 | case LogType.Warning: 241 | styleText.normal.textColor = WarningColor; 242 | break; 243 | 244 | case LogType.Log: 245 | styleText.normal.textColor = MessageColor; 246 | break; 247 | 248 | case LogType.Assert: 249 | case LogType.Exception: 250 | case LogType.Error: 251 | styleText.normal.textColor = ErrorColor; 252 | break; 253 | 254 | default: 255 | styleText.normal.textColor = MessageColor; 256 | break; 257 | } 258 | 259 | GUILayout.Label(m.Message, styleText); 260 | } 261 | 262 | GUILayout.EndArea(); 263 | } 264 | 265 | void HandleLog(string message, string stackTrace, LogType type) 266 | { 267 | if (type == LogType.Assert && !LogErrors) return; 268 | if (type == LogType.Error && !LogErrors) return; 269 | if (type == LogType.Exception && !LogErrors) return; 270 | if (type == LogType.Log && !LogMessages) return; 271 | if (type == LogType.Warning && !LogWarnings) return; 272 | 273 | string[] lines = message.Split(new char[] { '\n' }); 274 | 275 | foreach (string l in lines) 276 | queue.Enqueue(new LogMessage(l, type)); 277 | 278 | if (type == LogType.Assert && !StackTraceErrors) return; 279 | if (type == LogType.Error && !StackTraceErrors) return; 280 | if (type == LogType.Exception && !StackTraceErrors) return; 281 | if (type == LogType.Log && !StackTraceMessages) return; 282 | if (type == LogType.Warning && !StackTraceWarnings) return; 283 | 284 | string[] trace = stackTrace.Split(new char[] { '\n' }); 285 | 286 | foreach (string t in trace) 287 | if (t.Length != 0) queue.Enqueue(new LogMessage(" " + t, type)); 288 | } 289 | 290 | public void InspectorGUIUpdated() 291 | { 292 | styleChanged = true; 293 | } 294 | } 295 | } 296 | 297 | /* 298 | The MIT License 299 | 300 | Copyright © 2016 Screen Logger - Giuseppe Portelli 301 | 302 | Permission is hereby granted, free of charge, to any person obtaining a copy 303 | of this software and associated documentation files (the "Software"), to deal 304 | in the Software without restriction, including without limitation the rights 305 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 306 | copies of the Software, and to permit persons to whom the Software is 307 | furnished to do so, subject to the following conditions: 308 | 309 | The above copyright notice and this permission notice shall be included in 310 | all copies or substantial portions of the Software. 311 | 312 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 313 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 314 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 315 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 316 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 317 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 318 | THE SOFTWARE. 319 | */ 320 | --------------------------------------------------------------------------------