├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md └── workflows │ └── codeql-analysis.yml ├── .gitignore ├── CHANGELOG.md ├── CHANGELOG.md.meta ├── CODE_OF_CONDUCT.md ├── CODE_OF_CONDUCT.md.meta ├── Documentation~ ├── UnityOverDrawKun.md └── UnityOverDrawKun.md.meta ├── Editor.meta ├── Editor ├── OverdrawKunWindow.cs ├── OverdrawKunWindow.cs.meta ├── UTJ.UnityOverDrawKun.Editor.asmdef └── UTJ.UnityOverDrawKun.Editor.asmdef.meta ├── LICENSE ├── LICENSE.meta ├── README.md ├── README.md.meta ├── Runtime.meta ├── Runtime ├── Prefabs.meta ├── Prefabs │ ├── OverdrawCamera.prefab │ └── OverdrawCamera.prefab.meta ├── Sample.meta ├── Sample │ ├── Floor.mat │ ├── Floor.mat.meta │ ├── LargeBox.mat │ ├── LargeBox.mat.meta │ ├── Sample.unity │ └── Sample.unity.meta ├── Scripts.meta ├── Scripts │ ├── OverdrawKun.cs │ ├── OverdrawKun.cs.meta │ ├── OverdrawKunEditor.cs │ └── OverdrawKunEditor.cs.meta ├── Shaders.meta ├── Shaders │ ├── OverdrawKun.shader │ └── OverdrawKun.shader.meta ├── UTJ.UnityOverDrawKun.asmdef └── UTJ.UnityOverDrawKun.asmdef.meta ├── package.json └── package.json.meta /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Smartphone (please complete the following information):** 32 | - Device: [e.g. iPhone6] 33 | - OS: [e.g. iOS8.1] 34 | - Browser [e.g. stock browser, safari] 35 | - Version [e.g. 22] 36 | 37 | **Additional context** 38 | Add any other context about the problem here. 39 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/workflows/codeql-analysis.yml: -------------------------------------------------------------------------------- 1 | # For most projects, this workflow file will not need changing; you simply need 2 | # to commit it to your repository. 3 | # 4 | # You may wish to alter this file to override the set of languages analyzed, 5 | # or to provide custom queries or build logic. 6 | # 7 | # ******** NOTE ******** 8 | # We have attempted to detect the languages in your repository. Please check 9 | # the `language` matrix defined below to confirm you have the correct set of 10 | # supported CodeQL languages. 11 | # 12 | name: "CodeQL" 13 | 14 | on: 15 | push: 16 | branches: [ master ] 17 | pull_request: 18 | # The branches below must be a subset of the branches above 19 | branches: [ master ] 20 | schedule: 21 | - cron: '34 6 * * 6' 22 | 23 | jobs: 24 | analyze: 25 | name: Analyze 26 | runs-on: ubuntu-latest 27 | permissions: 28 | actions: read 29 | contents: read 30 | security-events: write 31 | 32 | strategy: 33 | fail-fast: false 34 | matrix: 35 | language: [ 'csharp' ] 36 | # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] 37 | # Learn more: 38 | # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed 39 | 40 | steps: 41 | - name: Checkout repository 42 | uses: actions/checkout@v2 43 | 44 | # Initializes the CodeQL tools for scanning. 45 | - name: Initialize CodeQL 46 | uses: github/codeql-action/init@v1 47 | with: 48 | languages: ${{ matrix.language }} 49 | # If you wish to specify custom queries, you can do so here or in a config file. 50 | # By default, queries listed here will override any specified in a config file. 51 | # Prefix the list here with "+" to use these queries and those in the config file. 52 | # queries: ./path/to/local/query, your-org/your-repo/queries@main 53 | 54 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). 55 | # If this step fails, then you should remove it and run the build manually (see below) 56 | - name: Autobuild 57 | uses: github/codeql-action/autobuild@v1 58 | 59 | # ℹ️ Command-line programs to run using the OS shell. 60 | # 📚 https://git.io/JvXDl 61 | 62 | # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines 63 | # and modify them (or add more) to build your code if your project 64 | # uses a compiled language 65 | 66 | #- run: | 67 | # make bootstrap 68 | # make release 69 | 70 | - name: Perform CodeQL Analysis 71 | uses: github/codeql-action/analyze@v1 72 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # This .gitignore file should be placed at the root of your Unity project directory 2 | # 3 | # Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore 4 | # 5 | /[Ll]ibrary/ 6 | /[Tt]emp/ 7 | /[Oo]bj/ 8 | /[Bb]uild/ 9 | /[Bb]uilds/ 10 | /[Ll]ogs/ 11 | /[Mm]emoryCaptures/ 12 | 13 | # Asset meta data should only be ignored when the corresponding asset is also ignored 14 | !/[Aa]ssets/**/*.meta 15 | 16 | # Uncomment this line if you wish to ignore the asset store tools plugin 17 | # /[Aa]ssets/AssetStoreTools* 18 | 19 | # Autogenerated Jetbrains Rider plugin 20 | [Aa]ssets/Plugins/Editor/JetBrains* 21 | 22 | # Visual Studio cache directory 23 | .vs/ 24 | 25 | # Gradle cache directory 26 | .gradle/ 27 | 28 | # Autogenerated VS/MD/Consulo solution and project files 29 | ExportedObj/ 30 | .consulo/ 31 | *.csproj 32 | *.unityproj 33 | *.sln 34 | *.suo 35 | *.tmp 36 | *.user 37 | *.userprefs 38 | *.pidb 39 | *.booproj 40 | *.svd 41 | *.pdb 42 | *.mdb 43 | *.opendb 44 | *.VC.db 45 | 46 | # Unity3D generated meta files 47 | *.pidb.meta 48 | *.pdb.meta 49 | *.mdb.meta 50 | 51 | # Unity3D generated file on crash reports 52 | sysinfo.txt 53 | 54 | # Builds 55 | *.apk 56 | *.unitypackage 57 | 58 | # Crashlytics generated file 59 | crashlytics-build.properties 60 | 61 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## [0.1.1] - 2022-08-22 4 | 5 | ### Fixed 6 | 7 | - 計測終了時にTime.captureFramerateの値を計測開始前の値に戻す処理を追加 8 | 9 | ## [0.1.0] - 2021-10-13 10 | 11 | ### Changes 12 | 13 | - 1st Release 14 | -------------------------------------------------------------------------------- /CHANGELOG.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d9c21ea1bb28d2644847e76611e34d67 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | We as members, contributors, and leaders pledge to make participation in our 6 | community a harassment-free experience for everyone, regardless of age, body 7 | size, visible or invisible disability, ethnicity, sex characteristics, gender 8 | identity and expression, level of experience, education, socio-economic status, 9 | nationality, personal appearance, race, religion, or sexual identity 10 | and orientation. 11 | 12 | We pledge to act and interact in ways that contribute to an open, welcoming, 13 | diverse, inclusive, and healthy community. 14 | 15 | ## Our Standards 16 | 17 | Examples of behavior that contributes to a positive environment for our 18 | community include: 19 | 20 | * Demonstrating empathy and kindness toward other people 21 | * Being respectful of differing opinions, viewpoints, and experiences 22 | * Giving and gracefully accepting constructive feedback 23 | * Accepting responsibility and apologizing to those affected by our mistakes, 24 | and learning from the experience 25 | * Focusing on what is best not just for us as individuals, but for the 26 | overall community 27 | 28 | Examples of unacceptable behavior include: 29 | 30 | * The use of sexualized language or imagery, and sexual attention or 31 | advances of any kind 32 | * Trolling, insulting or derogatory comments, and personal or political attacks 33 | * Public or private harassment 34 | * Publishing others' private information, such as a physical or email 35 | address, without their explicit permission 36 | * Other conduct which could reasonably be considered inappropriate in a 37 | professional setting 38 | 39 | ## Enforcement Responsibilities 40 | 41 | Community leaders are responsible for clarifying and enforcing our standards of 42 | acceptable behavior and will take appropriate and fair corrective action in 43 | response to any behavior that they deem inappropriate, threatening, offensive, 44 | or harmful. 45 | 46 | Community leaders have the right and responsibility to remove, edit, or reject 47 | comments, commits, code, wiki edits, issues, and other contributions that are 48 | not aligned to this Code of Conduct, and will communicate reasons for moderation 49 | decisions when appropriate. 50 | 51 | ## Scope 52 | 53 | This Code of Conduct applies within all community spaces, and also applies when 54 | an individual is officially representing the community in public spaces. 55 | Examples of representing our community include using an official e-mail address, 56 | posting via an official social media account, or acting as an appointed 57 | representative at an online or offline event. 58 | 59 | ## Enforcement 60 | 61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 62 | reported to the community leaders responsible for enforcement at 63 | katsumasa@unity3d.com. 64 | All complaints will be reviewed and investigated promptly and fairly. 65 | 66 | All community leaders are obligated to respect the privacy and security of the 67 | reporter of any incident. 68 | 69 | ## Enforcement Guidelines 70 | 71 | Community leaders will follow these Community Impact Guidelines in determining 72 | the consequences for any action they deem in violation of this Code of Conduct: 73 | 74 | ### 1. Correction 75 | 76 | **Community Impact**: Use of inappropriate language or other behavior deemed 77 | unprofessional or unwelcome in the community. 78 | 79 | **Consequence**: A private, written warning from community leaders, providing 80 | clarity around the nature of the violation and an explanation of why the 81 | behavior was inappropriate. A public apology may be requested. 82 | 83 | ### 2. Warning 84 | 85 | **Community Impact**: A violation through a single incident or series 86 | of actions. 87 | 88 | **Consequence**: A warning with consequences for continued behavior. No 89 | interaction with the people involved, including unsolicited interaction with 90 | those enforcing the Code of Conduct, for a specified period of time. This 91 | includes avoiding interactions in community spaces as well as external channels 92 | like social media. Violating these terms may lead to a temporary or 93 | permanent ban. 94 | 95 | ### 3. Temporary Ban 96 | 97 | **Community Impact**: A serious violation of community standards, including 98 | sustained inappropriate behavior. 99 | 100 | **Consequence**: A temporary ban from any sort of interaction or public 101 | communication with the community for a specified period of time. No public or 102 | private interaction with the people involved, including unsolicited interaction 103 | with those enforcing the Code of Conduct, is allowed during this period. 104 | Violating these terms may lead to a permanent ban. 105 | 106 | ### 4. Permanent Ban 107 | 108 | **Community Impact**: Demonstrating a pattern of violation of community 109 | standards, including sustained inappropriate behavior, harassment of an 110 | individual, or aggression toward or disparagement of classes of individuals. 111 | 112 | **Consequence**: A permanent ban from any sort of public interaction within 113 | the community. 114 | 115 | ## Attribution 116 | 117 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 118 | version 2.0, available at 119 | https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. 120 | 121 | Community Impact Guidelines were inspired by [Mozilla's code of conduct 122 | enforcement ladder](https://github.com/mozilla/diversity). 123 | 124 | [homepage]: https://www.contributor-covenant.org 125 | 126 | For answers to common questions about this code of conduct, see the FAQ at 127 | https://www.contributor-covenant.org/faq. Translations are available at 128 | https://www.contributor-covenant.org/translations. 129 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9205edf65ca8db949b693885e213dd5a 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Documentation~/UnityOverDrawKun.md: -------------------------------------------------------------------------------- 1 | # UnityOverDrawKun 2 | 3 | ![GitHub package.json version](https://img.shields.io/github/package-json/v/katsumasa/UnityOverDrawKun?style=plastic) 4 | ![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/katsumasa/UnityOverDrawKun?style=plastic) 5 | 6 | overdraw check tool. 7 | 8 | ## Summary 9 | 10 | Tool that allows to measures the overdraw when rendering. 11 | It can be measured only on platforms that support multiple displays.
12 | ![641b60a898bf20e97083f5adb1294113](https://user-images.githubusercontent.com/29646672/137099718-fa1850a7-1fe7-40b9-a1df-1a6d29cd1b4b.gif) 13 | 14 | 15 | ## Install 16 | 17 | Place the `UnityOverDrawKun` under Asset folder like the image below:
18 | ![image](https://user-images.githubusercontent.com/29646672/137099528-e92781a8-657c-4c91-b527-7924f24f08e2.png) 19 | 20 | 21 | ## Setting 22 | 23 | - Place the `Overdraw Camera` inside in folder to the Scene you wish to measure.
24 | ![d5cf54a0dd8ba2f731fd92e732c46dc6](https://user-images.githubusercontent.com/29646672/137100995-bcd30b40-8cb9-43eb-811d-fc4b212273bc.png) 25 | 26 | 27 | - Specify the camera to be measured in `OverdrawCamera.MasterCamera`.
28 | ![fac434078910df9e378ae8cf2de692f2](https://user-images.githubusercontent.com/29646672/137101051-5e1cc1f1-0076-4200-9adc-8388b672e335.png) 29 | 30 | 31 | - Please display two or more GameViews. The Game view can be created by selecting Add Tab > Game.
32 | ![5fc934de91445b0ae77326436e154d7a](https://user-images.githubusercontent.com/29646672/137101120-b6d2d0ef-908c-4031-8e5a-29e86dc711e2.png) 33 | 34 | 35 | - Set the Target Display property of the Camera component attached to `OverdrawCamera` other than Display1.
36 | ![0241bb02078058a3a206b29ba29f6cb4](https://user-images.githubusercontent.com/29646672/137101158-a6191d63-2590-4005-8046-c75f25ed2776.png) 37 | 38 | 39 | ## Measurement Method 40 | 41 | - By pressing the Play button, the measurement result will be displayed in the GameView specified in OverdrawCamera.Camera.Target Display. 42 | - The brighter measurement result look dsiplays in the screen is where overdrawing has occured. 43 | - You can save the measurement result by pressing the OverDrawKun.Record button attached to the Overdraw Camera from the inspector.
44 | 45 | ![edf74eecdcc6a588c9f515bb4e3b968d](https://user-images.githubusercontent.com/29646672/137101207-f921811a-732c-4f49-8a5b-8a1cd58f1564.png) 46 | 47 |
48 | The measurement result gets outputted by creating a YYTTMMDDHHMM folder under the project folder. 49 |
50 | 51 | ![4b6bdd8b65e4b1ed0b71d05a4f9e9511](https://user-images.githubusercontent.com/29646672/137101240-0ad277ff-00c6-4900-b04f-bd9d56873d0b.png) 52 | 53 | 54 | 55 | ## Analysis of measurement results 56 | 57 | It is possible to analyze the measurement result with UnityOverdrawKunWindow. 58 | 59 | ![0e28ce0ecf377d4d977aab0c4dbe3e05](https://user-images.githubusercontent.com/29646672/137102502-f118399b-fc8e-46f4-bccb-cccd89860ab3.gif) 60 | 61 | 62 | ### Window starting method 63 | 64 | Open Window->UnityOverdrawKun. 65 | 66 | ### How to capture measurement results 67 | 68 | Open the directory where the measurement results are saved from the Open Folder icon on the upper left of the window. 69 | 70 | ### How to check the measurement result 71 | 72 | By sliding the slide bar at the bottom of the screen, you can check the degree of overdraw that are occuring each frame. 73 | 74 | ### How to save in CSV format 75 | 76 | Press Save As CSV button at the top of the screen. 77 | 78 | ## Other 79 | Comments and feedback are welcome!
80 | -------------------------------------------------------------------------------- /Documentation~/UnityOverDrawKun.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fd7d5a7b89af7474cb42ba59c25e52c4 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 660cc87d1e4afa14f824d6db747a73bd 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/OverdrawKunWindow.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Collections; 4 | using System.Collections.Generic; 5 | using UnityEngine; 6 | using UnityEditor; 7 | 8 | 9 | namespace Utj 10 | { 11 | namespace OverdrawKun 12 | { 13 | /// 14 | /// 測定したOverdrawのデータを解析する 15 | /// 16 | public class OverdrawKunWindow : EditorWindow 17 | { 18 | [System.Serializable] 19 | public class Style 20 | { 21 | public static readonly GUIContent TitleContent = new GUIContent("UnityOverdrawKun"); 22 | #if UNITY_2020_1_OR_NEWER 23 | public static readonly GUIContent OpenFolderContens = new GUIContent((Texture2D)EditorGUIUtility.Load("d_Folder Icon"),"Open Folder"); 24 | #else 25 | public static readonly GUIContent OpenFolderContens = new GUIContent((Texture2D)EditorGUIUtility.Load("d_OpenedFolder Icon"),"Open Folder"); 26 | #endif 27 | public static readonly GUIContent SaveAsContens = new GUIContent((Texture2D)EditorGUIUtility.Load("d_SaveAs@2x"), "Save As CSV"); 28 | } 29 | 30 | 31 | List m_fpaths; 32 | List m_avgs; 33 | List m_totals; 34 | List m_textures; 35 | List m_prots; 36 | string m_folderName; 37 | string m_path=""; 38 | int mSlider; 39 | 40 | 41 | 42 | [MenuItem("Window/UTJ/UnityOverdrawKun")] 43 | public static void Create() 44 | { 45 | var window = (OverdrawKunWindow)EditorWindow.GetWindow(typeof(OverdrawKunWindow)); 46 | window.titleContent = Style.TitleContent; 47 | window.wantsMouseMove = true; 48 | window.Show(); 49 | } 50 | 51 | public void OnEnable() 52 | { 53 | m_prots = new List(); 54 | } 55 | 56 | 57 | void OnInspectorUpdate() 58 | { 59 | if (EditorWindow.mouseOverWindow) 60 | { 61 | EditorWindow.mouseOverWindow.Focus(); 62 | } 63 | 64 | this.Repaint(); 65 | } 66 | 67 | 68 | private void OnGUI() 69 | { 70 | // TOOL BAR 71 | EditorGUILayout.BeginHorizontal(); 72 | 73 | // Load 74 | if (GUILayout.Button(Style.OpenFolderContens, EditorStyles.miniButtonLeft, GUILayout.Width(32),GUILayout.Height(32))) 75 | { 76 | m_path = EditorUtility.OpenFolderPanel("Load png Texture of Directory", m_path, ""); 77 | if (!string.IsNullOrEmpty(m_path)) 78 | { 79 | m_folderName = System.IO.Path.GetFileName(m_path); 80 | Analyze(m_path, out m_fpaths, out m_avgs, out m_totals, out m_textures); 81 | mSlider = 0; 82 | } 83 | } 84 | 85 | // Save 86 | if (GUILayout.Button(Style.SaveAsContens, EditorStyles.miniButtonRight, GUILayout.Width(32),GUILayout.Height(32))) 87 | { 88 | if(m_fpaths != null) 89 | { 90 | // CSV形式でデータを出力 91 | var path = EditorUtility.SaveFilePanel("Save Overdraw as csv", m_path, m_folderName, "csv"); 92 | if(!string.IsNullOrEmpty(path)) 93 | { 94 | var sw = new System.IO.StreamWriter(path, false); 95 | for(var i = 0; i < m_fpaths.Count; i++) 96 | { 97 | var fname = System.IO.Path.GetFileName(m_fpaths[i]); 98 | sw.WriteLine(string.Format("\"{0}\",{1}",fname,m_avgs[i])); 99 | } 100 | sw.Close(); 101 | } 102 | } 103 | } 104 | 105 | EditorGUILayout.LabelField(m_folderName); 106 | 107 | EditorGUILayout.EndHorizontal(); 108 | 109 | // 本体の描画 110 | if (m_avgs != null && m_avgs.Count > 0) 111 | { 112 | var ofst = 0; 113 | var count = 0; 114 | int w = (int)EditorGUIUtility.currentViewWidth; 115 | ofst = 0; 116 | count = mSlider + 1; 117 | m_prots.Clear(); 118 | for (var i = 0; i < count; i++) 119 | { 120 | m_prots.Add(m_avgs[i + ofst]); 121 | } 122 | 123 | // グラフの描画 124 | var rect = Graph(m_prots,m_avgs.Max()); 125 | 126 | // 画像の表示 127 | var texture = m_textures[mSlider]; 128 | var r1 = EditorGUILayout.GetControlRect(true, 0); 129 | var h = position.height - (r1.y + r1.height) - 30.0f; 130 | var r2 = new Rect(r1.x+16, r1.y, r1.width-32, h); 131 | EditorGUI.DrawPreviewTexture(r2, m_textures[mSlider], null, ScaleMode.ScaleToFit); 132 | 133 | // スライダーの描画 134 | r1 = new Rect(r2.x, r2.y + r2.height, r2.width, 20); 135 | mSlider = EditorGUI.IntSlider(r1, mSlider, 0, m_fpaths.Count - 1); 136 | } 137 | else 138 | { 139 | // 何も表示されていないと味気ないので 140 | Graph(m_prots,0); 141 | 142 | // 偽画像風背景 143 | var r1 = EditorGUILayout.GetControlRect(true, 0); 144 | var h = position.height - (r1.y + r1.height) - 30.0f; 145 | var r2 = new Rect(r1.x+16, r1.y, r1.width-32, h); 146 | EditorGUI.DrawRect(r2, new Color32(13, 99, 137,255)); 147 | 148 | // スライダー 149 | r1 = new Rect(r2.x, r2.y + r2.height, r2.width, 20); 150 | EditorGUI.IntSlider(r1, 0, 0, 0); 151 | } 152 | } 153 | 154 | 155 | void Analyze(string path,out List files,out List avgs,out Listtotals,out List textures) 156 | { 157 | files = System.IO.Directory.GetFiles(path, "*.png").ToList(); 158 | files = files.OrderByAlphaNumeric(e => e).ToList(); 159 | avgs = new List(); 160 | totals = new List(); 161 | textures = new List(); 162 | for(var i = 0; i < files.Count; i++) 163 | { 164 | float total = 0.0f; 165 | float avg = 0; 166 | var texture = new Texture2D(2, 2); 167 | var bytes = System.IO.File.ReadAllBytes(files[i]); 168 | texture.LoadImage(bytes); 169 | if (texture != null) 170 | { 171 | var colors = texture.GetPixels(); 172 | for (var y = 0; y < texture.height; y++) 173 | { 174 | for (var x = 0; x < texture.width; x++) 175 | { 176 | var c = colors[y * texture.width + x]; 177 | total += c.r; 178 | } 179 | } 180 | avg = total / (texture.height * texture.width); 181 | } 182 | avgs.Add(avg); 183 | totals.Add(total); 184 | textures.Add(texture); 185 | } 186 | } 187 | 188 | 189 | 190 | static public Rect Graph(List srcs,float max) 191 | { 192 | var rect = GUILayoutUtility.GetRect(Mathf.Min(EditorGUIUtility.currentViewWidth, 300f), 200.0f); 193 | rect = new Rect(rect.x + 16, rect.y, rect.width - 32, rect.height); 194 | EditorGUI.DrawRect(rect, UnityEngine.Color.gray); 195 | 196 | 197 | int len = (int)rect.width; 198 | var index = srcs.Count - len; 199 | index = Mathf.Max(0, index); 200 | len = Mathf.Min(len, srcs.Count - index); 201 | 202 | var select = -1; 203 | 204 | // indexの位置からグラフに表示される範囲でリストを作成する 205 | var list = new List(); 206 | for (var i = 0; i < len; i++) 207 | { 208 | list.Add(srcs[i + index]); 209 | } 210 | 211 | 212 | // 背景 213 | UnityEditor.EditorGUI.DrawRect(rect, UnityEngine.Color.gray); 214 | 215 | 216 | if (list.Count != 0) 217 | { 218 | var minValue = list.Min(); 219 | var maxValue = list.Max(); 220 | var avgValue = list.Average(); 221 | 222 | /// 底上げされる可能性がある為、最小値・最大値・平均値を退避 223 | var realMin = minValue; 224 | var realMax = maxValue; 225 | var realAvg = avgValue; 226 | 227 | // 最小値が0より小さい場合、グラフ的には最小値が0となるように底上げする 228 | if (realMin < 0f) 229 | { 230 | for (var i = 0; i < len; i++) 231 | { 232 | list[i] += Mathf.Abs(realMin); 233 | } 234 | minValue = list.Min(); 235 | maxValue = list.Max(); 236 | avgValue = list.Average(); 237 | } 238 | 239 | // 最大値の高さが描画範囲の90%位に 240 | var scale = rect.height / maxValue * 0.90f; 241 | 242 | // グラフを描画 243 | for (var i = 0; i < list.Count; i++) 244 | { 245 | var w = 1.0f; 246 | var h = list[i] * scale; 247 | var x = rect.x + rect.width - len + i * w; 248 | var y = rect.y + rect.height - h; 249 | 250 | var r = new Rect(x, y, w, h); 251 | 252 | if (r.Contains(Event.current.mousePosition)) 253 | { 254 | select = i; 255 | UnityEditor.EditorGUI.DrawRect(r, Color.white); 256 | } else if(list[i] == max) 257 | { 258 | UnityEditor.EditorGUI.DrawRect(r, Color.red); 259 | } 260 | else 261 | { 262 | UnityEditor.EditorGUI.DrawRect(r, Color.green); 263 | } 264 | } 265 | 266 | // 最大値の補助線 267 | { 268 | var x = rect.x; 269 | var y = rect.y + rect.height - maxValue * scale; 270 | var w = rect.width; 271 | var h = 1.0f; 272 | DrawAdditionalLine(new Rect(x, y, w, h), realMax, Color.white); 273 | } 274 | 275 | // 平均値の補助線 276 | { 277 | var x = rect.x; 278 | var y = rect.y + rect.height - avgValue * scale; 279 | var w = rect.width; 280 | var h = 1.0f; 281 | DrawAdditionalLine(new Rect(x, y, w, h), realAvg, Color.white); 282 | } 283 | 284 | // 最小値の補助線 285 | { 286 | var x = rect.x; 287 | var y = rect.y + rect.height - minValue * scale; 288 | var w = rect.width; 289 | var h = 1.0f; 290 | DrawAdditionalLine(new Rect(x, y, w, h), realMin, Color.white); 291 | } 292 | 293 | // 選択された値を表示する 294 | if (select >= 0 && select < list.Count) 295 | { 296 | var value = list[select]; 297 | if(realMin < 0f) 298 | { 299 | value -= Mathf.Abs(realMin); 300 | } 301 | var label = new GUIContent(Format("{0,3:F6}", value)); 302 | var contentSize = UnityEditor.EditorStyles.label.CalcSize(label); 303 | var x = rect.x + rect.width - len + select * 1.0f - contentSize.x / 2; 304 | var y = rect.y + rect.height - list[select] * scale - contentSize.y; 305 | var w = contentSize.x; 306 | var h = contentSize.y; 307 | 308 | var r = new Rect(x, y, w, h); 309 | UnityEditor.EditorGUI.DrawRect(r, new Color32(0, 0, 0, 128)); 310 | UnityEditor.EditorGUI.LabelField(r, label); 311 | } 312 | } 313 | 314 | 315 | return rect; 316 | } 317 | 318 | 319 | /// 320 | /// 補助線を引く 321 | /// 322 | /// 323 | /// 324 | /// 325 | static void DrawAdditionalLine(Rect rect, float value, Color color) 326 | { 327 | UnityEditor.EditorGUI.DrawRect(rect, color); 328 | var label = new GUIContent(Format("{0,3:F6}", value)); 329 | var contentSize = UnityEditor.EditorStyles.label.CalcSize(label); 330 | var rect2 = new Rect(rect.x, rect.y - contentSize.y / 2, contentSize.x, contentSize.y); 331 | UnityEditor.EditorGUI.DrawRect(rect2, Color.black); 332 | UnityEditor.EditorGUI.LabelField(rect2, label); 333 | } 334 | 335 | 336 | public static string Format(string fmt, params object[] args) 337 | { 338 | return String.Format(System.Globalization.CultureInfo.InvariantCulture.NumberFormat, fmt, args); 339 | 340 | } 341 | 342 | } 343 | 344 | 345 | public static class Extensions 346 | { 347 | // Natural sort. When you use this extension method, "MyFile_2" is less than (<) "MyFile_10". 348 | // https://stackoverflow.com/a/11720793 349 | public static IOrderedEnumerable OrderByAlphaNumeric(this IEnumerable source, Func selector) 350 | { 351 | int max = source 352 | .SelectMany(i => System.Text.RegularExpressions.Regex.Matches(selector(i), @"\d+") 353 | .Cast() 354 | .Select(m => (int?)m.Value.Length)) 355 | .Max() ?? 0; 356 | return source.OrderBy(i => System.Text.RegularExpressions.Regex.Replace(selector(i), @"\d+", m => m.Value.PadLeft(max, '0'))); 357 | } 358 | } 359 | } 360 | } -------------------------------------------------------------------------------- /Editor/OverdrawKunWindow.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f8b9c6ceafc4a7b4d8ec3835a70440e7 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/UTJ.UnityOverDrawKun.Editor.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "UTJ.UnityOverDrawKun.Editor", 3 | "references": [ 4 | "GUID:004982bf4c6f6b348941d8ecb34558e1" 5 | ], 6 | "includePlatforms": [ 7 | "Editor" 8 | ], 9 | "excludePlatforms": [], 10 | "allowUnsafeCode": false, 11 | "overrideReferences": false, 12 | "precompiledReferences": [], 13 | "autoReferenced": true, 14 | "defineConstraints": [], 15 | "versionDefines": [], 16 | "noEngineReferences": false 17 | } -------------------------------------------------------------------------------- /Editor/UTJ.UnityOverDrawKun.Editor.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8cca14b6f723bd14f9658197972a6fd8 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Katsumasa.Kimura 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 all 13 | 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 THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /LICENSE.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2f075e269e0b874418974c8dab85d35b 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # UnityOverDrawKun 2 | 3 | ![GitHub package.json version](https://img.shields.io/github/package-json/v/katsumasa/UnityOverDrawKun?style=plastic) 4 | ![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/katsumasa/UnityOverDrawKun?style=plastic) 5 | 6 | overdraw check tool. 7 | [English version README](Documentation~/UnityOverDrawKun.md) 8 | 9 | ## 概要 10 | 11 | 描画時のオーバードロー(重ね塗り)を計測するツールです。
12 | ***マルチディスプレイに対応しているプラットフォームでのみ計測可能です。*** 13 |

14 | ![641b60a898bf20e97083f5adb1294113](https://user-images.githubusercontent.com/29646672/137099718-fa1850a7-1fe7-40b9-a1df-1a6d29cd1b4b.gif) 15 | 16 | ## インストール 17 | 18 | `UnityOverDrawKun` 以下を計測する対象プロジェクトのAssetフォルダー以下へ配置して下さい。
19 | 20 | ![image](https://user-images.githubusercontent.com/29646672/137099528-e92781a8-657c-4c91-b527-7924f24f08e2.png) 21 | 22 | ## セッティング 23 | 24 | - 上記フォルダに含まれる`OverdrawCamera`を計測するSceneへ配置して下さい。
25 | 26 | ![d5cf54a0dd8ba2f731fd92e732c46dc6](https://user-images.githubusercontent.com/29646672/137100995-bcd30b40-8cb9-43eb-811d-fc4b212273bc.png) 27 | 28 | - `OverdrawCamera.MasterCamera`に計測するCameraを指定して下さい。
29 |  ![fac434078910df9e378ae8cf2de692f2](https://user-images.githubusercontent.com/29646672/137101051-5e1cc1f1-0076-4200-9adc-8388b672e335.png) 30 | 31 | - `OverdrawCamera`にアタッチされたいるCameraコンポーネントのTarget Display プロパティの値に`Display 2`を設定して下さい。
32 | 33 | ![0241bb02078058a3a206b29ba29f6cb4](https://user-images.githubusercontent.com/29646672/137101158-a6191d63-2590-4005-8046-c75f25ed2776.png) 34 | 35 | ### MEMO 36 | 37 | ```:txt 38 | 現在選択しているプラットフォームでマルチディスプレイが対応していない場合、Target Displayの項目は選択されません。プラットフォームをPC,Mac&Linux Standaloneなどへ変更して下さい。 39 | ``` 40 | 41 | - 2個目のGameViewを表示して下さい。GameViewはView上の三からAdd Tabを選択しGameを選択することで増やすことが出来ます。
42 | 43 | image 44 | image 45 | 46 | - 上記で開いたGameViewの片方のDisplayを`Display 2`へ変更します。 47 | 48 | image 49 | 50 | 51 | ## 計測方法 52 | 53 | - Playボタンを押すことでOverdrawCamera.Camera.Target Displayへ指定したGameViewに計測結果が表示されます。 54 | - 計測結果が明るい部分程、オーバードローが発生していることになります。 55 | - インスペクターからOverdrawCameraにアタッチされているOverDrawKun.Recordボタンを押すことで計測結果を保存することが出来ます。
56 | 57 | ![edf74eecdcc6a588c9f515bb4e3b968d](https://user-images.githubusercontent.com/29646672/137101207-f921811a-732c-4f49-8a5b-8a1cd58f1564.png) 58 | 59 |
60 | 計測結果はプロジェクトフォルダ以下にYYTTMMDDHHMMのフォルダを作成し出力されます。 61 |
62 | 63 | ![4b6bdd8b65e4b1ed0b71d05a4f9e9511](https://user-images.githubusercontent.com/29646672/137101240-0ad277ff-00c6-4900-b04f-bd9d56873d0b.png) 64 | 65 | 66 | ## 計測結果の解析 67 | 68 | UnityOverdrawKunWindowで計測結果を解析することが可能です。 69 | 70 | ![0e28ce0ecf377d4d977aab0c4dbe3e05](https://user-images.githubusercontent.com/29646672/137102502-f118399b-fc8e-46f4-bccb-cccd89860ab3.gif) 71 | 72 | ### Windowの起動方法 73 | 74 | Window->UnityOverdrawKunでWindowが開きます。 75 | 76 | ### 計測結果の取り込み方法 77 | 78 | Window左上のOpenFolderアイコンから計測結果の保存先のディレクトリを開きます。 79 | 80 | ### 計測結果の確認方法 81 | 82 | 画面下部のスライドバーをスライドさせることで、各フレームで発生しているオーバードローの度合を確認する事が可能です。 83 | 84 | *Note* 85 | オーバードローの度合とは[OverdrawKun.shader](https://github.com/katsumasa/UnityOverDrawKun/blob/master/Runtime/Shaders/OverdrawKun.shader)でレンダリングされたTextureの各ピクセルのR成分の平均値を指しています。 86 | 87 | 88 | ### CSV形式での保存方法 89 | 90 | 画面上部のSave As CSVボタンから解析結果をCSV形式で保存する事が出来ます。 91 | 92 | ## その他 93 | 94 | フィードバックをお待ちしております。 95 | 96 | 以上! 97 | -------------------------------------------------------------------------------- /README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0d21275bb363332488d4a9d540363e89 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Runtime.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f726b0ce363ff154798fce272af38b39 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Prefabs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b4ed81615bce76347a29b12ebb3b335a 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Prefabs/OverdrawCamera.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1001 &100100000 4 | Prefab: 5 | m_ObjectHideFlags: 1 6 | serializedVersion: 2 7 | m_Modification: 8 | m_TransformParent: {fileID: 0} 9 | m_Modifications: [] 10 | m_RemovedComponents: [] 11 | m_ParentPrefab: {fileID: 0} 12 | m_RootGameObject: {fileID: 1029377048149688} 13 | m_IsPrefabParent: 1 14 | --- !u!1 &1029377048149688 15 | GameObject: 16 | m_ObjectHideFlags: 0 17 | m_PrefabParentObject: {fileID: 0} 18 | m_PrefabInternal: {fileID: 100100000} 19 | serializedVersion: 5 20 | m_Component: 21 | - component: {fileID: 4694215270170358} 22 | - component: {fileID: 20495066297288620} 23 | - component: {fileID: 114373368657877166} 24 | m_Layer: 0 25 | m_Name: OverdrawCamera 26 | m_TagString: Untagged 27 | m_Icon: {fileID: 0} 28 | m_NavMeshLayer: 0 29 | m_StaticEditorFlags: 0 30 | m_IsActive: 1 31 | --- !u!4 &4694215270170358 32 | Transform: 33 | m_ObjectHideFlags: 1 34 | m_PrefabParentObject: {fileID: 0} 35 | m_PrefabInternal: {fileID: 100100000} 36 | m_GameObject: {fileID: 1029377048149688} 37 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 38 | m_LocalPosition: {x: 0, y: 1, z: -10} 39 | m_LocalScale: {x: 1, y: 1, z: 1} 40 | m_Children: [] 41 | m_Father: {fileID: 0} 42 | m_RootOrder: 0 43 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 44 | --- !u!20 &20495066297288620 45 | Camera: 46 | m_ObjectHideFlags: 1 47 | m_PrefabParentObject: {fileID: 0} 48 | m_PrefabInternal: {fileID: 100100000} 49 | m_GameObject: {fileID: 1029377048149688} 50 | m_Enabled: 1 51 | serializedVersion: 2 52 | m_ClearFlags: 2 53 | m_BackGroundColor: {r: 0, g: 0, b: 0, a: 0} 54 | m_NormalizedViewPortRect: 55 | serializedVersion: 2 56 | x: 0 57 | y: 0 58 | width: 1 59 | height: 1 60 | near clip plane: 0.3 61 | far clip plane: 1000 62 | field of view: 60 63 | orthographic: 0 64 | orthographic size: 5 65 | m_Depth: 0 66 | m_CullingMask: 67 | serializedVersion: 2 68 | m_Bits: 4294967295 69 | m_RenderingPath: 1 70 | m_TargetTexture: {fileID: 0} 71 | m_TargetDisplay: 1 72 | m_TargetEye: 3 73 | m_HDR: 0 74 | m_AllowMSAA: 0 75 | m_AllowDynamicResolution: 0 76 | m_ForceIntoRT: 0 77 | m_OcclusionCulling: 0 78 | m_StereoConvergence: 10 79 | m_StereoSeparation: 0.022 80 | --- !u!114 &114373368657877166 81 | MonoBehaviour: 82 | m_ObjectHideFlags: 1 83 | m_PrefabParentObject: {fileID: 0} 84 | m_PrefabInternal: {fileID: 100100000} 85 | m_GameObject: {fileID: 1029377048149688} 86 | m_Enabled: 1 87 | m_EditorHideFlags: 0 88 | m_Script: {fileID: 11500000, guid: b659eb085b92bfb48b2364c209affcc9, type: 3} 89 | m_Name: 90 | m_EditorClassIdentifier: 91 | MasterCamera: {fileID: 0} 92 | recordingInterval: 5 93 | captureFramerate: 30 94 | -------------------------------------------------------------------------------- /Runtime/Prefabs/OverdrawCamera.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6f002a60626884741a0f9ac516c78709 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 100100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Sample.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 50d95b3ea1b79734eb41409bbb8f8a58 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Sample/Floor.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: Floor 10 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} 11 | m_ShaderKeywords: 12 | m_LightmapFlags: 4 13 | m_EnableInstancingVariants: 0 14 | m_DoubleSidedGI: 0 15 | m_CustomRenderQueue: -1 16 | stringTagMap: {} 17 | disabledShaderPasses: [] 18 | m_SavedProperties: 19 | serializedVersion: 3 20 | m_TexEnvs: 21 | - _BumpMap: 22 | m_Texture: {fileID: 0} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | - _DetailAlbedoMap: 26 | m_Texture: {fileID: 0} 27 | m_Scale: {x: 1, y: 1} 28 | m_Offset: {x: 0, y: 0} 29 | - _DetailMask: 30 | m_Texture: {fileID: 0} 31 | m_Scale: {x: 1, y: 1} 32 | m_Offset: {x: 0, y: 0} 33 | - _DetailNormalMap: 34 | m_Texture: {fileID: 0} 35 | m_Scale: {x: 1, y: 1} 36 | m_Offset: {x: 0, y: 0} 37 | - _EmissionMap: 38 | m_Texture: {fileID: 0} 39 | m_Scale: {x: 1, y: 1} 40 | m_Offset: {x: 0, y: 0} 41 | - _MainTex: 42 | m_Texture: {fileID: 0} 43 | m_Scale: {x: 1, y: 1} 44 | m_Offset: {x: 0, y: 0} 45 | - _MetallicGlossMap: 46 | m_Texture: {fileID: 0} 47 | m_Scale: {x: 1, y: 1} 48 | m_Offset: {x: 0, y: 0} 49 | - _OcclusionMap: 50 | m_Texture: {fileID: 0} 51 | m_Scale: {x: 1, y: 1} 52 | m_Offset: {x: 0, y: 0} 53 | - _ParallaxMap: 54 | m_Texture: {fileID: 0} 55 | m_Scale: {x: 1, y: 1} 56 | m_Offset: {x: 0, y: 0} 57 | m_Floats: 58 | - _BumpScale: 1 59 | - _Cutoff: 0.5 60 | - _DetailNormalMapScale: 1 61 | - _DstBlend: 0 62 | - _GlossMapScale: 1 63 | - _Glossiness: 0.5 64 | - _GlossyReflections: 1 65 | - _Metallic: 0 66 | - _Mode: 0 67 | - _OcclusionStrength: 1 68 | - _Parallax: 0.02 69 | - _SmoothnessTextureChannel: 0 70 | - _SpecularHighlights: 1 71 | - _SrcBlend: 1 72 | - _UVSec: 0 73 | - _ZWrite: 1 74 | m_Colors: 75 | - _Color: {r: 0.06341912, g: 0.50735295, b: 0.3236562, a: 1} 76 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 77 | -------------------------------------------------------------------------------- /Runtime/Sample/Floor.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 68d69e0d746de204e9838338da1b4870 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 2100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Sample/LargeBox.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: LargeBox 10 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} 11 | m_ShaderKeywords: 12 | m_LightmapFlags: 4 13 | m_EnableInstancingVariants: 0 14 | m_DoubleSidedGI: 0 15 | m_CustomRenderQueue: -1 16 | stringTagMap: {} 17 | disabledShaderPasses: [] 18 | m_SavedProperties: 19 | serializedVersion: 3 20 | m_TexEnvs: 21 | - _BumpMap: 22 | m_Texture: {fileID: 0} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | - _DetailAlbedoMap: 26 | m_Texture: {fileID: 0} 27 | m_Scale: {x: 1, y: 1} 28 | m_Offset: {x: 0, y: 0} 29 | - _DetailMask: 30 | m_Texture: {fileID: 0} 31 | m_Scale: {x: 1, y: 1} 32 | m_Offset: {x: 0, y: 0} 33 | - _DetailNormalMap: 34 | m_Texture: {fileID: 0} 35 | m_Scale: {x: 1, y: 1} 36 | m_Offset: {x: 0, y: 0} 37 | - _EmissionMap: 38 | m_Texture: {fileID: 0} 39 | m_Scale: {x: 1, y: 1} 40 | m_Offset: {x: 0, y: 0} 41 | - _MainTex: 42 | m_Texture: {fileID: 0} 43 | m_Scale: {x: 1, y: 1} 44 | m_Offset: {x: 0, y: 0} 45 | - _MetallicGlossMap: 46 | m_Texture: {fileID: 0} 47 | m_Scale: {x: 1, y: 1} 48 | m_Offset: {x: 0, y: 0} 49 | - _OcclusionMap: 50 | m_Texture: {fileID: 0} 51 | m_Scale: {x: 1, y: 1} 52 | m_Offset: {x: 0, y: 0} 53 | - _ParallaxMap: 54 | m_Texture: {fileID: 0} 55 | m_Scale: {x: 1, y: 1} 56 | m_Offset: {x: 0, y: 0} 57 | m_Floats: 58 | - _BumpScale: 1 59 | - _Cutoff: 0.5 60 | - _DetailNormalMapScale: 1 61 | - _DstBlend: 0 62 | - _GlossMapScale: 1 63 | - _Glossiness: 0.5 64 | - _GlossyReflections: 1 65 | - _Metallic: 0 66 | - _Mode: 0 67 | - _OcclusionStrength: 1 68 | - _Parallax: 0.02 69 | - _SmoothnessTextureChannel: 0 70 | - _SpecularHighlights: 1 71 | - _SrcBlend: 1 72 | - _UVSec: 0 73 | - _ZWrite: 1 74 | m_Colors: 75 | - _Color: {r: 1, g: 0.022058845, b: 0.022058845, a: 1} 76 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 77 | -------------------------------------------------------------------------------- /Runtime/Sample/LargeBox.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0d5e895c59ecb8a4a80b47de32ed8654 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 2100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Sample/Sample.unity: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!29 &1 4 | OcclusionCullingSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_OcclusionBakeSettings: 8 | smallestOccluder: 5 9 | smallestHole: 0.25 10 | backfaceThreshold: 100 11 | m_SceneGUID: 00000000000000000000000000000000 12 | m_OcclusionCullingData: {fileID: 0} 13 | --- !u!104 &2 14 | RenderSettings: 15 | m_ObjectHideFlags: 0 16 | serializedVersion: 8 17 | m_Fog: 0 18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: 0.01 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} 24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} 25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} 26 | m_AmbientIntensity: 1 27 | m_AmbientMode: 0 28 | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} 29 | m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} 30 | m_HaloStrength: 0.5 31 | m_FlareStrength: 1 32 | m_FlareFadeSpeed: 3 33 | m_HaloTexture: {fileID: 0} 34 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} 35 | m_DefaultReflectionMode: 0 36 | m_DefaultReflectionResolution: 128 37 | m_ReflectionBounces: 1 38 | m_ReflectionIntensity: 1 39 | m_CustomReflection: {fileID: 0} 40 | m_Sun: {fileID: 0} 41 | m_IndirectSpecularColor: {r: 0.4465586, g: 0.4963956, b: 0.5748218, a: 1} 42 | --- !u!157 &3 43 | LightmapSettings: 44 | m_ObjectHideFlags: 0 45 | serializedVersion: 11 46 | m_GIWorkflowMode: 0 47 | m_GISettings: 48 | serializedVersion: 2 49 | m_BounceScale: 1 50 | m_IndirectOutputScale: 1 51 | m_AlbedoBoost: 1 52 | m_TemporalCoherenceThreshold: 1 53 | m_EnvironmentLightingMode: 0 54 | m_EnableBakedLightmaps: 1 55 | m_EnableRealtimeLightmaps: 1 56 | m_LightmapEditorSettings: 57 | serializedVersion: 9 58 | m_Resolution: 2 59 | m_BakeResolution: 40 60 | m_TextureWidth: 1024 61 | m_TextureHeight: 1024 62 | m_AO: 0 63 | m_AOMaxDistance: 1 64 | m_CompAOExponent: 1 65 | m_CompAOExponentDirect: 0 66 | m_Padding: 2 67 | m_LightmapParameters: {fileID: 0} 68 | m_LightmapsBakeMode: 1 69 | m_TextureCompression: 1 70 | m_FinalGather: 0 71 | m_FinalGatherFiltering: 1 72 | m_FinalGatherRayCount: 256 73 | m_ReflectionCompression: 2 74 | m_MixedBakeMode: 2 75 | m_BakeBackend: 0 76 | m_PVRSampling: 1 77 | m_PVRDirectSampleCount: 32 78 | m_PVRSampleCount: 500 79 | m_PVRBounces: 2 80 | m_PVRFilterTypeDirect: 0 81 | m_PVRFilterTypeIndirect: 0 82 | m_PVRFilterTypeAO: 0 83 | m_PVRFilteringMode: 1 84 | m_PVRCulling: 1 85 | m_PVRFilteringGaussRadiusDirect: 1 86 | m_PVRFilteringGaussRadiusIndirect: 5 87 | m_PVRFilteringGaussRadiusAO: 2 88 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 89 | m_PVRFilteringAtrousPositionSigmaIndirect: 2 90 | m_PVRFilteringAtrousPositionSigmaAO: 1 91 | m_ShowResolutionOverlay: 1 92 | m_LightingDataAsset: {fileID: 0} 93 | m_UseShadowmask: 1 94 | --- !u!196 &4 95 | NavMeshSettings: 96 | serializedVersion: 2 97 | m_ObjectHideFlags: 0 98 | m_BuildSettings: 99 | serializedVersion: 2 100 | agentTypeID: 0 101 | agentRadius: 0.5 102 | agentHeight: 2 103 | agentSlope: 45 104 | agentClimb: 0.4 105 | ledgeDropHeight: 0 106 | maxJumpAcrossDistance: 0 107 | minRegionArea: 2 108 | manualCellSize: 0 109 | cellSize: 0.16666667 110 | manualTileSize: 0 111 | tileSize: 256 112 | accuratePlacement: 0 113 | debug: 114 | m_Flags: 0 115 | m_NavMeshData: {fileID: 0} 116 | --- !u!1 &915559167 117 | GameObject: 118 | m_ObjectHideFlags: 0 119 | m_PrefabParentObject: {fileID: 0} 120 | m_PrefabInternal: {fileID: 0} 121 | serializedVersion: 5 122 | m_Component: 123 | - component: {fileID: 915559171} 124 | - component: {fileID: 915559170} 125 | - component: {fileID: 915559169} 126 | - component: {fileID: 915559168} 127 | m_Layer: 0 128 | m_Name: Plane 129 | m_TagString: Untagged 130 | m_Icon: {fileID: 0} 131 | m_NavMeshLayer: 0 132 | m_StaticEditorFlags: 0 133 | m_IsActive: 1 134 | --- !u!23 &915559168 135 | MeshRenderer: 136 | m_ObjectHideFlags: 0 137 | m_PrefabParentObject: {fileID: 0} 138 | m_PrefabInternal: {fileID: 0} 139 | m_GameObject: {fileID: 915559167} 140 | m_Enabled: 1 141 | m_CastShadows: 1 142 | m_ReceiveShadows: 1 143 | m_DynamicOccludee: 1 144 | m_MotionVectors: 1 145 | m_LightProbeUsage: 1 146 | m_ReflectionProbeUsage: 1 147 | m_Materials: 148 | - {fileID: 2100000, guid: 68d69e0d746de204e9838338da1b4870, type: 2} 149 | m_StaticBatchInfo: 150 | firstSubMesh: 0 151 | subMeshCount: 0 152 | m_StaticBatchRoot: {fileID: 0} 153 | m_ProbeAnchor: {fileID: 0} 154 | m_LightProbeVolumeOverride: {fileID: 0} 155 | m_ScaleInLightmap: 1 156 | m_PreserveUVs: 1 157 | m_IgnoreNormalsForChartDetection: 0 158 | m_ImportantGI: 0 159 | m_StitchLightmapSeams: 0 160 | m_SelectedEditorRenderState: 3 161 | m_MinimumChartSize: 4 162 | m_AutoUVMaxDistance: 0.5 163 | m_AutoUVMaxAngle: 89 164 | m_LightmapParameters: {fileID: 0} 165 | m_SortingLayerID: 0 166 | m_SortingLayer: 0 167 | m_SortingOrder: 0 168 | --- !u!64 &915559169 169 | MeshCollider: 170 | m_ObjectHideFlags: 0 171 | m_PrefabParentObject: {fileID: 0} 172 | m_PrefabInternal: {fileID: 0} 173 | m_GameObject: {fileID: 915559167} 174 | m_Material: {fileID: 0} 175 | m_IsTrigger: 0 176 | m_Enabled: 1 177 | serializedVersion: 3 178 | m_Convex: 0 179 | m_CookingOptions: 14 180 | m_SkinWidth: 0.01 181 | m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} 182 | --- !u!33 &915559170 183 | MeshFilter: 184 | m_ObjectHideFlags: 0 185 | m_PrefabParentObject: {fileID: 0} 186 | m_PrefabInternal: {fileID: 0} 187 | m_GameObject: {fileID: 915559167} 188 | m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} 189 | --- !u!4 &915559171 190 | Transform: 191 | m_ObjectHideFlags: 0 192 | m_PrefabParentObject: {fileID: 0} 193 | m_PrefabInternal: {fileID: 0} 194 | m_GameObject: {fileID: 915559167} 195 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 196 | m_LocalPosition: {x: 0, y: 0, z: 0} 197 | m_LocalScale: {x: 19.95, y: 1, z: 15.84} 198 | m_Children: [] 199 | m_Father: {fileID: 0} 200 | m_RootOrder: 7 201 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 202 | --- !u!1 &946542798 203 | GameObject: 204 | m_ObjectHideFlags: 0 205 | m_PrefabParentObject: {fileID: 0} 206 | m_PrefabInternal: {fileID: 0} 207 | serializedVersion: 5 208 | m_Component: 209 | - component: {fileID: 946542802} 210 | - component: {fileID: 946542801} 211 | - component: {fileID: 946542800} 212 | - component: {fileID: 946542799} 213 | m_Layer: 0 214 | m_Name: Main Camera 215 | m_TagString: MainCamera 216 | m_Icon: {fileID: 0} 217 | m_NavMeshLayer: 0 218 | m_StaticEditorFlags: 0 219 | m_IsActive: 1 220 | --- !u!81 &946542799 221 | AudioListener: 222 | m_ObjectHideFlags: 0 223 | m_PrefabParentObject: {fileID: 0} 224 | m_PrefabInternal: {fileID: 0} 225 | m_GameObject: {fileID: 946542798} 226 | m_Enabled: 1 227 | --- !u!124 &946542800 228 | Behaviour: 229 | m_ObjectHideFlags: 0 230 | m_PrefabParentObject: {fileID: 0} 231 | m_PrefabInternal: {fileID: 0} 232 | m_GameObject: {fileID: 946542798} 233 | m_Enabled: 1 234 | --- !u!20 &946542801 235 | Camera: 236 | m_ObjectHideFlags: 0 237 | m_PrefabParentObject: {fileID: 0} 238 | m_PrefabInternal: {fileID: 0} 239 | m_GameObject: {fileID: 946542798} 240 | m_Enabled: 1 241 | serializedVersion: 2 242 | m_ClearFlags: 1 243 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} 244 | m_NormalizedViewPortRect: 245 | serializedVersion: 2 246 | x: 0 247 | y: 0 248 | width: 1 249 | height: 1 250 | near clip plane: 0.3 251 | far clip plane: 1000 252 | field of view: 60 253 | orthographic: 0 254 | orthographic size: 5 255 | m_Depth: -1 256 | m_CullingMask: 257 | serializedVersion: 2 258 | m_Bits: 4294967295 259 | m_RenderingPath: 1 260 | m_TargetTexture: {fileID: 0} 261 | m_TargetDisplay: 0 262 | m_TargetEye: 3 263 | m_HDR: 0 264 | m_AllowMSAA: 0 265 | m_AllowDynamicResolution: 0 266 | m_ForceIntoRT: 0 267 | m_OcclusionCulling: 0 268 | m_StereoConvergence: 10 269 | m_StereoSeparation: 0.022 270 | --- !u!4 &946542802 271 | Transform: 272 | m_ObjectHideFlags: 0 273 | m_PrefabParentObject: {fileID: 0} 274 | m_PrefabInternal: {fileID: 0} 275 | m_GameObject: {fileID: 946542798} 276 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 277 | m_LocalPosition: {x: 0, y: 1, z: -10} 278 | m_LocalScale: {x: 1, y: 1, z: 1} 279 | m_Children: [] 280 | m_Father: {fileID: 0} 281 | m_RootOrder: 0 282 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 283 | --- !u!1 &1104838701 284 | GameObject: 285 | m_ObjectHideFlags: 0 286 | m_PrefabParentObject: {fileID: 0} 287 | m_PrefabInternal: {fileID: 0} 288 | serializedVersion: 5 289 | m_Component: 290 | - component: {fileID: 1104838705} 291 | - component: {fileID: 1104838704} 292 | - component: {fileID: 1104838703} 293 | - component: {fileID: 1104838702} 294 | m_Layer: 0 295 | m_Name: Large Cube 296 | m_TagString: Untagged 297 | m_Icon: {fileID: 0} 298 | m_NavMeshLayer: 0 299 | m_StaticEditorFlags: 0 300 | m_IsActive: 1 301 | --- !u!23 &1104838702 302 | MeshRenderer: 303 | m_ObjectHideFlags: 0 304 | m_PrefabParentObject: {fileID: 0} 305 | m_PrefabInternal: {fileID: 0} 306 | m_GameObject: {fileID: 1104838701} 307 | m_Enabled: 1 308 | m_CastShadows: 1 309 | m_ReceiveShadows: 1 310 | m_DynamicOccludee: 1 311 | m_MotionVectors: 1 312 | m_LightProbeUsage: 1 313 | m_ReflectionProbeUsage: 1 314 | m_Materials: 315 | - {fileID: 2100000, guid: 0d5e895c59ecb8a4a80b47de32ed8654, type: 2} 316 | m_StaticBatchInfo: 317 | firstSubMesh: 0 318 | subMeshCount: 0 319 | m_StaticBatchRoot: {fileID: 0} 320 | m_ProbeAnchor: {fileID: 0} 321 | m_LightProbeVolumeOverride: {fileID: 0} 322 | m_ScaleInLightmap: 1 323 | m_PreserveUVs: 1 324 | m_IgnoreNormalsForChartDetection: 0 325 | m_ImportantGI: 0 326 | m_StitchLightmapSeams: 0 327 | m_SelectedEditorRenderState: 3 328 | m_MinimumChartSize: 4 329 | m_AutoUVMaxDistance: 0.5 330 | m_AutoUVMaxAngle: 89 331 | m_LightmapParameters: {fileID: 0} 332 | m_SortingLayerID: 0 333 | m_SortingLayer: 0 334 | m_SortingOrder: 0 335 | --- !u!65 &1104838703 336 | BoxCollider: 337 | m_ObjectHideFlags: 0 338 | m_PrefabParentObject: {fileID: 0} 339 | m_PrefabInternal: {fileID: 0} 340 | m_GameObject: {fileID: 1104838701} 341 | m_Material: {fileID: 0} 342 | m_IsTrigger: 0 343 | m_Enabled: 1 344 | serializedVersion: 2 345 | m_Size: {x: 1, y: 1, z: 1} 346 | m_Center: {x: 0, y: 0, z: 0} 347 | --- !u!33 &1104838704 348 | MeshFilter: 349 | m_ObjectHideFlags: 0 350 | m_PrefabParentObject: {fileID: 0} 351 | m_PrefabInternal: {fileID: 0} 352 | m_GameObject: {fileID: 1104838701} 353 | m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} 354 | --- !u!4 &1104838705 355 | Transform: 356 | m_ObjectHideFlags: 0 357 | m_PrefabParentObject: {fileID: 0} 358 | m_PrefabInternal: {fileID: 0} 359 | m_GameObject: {fileID: 1104838701} 360 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 361 | m_LocalPosition: {x: 0, y: 2.63, z: -4.37} 362 | m_LocalScale: {x: 2, y: 2, z: 2} 363 | m_Children: [] 364 | m_Father: {fileID: 0} 365 | m_RootOrder: 6 366 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 367 | --- !u!1 &1231105261 368 | GameObject: 369 | m_ObjectHideFlags: 0 370 | m_PrefabParentObject: {fileID: 0} 371 | m_PrefabInternal: {fileID: 0} 372 | serializedVersion: 5 373 | m_Component: 374 | - component: {fileID: 1231105265} 375 | - component: {fileID: 1231105264} 376 | - component: {fileID: 1231105263} 377 | - component: {fileID: 1231105262} 378 | m_Layer: 0 379 | m_Name: Cube (1) 380 | m_TagString: Untagged 381 | m_Icon: {fileID: 0} 382 | m_NavMeshLayer: 0 383 | m_StaticEditorFlags: 0 384 | m_IsActive: 1 385 | --- !u!23 &1231105262 386 | MeshRenderer: 387 | m_ObjectHideFlags: 0 388 | m_PrefabParentObject: {fileID: 0} 389 | m_PrefabInternal: {fileID: 0} 390 | m_GameObject: {fileID: 1231105261} 391 | m_Enabled: 1 392 | m_CastShadows: 1 393 | m_ReceiveShadows: 1 394 | m_DynamicOccludee: 1 395 | m_MotionVectors: 1 396 | m_LightProbeUsage: 1 397 | m_ReflectionProbeUsage: 1 398 | m_Materials: 399 | - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} 400 | m_StaticBatchInfo: 401 | firstSubMesh: 0 402 | subMeshCount: 0 403 | m_StaticBatchRoot: {fileID: 0} 404 | m_ProbeAnchor: {fileID: 0} 405 | m_LightProbeVolumeOverride: {fileID: 0} 406 | m_ScaleInLightmap: 1 407 | m_PreserveUVs: 1 408 | m_IgnoreNormalsForChartDetection: 0 409 | m_ImportantGI: 0 410 | m_StitchLightmapSeams: 0 411 | m_SelectedEditorRenderState: 3 412 | m_MinimumChartSize: 4 413 | m_AutoUVMaxDistance: 0.5 414 | m_AutoUVMaxAngle: 89 415 | m_LightmapParameters: {fileID: 0} 416 | m_SortingLayerID: 0 417 | m_SortingLayer: 0 418 | m_SortingOrder: 0 419 | --- !u!65 &1231105263 420 | BoxCollider: 421 | m_ObjectHideFlags: 0 422 | m_PrefabParentObject: {fileID: 0} 423 | m_PrefabInternal: {fileID: 0} 424 | m_GameObject: {fileID: 1231105261} 425 | m_Material: {fileID: 0} 426 | m_IsTrigger: 0 427 | m_Enabled: 1 428 | serializedVersion: 2 429 | m_Size: {x: 1, y: 1, z: 1} 430 | m_Center: {x: 0, y: 0, z: 0} 431 | --- !u!33 &1231105264 432 | MeshFilter: 433 | m_ObjectHideFlags: 0 434 | m_PrefabParentObject: {fileID: 0} 435 | m_PrefabInternal: {fileID: 0} 436 | m_GameObject: {fileID: 1231105261} 437 | m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} 438 | --- !u!4 &1231105265 439 | Transform: 440 | m_ObjectHideFlags: 0 441 | m_PrefabParentObject: {fileID: 0} 442 | m_PrefabInternal: {fileID: 0} 443 | m_GameObject: {fileID: 1231105261} 444 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 445 | m_LocalPosition: {x: 0, y: 2.63, z: 0} 446 | m_LocalScale: {x: 1, y: 1, z: 1} 447 | m_Children: [] 448 | m_Father: {fileID: 0} 449 | m_RootOrder: 4 450 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 451 | --- !u!1 &1500785744 452 | GameObject: 453 | m_ObjectHideFlags: 0 454 | m_PrefabParentObject: {fileID: 0} 455 | m_PrefabInternal: {fileID: 0} 456 | serializedVersion: 5 457 | m_Component: 458 | - component: {fileID: 1500785748} 459 | - component: {fileID: 1500785747} 460 | - component: {fileID: 1500785746} 461 | - component: {fileID: 1500785745} 462 | m_Layer: 0 463 | m_Name: Cube 464 | m_TagString: Untagged 465 | m_Icon: {fileID: 0} 466 | m_NavMeshLayer: 0 467 | m_StaticEditorFlags: 0 468 | m_IsActive: 1 469 | --- !u!23 &1500785745 470 | MeshRenderer: 471 | m_ObjectHideFlags: 0 472 | m_PrefabParentObject: {fileID: 0} 473 | m_PrefabInternal: {fileID: 0} 474 | m_GameObject: {fileID: 1500785744} 475 | m_Enabled: 1 476 | m_CastShadows: 1 477 | m_ReceiveShadows: 1 478 | m_DynamicOccludee: 1 479 | m_MotionVectors: 1 480 | m_LightProbeUsage: 1 481 | m_ReflectionProbeUsage: 1 482 | m_Materials: 483 | - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} 484 | m_StaticBatchInfo: 485 | firstSubMesh: 0 486 | subMeshCount: 0 487 | m_StaticBatchRoot: {fileID: 0} 488 | m_ProbeAnchor: {fileID: 0} 489 | m_LightProbeVolumeOverride: {fileID: 0} 490 | m_ScaleInLightmap: 1 491 | m_PreserveUVs: 1 492 | m_IgnoreNormalsForChartDetection: 0 493 | m_ImportantGI: 0 494 | m_StitchLightmapSeams: 0 495 | m_SelectedEditorRenderState: 3 496 | m_MinimumChartSize: 4 497 | m_AutoUVMaxDistance: 0.5 498 | m_AutoUVMaxAngle: 89 499 | m_LightmapParameters: {fileID: 0} 500 | m_SortingLayerID: 0 501 | m_SortingLayer: 0 502 | m_SortingOrder: 0 503 | --- !u!65 &1500785746 504 | BoxCollider: 505 | m_ObjectHideFlags: 0 506 | m_PrefabParentObject: {fileID: 0} 507 | m_PrefabInternal: {fileID: 0} 508 | m_GameObject: {fileID: 1500785744} 509 | m_Material: {fileID: 0} 510 | m_IsTrigger: 0 511 | m_Enabled: 1 512 | serializedVersion: 2 513 | m_Size: {x: 1, y: 1, z: 1} 514 | m_Center: {x: 0, y: 0, z: 0} 515 | --- !u!33 &1500785747 516 | MeshFilter: 517 | m_ObjectHideFlags: 0 518 | m_PrefabParentObject: {fileID: 0} 519 | m_PrefabInternal: {fileID: 0} 520 | m_GameObject: {fileID: 1500785744} 521 | m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} 522 | --- !u!4 &1500785748 523 | Transform: 524 | m_ObjectHideFlags: 0 525 | m_PrefabParentObject: {fileID: 0} 526 | m_PrefabInternal: {fileID: 0} 527 | m_GameObject: {fileID: 1500785744} 528 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 529 | m_LocalPosition: {x: 0, y: 0, z: 0} 530 | m_LocalScale: {x: 1, y: 1, z: 1} 531 | m_Children: [] 532 | m_Father: {fileID: 0} 533 | m_RootOrder: 3 534 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 535 | --- !u!1001 &1593654764 536 | Prefab: 537 | m_ObjectHideFlags: 0 538 | serializedVersion: 2 539 | m_Modification: 540 | m_TransformParent: {fileID: 0} 541 | m_Modifications: 542 | - target: {fileID: 4694215270170358, guid: 6f002a60626884741a0f9ac516c78709, type: 2} 543 | propertyPath: m_LocalPosition.x 544 | value: 0 545 | objectReference: {fileID: 0} 546 | - target: {fileID: 4694215270170358, guid: 6f002a60626884741a0f9ac516c78709, type: 2} 547 | propertyPath: m_LocalPosition.y 548 | value: 1 549 | objectReference: {fileID: 0} 550 | - target: {fileID: 4694215270170358, guid: 6f002a60626884741a0f9ac516c78709, type: 2} 551 | propertyPath: m_LocalPosition.z 552 | value: -10 553 | objectReference: {fileID: 0} 554 | - target: {fileID: 4694215270170358, guid: 6f002a60626884741a0f9ac516c78709, type: 2} 555 | propertyPath: m_LocalRotation.x 556 | value: 0 557 | objectReference: {fileID: 0} 558 | - target: {fileID: 4694215270170358, guid: 6f002a60626884741a0f9ac516c78709, type: 2} 559 | propertyPath: m_LocalRotation.y 560 | value: 0 561 | objectReference: {fileID: 0} 562 | - target: {fileID: 4694215270170358, guid: 6f002a60626884741a0f9ac516c78709, type: 2} 563 | propertyPath: m_LocalRotation.z 564 | value: 0 565 | objectReference: {fileID: 0} 566 | - target: {fileID: 4694215270170358, guid: 6f002a60626884741a0f9ac516c78709, type: 2} 567 | propertyPath: m_LocalRotation.w 568 | value: 1 569 | objectReference: {fileID: 0} 570 | - target: {fileID: 4694215270170358, guid: 6f002a60626884741a0f9ac516c78709, type: 2} 571 | propertyPath: m_RootOrder 572 | value: 2 573 | objectReference: {fileID: 0} 574 | - target: {fileID: 114373368657877166, guid: 6f002a60626884741a0f9ac516c78709, 575 | type: 2} 576 | propertyPath: MasterCamera 577 | value: 578 | objectReference: {fileID: 946542801} 579 | m_RemovedComponents: [] 580 | m_ParentPrefab: {fileID: 100100000, guid: 6f002a60626884741a0f9ac516c78709, type: 2} 581 | m_IsPrefabParent: 0 582 | --- !u!1 &1614711595 583 | GameObject: 584 | m_ObjectHideFlags: 0 585 | m_PrefabParentObject: {fileID: 0} 586 | m_PrefabInternal: {fileID: 0} 587 | serializedVersion: 5 588 | m_Component: 589 | - component: {fileID: 1614711599} 590 | - component: {fileID: 1614711598} 591 | - component: {fileID: 1614711597} 592 | - component: {fileID: 1614711596} 593 | m_Layer: 0 594 | m_Name: Cube (2) 595 | m_TagString: Untagged 596 | m_Icon: {fileID: 0} 597 | m_NavMeshLayer: 0 598 | m_StaticEditorFlags: 0 599 | m_IsActive: 1 600 | --- !u!23 &1614711596 601 | MeshRenderer: 602 | m_ObjectHideFlags: 0 603 | m_PrefabParentObject: {fileID: 0} 604 | m_PrefabInternal: {fileID: 0} 605 | m_GameObject: {fileID: 1614711595} 606 | m_Enabled: 1 607 | m_CastShadows: 1 608 | m_ReceiveShadows: 1 609 | m_DynamicOccludee: 1 610 | m_MotionVectors: 1 611 | m_LightProbeUsage: 1 612 | m_ReflectionProbeUsage: 1 613 | m_Materials: 614 | - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} 615 | m_StaticBatchInfo: 616 | firstSubMesh: 0 617 | subMeshCount: 0 618 | m_StaticBatchRoot: {fileID: 0} 619 | m_ProbeAnchor: {fileID: 0} 620 | m_LightProbeVolumeOverride: {fileID: 0} 621 | m_ScaleInLightmap: 1 622 | m_PreserveUVs: 1 623 | m_IgnoreNormalsForChartDetection: 0 624 | m_ImportantGI: 0 625 | m_StitchLightmapSeams: 0 626 | m_SelectedEditorRenderState: 3 627 | m_MinimumChartSize: 4 628 | m_AutoUVMaxDistance: 0.5 629 | m_AutoUVMaxAngle: 89 630 | m_LightmapParameters: {fileID: 0} 631 | m_SortingLayerID: 0 632 | m_SortingLayer: 0 633 | m_SortingOrder: 0 634 | --- !u!65 &1614711597 635 | BoxCollider: 636 | m_ObjectHideFlags: 0 637 | m_PrefabParentObject: {fileID: 0} 638 | m_PrefabInternal: {fileID: 0} 639 | m_GameObject: {fileID: 1614711595} 640 | m_Material: {fileID: 0} 641 | m_IsTrigger: 0 642 | m_Enabled: 1 643 | serializedVersion: 2 644 | m_Size: {x: 1, y: 1, z: 1} 645 | m_Center: {x: 0, y: 0, z: 0} 646 | --- !u!33 &1614711598 647 | MeshFilter: 648 | m_ObjectHideFlags: 0 649 | m_PrefabParentObject: {fileID: 0} 650 | m_PrefabInternal: {fileID: 0} 651 | m_GameObject: {fileID: 1614711595} 652 | m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} 653 | --- !u!4 &1614711599 654 | Transform: 655 | m_ObjectHideFlags: 0 656 | m_PrefabParentObject: {fileID: 0} 657 | m_PrefabInternal: {fileID: 0} 658 | m_GameObject: {fileID: 1614711595} 659 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 660 | m_LocalPosition: {x: -0.42, y: 2.46, z: -3.43} 661 | m_LocalScale: {x: 1, y: 1, z: 1} 662 | m_Children: [] 663 | m_Father: {fileID: 0} 664 | m_RootOrder: 5 665 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 666 | --- !u!1 &2047198410 667 | GameObject: 668 | m_ObjectHideFlags: 0 669 | m_PrefabParentObject: {fileID: 0} 670 | m_PrefabInternal: {fileID: 0} 671 | serializedVersion: 5 672 | m_Component: 673 | - component: {fileID: 2047198412} 674 | - component: {fileID: 2047198411} 675 | m_Layer: 0 676 | m_Name: Directional Light 677 | m_TagString: Untagged 678 | m_Icon: {fileID: 0} 679 | m_NavMeshLayer: 0 680 | m_StaticEditorFlags: 0 681 | m_IsActive: 1 682 | --- !u!108 &2047198411 683 | Light: 684 | m_ObjectHideFlags: 0 685 | m_PrefabParentObject: {fileID: 0} 686 | m_PrefabInternal: {fileID: 0} 687 | m_GameObject: {fileID: 2047198410} 688 | m_Enabled: 1 689 | serializedVersion: 8 690 | m_Type: 1 691 | m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} 692 | m_Intensity: 1 693 | m_Range: 10 694 | m_SpotAngle: 30 695 | m_CookieSize: 10 696 | m_Shadows: 697 | m_Type: 2 698 | m_Resolution: -1 699 | m_CustomResolution: -1 700 | m_Strength: 1 701 | m_Bias: 0.05 702 | m_NormalBias: 0.4 703 | m_NearPlane: 0.2 704 | m_Cookie: {fileID: 0} 705 | m_DrawHalo: 0 706 | m_Flare: {fileID: 0} 707 | m_RenderMode: 0 708 | m_CullingMask: 709 | serializedVersion: 2 710 | m_Bits: 4294967295 711 | m_Lightmapping: 4 712 | m_AreaSize: {x: 1, y: 1} 713 | m_BounceIntensity: 1 714 | m_ColorTemperature: 6570 715 | m_UseColorTemperature: 0 716 | m_ShadowRadius: 0 717 | m_ShadowAngle: 0 718 | --- !u!4 &2047198412 719 | Transform: 720 | m_ObjectHideFlags: 0 721 | m_PrefabParentObject: {fileID: 0} 722 | m_PrefabInternal: {fileID: 0} 723 | m_GameObject: {fileID: 2047198410} 724 | m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} 725 | m_LocalPosition: {x: 0, y: 3, z: 0} 726 | m_LocalScale: {x: 1, y: 1, z: 1} 727 | m_Children: [] 728 | m_Father: {fileID: 0} 729 | m_RootOrder: 1 730 | m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} 731 | -------------------------------------------------------------------------------- /Runtime/Sample/Sample.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0858f7d5408c60b42bcc71f01a14ed4a 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Runtime/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 64072e24f3434524284fcf03a3978103 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Scripts/OverdrawKun.cs: -------------------------------------------------------------------------------- 1 | // (C) UTJ 2 | using UnityEngine; 3 | 4 | namespace Utj.OverdrawKun 5 | { 6 | 7 | [ExecuteInEditMode] 8 | [RequireComponent(typeof(Camera))] 9 | [DefaultExecutionOrder(100)] 10 | class OverdrawKun : MonoBehaviour 11 | { 12 | public Camera MasterCamera = null; 13 | 14 | Camera thisCamera_ = null; 15 | protected Camera ThisCamera 16 | { 17 | get { return thisCamera_ = thisCamera_ ?? GetComponent(); } 18 | } 19 | 20 | const string ReplacementShaderName = "Utj/OverdrawKun/Overdraw"; 21 | 22 | static Shader replacementShader_ = null; 23 | protected static Shader ReplacementShader 24 | { 25 | get { return replacementShader_ = replacementShader_ ?? Shader.Find(ReplacementShaderName); } 26 | } 27 | 28 | #if UNITY_EDITOR 29 | public enum STATE 30 | { 31 | IDLE = 0, 32 | RECORDING, 33 | }; 34 | 35 | [SerializeField] int recordingInterval = 5; 36 | [SerializeField] int captureFramerate = 30; 37 | 38 | private int captureFramerateBackup; 39 | 40 | STATE state = STATE.IDLE; 41 | public STATE State 42 | { 43 | get { return state; } 44 | } 45 | int recordNo; 46 | public int RecordNum 47 | { 48 | get { return recordNo; } 49 | } 50 | int counter; 51 | string fpath; 52 | #endif 53 | 54 | 55 | void Start() 56 | { 57 | if (MasterCamera == null) 58 | { 59 | MasterCamera = Camera.main; 60 | } 61 | 62 | if (ThisCamera != null) 63 | { 64 | ThisCamera.clearFlags = CameraClearFlags.SolidColor; 65 | ThisCamera.backgroundColor = Color.clear; // clear: (0,0,0,0) 66 | ThisCamera.SetReplacementShader(ReplacementShader, null); 67 | } 68 | } 69 | 70 | void OnPreRender() 71 | { 72 | if (ThisCamera != null && MasterCamera != null) 73 | { 74 | ThisCamera.transform.position = MasterCamera.transform.position; 75 | ThisCamera.transform.rotation = MasterCamera.transform.rotation; 76 | ThisCamera.transform.localScale = MasterCamera.transform.localScale; 77 | ThisCamera.rect = MasterCamera.rect; 78 | ThisCamera.fieldOfView = MasterCamera.fieldOfView; 79 | ThisCamera.nearClipPlane = MasterCamera.nearClipPlane; 80 | ThisCamera.farClipPlane = MasterCamera.farClipPlane; 81 | } 82 | } 83 | 84 | #if UNITY_EDITOR 85 | private void OnPostRender() 86 | { 87 | if (state == STATE.RECORDING) 88 | { 89 | if (counter <= 0) 90 | { 91 | var texture2D = new Texture2D(ThisCamera.pixelWidth, ThisCamera.pixelHeight, TextureFormat.RGB24, false); 92 | if (texture2D != null) 93 | { 94 | texture2D.ReadPixels(ThisCamera.pixelRect, 0, 0); 95 | texture2D.Apply(); 96 | var bytes = texture2D.EncodeToPNG(); 97 | System.IO.File.WriteAllBytes(fpath + "/" + recordNo.ToString() + ".png", bytes); 98 | recordNo++; 99 | counter = recordingInterval; 100 | texture2D = null; 101 | } 102 | } 103 | else 104 | { 105 | counter--; 106 | } 107 | } 108 | } 109 | 110 | 111 | public void BeginProfile() 112 | { 113 | if (state == STATE.IDLE) 114 | { 115 | captureFramerateBackup = Time.captureFramerate; 116 | Time.captureFramerate = captureFramerate; 117 | recordNo = 0; 118 | counter = 0; 119 | var dateTimes = System.DateTime.Now.ToString("yyyyMMddHHmmss"); 120 | fpath = Application.dataPath + "/../" + dateTimes; 121 | if (System.IO.Directory.Exists(fpath) == false) 122 | { 123 | System.IO.Directory.CreateDirectory(fpath); 124 | } 125 | state = STATE.RECORDING; 126 | } 127 | } 128 | 129 | 130 | public void EndProfile() 131 | { 132 | if (state == STATE.RECORDING) 133 | { 134 | Time.captureFramerate = captureFramerateBackup; 135 | state = STATE.IDLE; 136 | } 137 | } 138 | #endif 139 | } 140 | } // namespace 141 | -------------------------------------------------------------------------------- /Runtime/Scripts/OverdrawKun.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b659eb085b92bfb48b2364c209affcc9 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Scripts/OverdrawKunEditor.cs: -------------------------------------------------------------------------------- 1 | // (C) UTJ 2 | #if UNITY_EDITOR 3 | using System.Collections; 4 | using System.Collections.Generic; 5 | using UnityEngine; 6 | using UnityEditor; 7 | using Utj.OverdrawKun; 8 | 9 | 10 | [CustomEditor(typeof(OverdrawKun))] 11 | public class OverdrawKunEditor : Editor{ 12 | 13 | public override void OnInspectorGUI() 14 | { 15 | base.OnInspectorGUI(); 16 | 17 | OverdrawKun overdrawKun = target as OverdrawKun; 18 | 19 | if (overdrawKun.State == OverdrawKun.STATE.IDLE) 20 | { 21 | if (GUILayout.Button("Record")) 22 | { 23 | overdrawKun.BeginProfile(); 24 | } 25 | } 26 | else 27 | { 28 | if (GUILayout.Button("Stop")) 29 | { 30 | overdrawKun.EndProfile(); 31 | } 32 | GUILayout.TextField("RecordNo:" + overdrawKun.RecordNum.ToString()); 33 | } 34 | } 35 | } 36 | #endif -------------------------------------------------------------------------------- /Runtime/Scripts/OverdrawKunEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6d0bd5908cc41a14baadc280d1295c90 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Shaders.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bdd0404c0c7b8a945adc6934283557b3 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Shaders/OverdrawKun.shader: -------------------------------------------------------------------------------- 1 | Shader "Utj/OverdrawKun/Overdraw" 2 | { 3 | SubShader 4 | { 5 | Tags { "RenderType" = "Opaque" } 6 | 7 | Blend One One 8 | ZClip False 9 | ZTest LEqual 10 | ZWrite On 11 | Cull Back 12 | //Fog { Color (0,0,0,0) } 13 | //Fog{ Mode Off } 14 | 15 | CGPROGRAM 16 | 17 | #pragma surface surf Lambert nofog 18 | 19 | 20 | struct Input { 21 | float2 uv_MainTex; 22 | }; 23 | 24 | sampler2D _MainTex; 25 | 26 | void surf (Input IN, inout SurfaceOutput o) 27 | { 28 | half4 c = tex2D (_MainTex, IN.uv_MainTex); 29 | o.Albedo = half3(0, 0, 0); 30 | o.Alpha = c.a; 31 | o.Emission = half3(1.0/255.0, 0.125, 0.25); 32 | } 33 | 34 | ENDCG 35 | } 36 | 37 | Fallback "Diffuse" 38 | } 39 | -------------------------------------------------------------------------------- /Runtime/Shaders/OverdrawKun.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 86df8de7615e3de46a14508f2f2bb53b 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/UTJ.UnityOverDrawKun.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "UTJ.UnityOverDrawKun" 3 | } 4 | -------------------------------------------------------------------------------- /Runtime/UTJ.UnityOverDrawKun.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 004982bf4c6f6b348941d8ecb34558e1 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.utj.unityoverdrawkun", 3 | "version": "0.1.1", 4 | "displayName": "UnityOverDrawKun", 5 | "description": "overdraw check tool", 6 | "unity": "2018.1", 7 | "dependencies": {}, 8 | "keywords": [], 9 | "author": { 10 | "name": "Katsumasa.Kimura", 11 | "email": "katsumasa@unity3d.com", 12 | "url": "https://github.com/katsumasa" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8950ae76772af34488802b36495aab08 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | --------------------------------------------------------------------------------