├── .gitattributes ├── .gitignore ├── CHANGELOG.md ├── CHANGELOG.md.meta ├── Documentation.pdf ├── Documentation.pdf.meta ├── Images~ ├── Card.jpg ├── Cover.jpg ├── Icon.jpg ├── Media.jpg ├── Screenshot_01.jpg └── Screenshot_02.jpg ├── README.md ├── README.md.meta ├── Scenes.meta ├── Scenes ├── Demo Background Recompiler.unity └── Demo Background Recompiler.unity.meta ├── Scripts.meta ├── Scripts ├── BackgroundRecompiler.cs ├── BackgroundRecompiler.cs.meta ├── Plugins.BackgroundRecompiler.Editor.asmdef └── Plugins.BackgroundRecompiler.Editor.asmdef.meta ├── package.json └── package.json.meta /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.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/main/Unity.gitignore 4 | # 5 | /[Ll]ibrary/ 6 | /[Tt]emp/ 7 | /[Oo]bj/ 8 | /[Bb]uild/ 9 | /[Bb]uilds/ 10 | /[Ll]ogs/ 11 | /[Uu]ser[Ss]ettings/ 12 | 13 | # MemoryCaptures can get excessive in size. 14 | # They also could contain extremely sensitive data 15 | /[Mm]emoryCaptures/ 16 | 17 | # Recordings can get excessive in size 18 | /[Rr]ecordings/ 19 | 20 | # Uncomment this line if you wish to ignore the asset store tools plugin 21 | # /[Aa]ssets/AssetStoreTools* 22 | 23 | # Autogenerated Jetbrains Rider plugin 24 | /[Aa]ssets/Plugins/Editor/JetBrains* 25 | 26 | # Visual Studio cache directory 27 | .vs/ 28 | 29 | # Gradle cache directory 30 | .gradle/ 31 | 32 | # Autogenerated VS/MD/Consulo solution and project files 33 | ExportedObj/ 34 | .consulo/ 35 | *.csproj 36 | *.unityproj 37 | *.sln 38 | *.suo 39 | *.tmp 40 | *.user 41 | *.userprefs 42 | *.pidb 43 | *.booproj 44 | *.svd 45 | *.pdb 46 | *.mdb 47 | *.opendb 48 | *.VC.db 49 | 50 | # Unity3D generated meta files 51 | *.pidb.meta 52 | *.pdb.meta 53 | *.mdb.meta 54 | 55 | # Unity3D generated file on crash reports 56 | sysinfo.txt 57 | 58 | # Builds 59 | *.apk 60 | *.aab 61 | *.unitypackage 62 | *.app 63 | 64 | # Crashlytics generated file 65 | crashlytics-build.properties 66 | 67 | # Packed Addressables 68 | /[Aa]ssets/[Aa]ddressable[Aa]ssets[Dd]ata/*/*.bin* 69 | 70 | # Temporary auto-generated Android Assets 71 | /[Aa]ssets/[Ss]treamingAssets/aa.meta 72 | /[Aa]ssets/[Ss]treamingAssets/aa/* 73 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## [1.0.2] - Oct 26, 2022 2 | - Fixed critical bug that would increase recompile times by few seconds depending on the project size. 3 | - Added "Debug Mode" option to the preferences. When enabled, plugin will log more information to the console. 4 | 5 | ## [1.0.1] - Oct 13, 2022 6 | - Added support for Locked Assembly Reloads. It won't auto recompile if the assembly reloads are locked. 7 | - Fixed not getting disposed of the file changes watcher. 8 | - Fixed 'Enabled' checkbox only taking effect on next domain reload. Now it takes effect immediately. 9 | 10 | ## [1.0.0] - Oct 5, 2022 11 | - Initial release -------------------------------------------------------------------------------- /CHANGELOG.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 44a98f28e833eb1459f71a04c3a7676d 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Documentation.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INeatFreak/unity-background-recompiler/16cfd051b49138c4d66c4a822ac2749d3bdd5667/Documentation.pdf -------------------------------------------------------------------------------- /Documentation.pdf.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7e48702f74f610041bf3f5c7a1c52d1b 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Images~/Card.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INeatFreak/unity-background-recompiler/16cfd051b49138c4d66c4a822ac2749d3bdd5667/Images~/Card.jpg -------------------------------------------------------------------------------- /Images~/Cover.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INeatFreak/unity-background-recompiler/16cfd051b49138c4d66c4a822ac2749d3bdd5667/Images~/Cover.jpg -------------------------------------------------------------------------------- /Images~/Icon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INeatFreak/unity-background-recompiler/16cfd051b49138c4d66c4a822ac2749d3bdd5667/Images~/Icon.jpg -------------------------------------------------------------------------------- /Images~/Media.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INeatFreak/unity-background-recompiler/16cfd051b49138c4d66c4a822ac2749d3bdd5667/Images~/Media.jpg -------------------------------------------------------------------------------- /Images~/Screenshot_01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INeatFreak/unity-background-recompiler/16cfd051b49138c4d66c4a822ac2749d3bdd5667/Images~/Screenshot_01.jpg -------------------------------------------------------------------------------- /Images~/Screenshot_02.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/INeatFreak/unity-background-recompiler/16cfd051b49138c4d66c4a822ac2749d3bdd5667/Images~/Screenshot_02.jpg -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ⚠ This tool is now archived and will not be updated anymore. Please consider using one of the new free hot reload solutions ([Fast Script Reload](https://assetstore.unity.com/packages/tools/utilities/fast-script-reload-239351) or [HotReload](hotreload.net)) instead to reduce complications time. 2 | 3 | # Unity Background Recompiler 4 | 5 | ![](Images~/Media.jpg) 6 | 7 | Auto recompiles the editor when saving the scripts. Without the need to ALT+TAB out of the code editor back into the unity to start recompiling. 8 | 9 | You can also get it from Unity [Asset Store](https://u3d.as/2W4H). 10 | 11 | # Screenshots 12 | 13 | ![](Images~/Screenshot_01.jpg) 14 | 15 | ![](Images~/Screenshot_02.jpg) 16 | -------------------------------------------------------------------------------- /README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dd909a69524e40843a8b0cffd88f597f 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Scenes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d669c36d511ecc045bab6de39a71aa9e 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Scenes/Demo Background Recompiler.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: 9 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.3731193, g: 0.38073996, b: 0.35872698, a: 1} 42 | m_UseRadianceAmbientProbe: 0 43 | --- !u!157 &3 44 | LightmapSettings: 45 | m_ObjectHideFlags: 0 46 | serializedVersion: 12 47 | m_GIWorkflowMode: 1 48 | m_GISettings: 49 | serializedVersion: 2 50 | m_BounceScale: 1 51 | m_IndirectOutputScale: 1 52 | m_AlbedoBoost: 1 53 | m_EnvironmentLightingMode: 0 54 | m_EnableBakedLightmaps: 1 55 | m_EnableRealtimeLightmaps: 0 56 | m_LightmapEditorSettings: 57 | serializedVersion: 12 58 | m_Resolution: 2 59 | m_BakeResolution: 40 60 | m_AtlasSize: 1024 61 | m_AO: 0 62 | m_AOMaxDistance: 1 63 | m_CompAOExponent: 1 64 | m_CompAOExponentDirect: 0 65 | m_ExtractAmbientOcclusion: 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: 1 76 | m_PVRSampling: 1 77 | m_PVRDirectSampleCount: 32 78 | m_PVRSampleCount: 512 79 | m_PVRBounces: 2 80 | m_PVREnvironmentSampleCount: 256 81 | m_PVREnvironmentReferencePointCount: 2048 82 | m_PVRFilteringMode: 1 83 | m_PVRDenoiserTypeDirect: 1 84 | m_PVRDenoiserTypeIndirect: 1 85 | m_PVRDenoiserTypeAO: 1 86 | m_PVRFilterTypeDirect: 0 87 | m_PVRFilterTypeIndirect: 0 88 | m_PVRFilterTypeAO: 0 89 | m_PVREnvironmentMIS: 1 90 | m_PVRCulling: 1 91 | m_PVRFilteringGaussRadiusDirect: 1 92 | m_PVRFilteringGaussRadiusIndirect: 5 93 | m_PVRFilteringGaussRadiusAO: 2 94 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 95 | m_PVRFilteringAtrousPositionSigmaIndirect: 2 96 | m_PVRFilteringAtrousPositionSigmaAO: 1 97 | m_ExportTrainingData: 0 98 | m_TrainingDataDestination: TrainingData 99 | m_LightProbeSampleCountMultiplier: 4 100 | m_LightingDataAsset: {fileID: 0} 101 | m_LightingSettings: {fileID: 0} 102 | --- !u!196 &4 103 | NavMeshSettings: 104 | serializedVersion: 2 105 | m_ObjectHideFlags: 0 106 | m_BuildSettings: 107 | serializedVersion: 2 108 | agentTypeID: 0 109 | agentRadius: 0.5 110 | agentHeight: 2 111 | agentSlope: 45 112 | agentClimb: 0.4 113 | ledgeDropHeight: 0 114 | maxJumpAcrossDistance: 0 115 | minRegionArea: 2 116 | manualCellSize: 0 117 | cellSize: 0.16666667 118 | manualTileSize: 0 119 | tileSize: 256 120 | accuratePlacement: 0 121 | maxJobWorkers: 0 122 | preserveTilesOutsideBounds: 0 123 | debug: 124 | m_Flags: 0 125 | m_NavMeshData: {fileID: 0} 126 | --- !u!1 &365962687 127 | GameObject: 128 | m_ObjectHideFlags: 0 129 | m_CorrespondingSourceObject: {fileID: 0} 130 | m_PrefabInstance: {fileID: 0} 131 | m_PrefabAsset: {fileID: 0} 132 | serializedVersion: 6 133 | m_Component: 134 | - component: {fileID: 365962688} 135 | - component: {fileID: 365962690} 136 | - component: {fileID: 365962689} 137 | m_Layer: 5 138 | m_Name: Fullscreen Text 139 | m_TagString: Untagged 140 | m_Icon: {fileID: 0} 141 | m_NavMeshLayer: 0 142 | m_StaticEditorFlags: 0 143 | m_IsActive: 1 144 | --- !u!224 &365962688 145 | RectTransform: 146 | m_ObjectHideFlags: 0 147 | m_CorrespondingSourceObject: {fileID: 0} 148 | m_PrefabInstance: {fileID: 0} 149 | m_PrefabAsset: {fileID: 0} 150 | m_GameObject: {fileID: 365962687} 151 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 152 | m_LocalPosition: {x: 0, y: 0, z: 0} 153 | m_LocalScale: {x: 1, y: 1, z: 1} 154 | m_Children: [] 155 | m_Father: {fileID: 1264810851} 156 | m_RootOrder: 0 157 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 158 | m_AnchorMin: {x: 0, y: 0} 159 | m_AnchorMax: {x: 1, y: 1} 160 | m_AnchoredPosition: {x: 0, y: 0} 161 | m_SizeDelta: {x: 0, y: 0} 162 | m_Pivot: {x: 0.5, y: 0.5} 163 | --- !u!114 &365962689 164 | MonoBehaviour: 165 | m_ObjectHideFlags: 0 166 | m_CorrespondingSourceObject: {fileID: 0} 167 | m_PrefabInstance: {fileID: 0} 168 | m_PrefabAsset: {fileID: 0} 169 | m_GameObject: {fileID: 365962687} 170 | m_Enabled: 1 171 | m_EditorHideFlags: 0 172 | m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} 173 | m_Name: 174 | m_EditorClassIdentifier: 175 | m_Material: {fileID: 0} 176 | m_Color: {r: 0.7924528, g: 0.7924528, b: 0.7924528, a: 1} 177 | m_RaycastTarget: 1 178 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 179 | m_Maskable: 1 180 | m_OnCullStateChanged: 181 | m_PersistentCalls: 182 | m_Calls: [] 183 | m_FontData: 184 | m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} 185 | m_FontSize: 44 186 | m_FontStyle: 0 187 | m_BestFit: 0 188 | m_MinSize: 4 189 | m_MaxSize: 57 190 | m_Alignment: 4 191 | m_AlignByGeometry: 0 192 | m_RichText: 1 193 | m_HorizontalOverflow: 0 194 | m_VerticalOverflow: 0 195 | m_LineSpacing: 1 196 | m_Text: ' 197 | 198 | Background Recompiler v1.0.2 199 | 200 | made by INeatFreak 201 | 202 | 203 | 204 | Auto 205 | recompiles editor when saving the scripts. 206 | 207 | 208 | Without the need to ALT+TAB 209 | out of the code editor back in to the unity to start recompiling. 210 | 211 | 212 | 213 | Can 214 | be especially useful when working multiple monitors, one with Code Editor 215 | 216 | and 217 | in other Unity open. 218 | 219 | 220 | 221 | 222 | 223 | Go to "Preferences/Plugins/Background 224 | Recompiler" to change preferences. 225 | 226 | *Note that this requires 227 | the SettingsManager package installed. Auto install with "Help/Plugins/Background 228 | Recompiler/Fix" command. 229 | 230 | ' 231 | --- !u!222 &365962690 232 | CanvasRenderer: 233 | m_ObjectHideFlags: 0 234 | m_CorrespondingSourceObject: {fileID: 0} 235 | m_PrefabInstance: {fileID: 0} 236 | m_PrefabAsset: {fileID: 0} 237 | m_GameObject: {fileID: 365962687} 238 | m_CullTransparentMesh: 1 239 | --- !u!1 &566633653 240 | GameObject: 241 | m_ObjectHideFlags: 0 242 | m_CorrespondingSourceObject: {fileID: 0} 243 | m_PrefabInstance: {fileID: 0} 244 | m_PrefabAsset: {fileID: 0} 245 | serializedVersion: 6 246 | m_Component: 247 | - component: {fileID: 566633656} 248 | - component: {fileID: 566633655} 249 | - component: {fileID: 566633654} 250 | m_Layer: 0 251 | m_Name: Main Camera 252 | m_TagString: MainCamera 253 | m_Icon: {fileID: 0} 254 | m_NavMeshLayer: 0 255 | m_StaticEditorFlags: 0 256 | m_IsActive: 1 257 | --- !u!81 &566633654 258 | AudioListener: 259 | m_ObjectHideFlags: 0 260 | m_CorrespondingSourceObject: {fileID: 0} 261 | m_PrefabInstance: {fileID: 0} 262 | m_PrefabAsset: {fileID: 0} 263 | m_GameObject: {fileID: 566633653} 264 | m_Enabled: 1 265 | --- !u!20 &566633655 266 | Camera: 267 | m_ObjectHideFlags: 0 268 | m_CorrespondingSourceObject: {fileID: 0} 269 | m_PrefabInstance: {fileID: 0} 270 | m_PrefabAsset: {fileID: 0} 271 | m_GameObject: {fileID: 566633653} 272 | m_Enabled: 1 273 | serializedVersion: 2 274 | m_ClearFlags: 2 275 | m_BackGroundColor: {r: 0.16981131, g: 0.16981131, b: 0.16981131, a: 0} 276 | m_projectionMatrixMode: 1 277 | m_GateFitMode: 2 278 | m_FOVAxisMode: 0 279 | m_SensorSize: {x: 36, y: 24} 280 | m_LensShift: {x: 0, y: 0} 281 | m_FocalLength: 50 282 | m_NormalizedViewPortRect: 283 | serializedVersion: 2 284 | x: 0 285 | y: 0 286 | width: 1 287 | height: 1 288 | near clip plane: 0.01 289 | far clip plane: 1000 290 | field of view: 60 291 | orthographic: 0 292 | orthographic size: 5 293 | m_Depth: -1 294 | m_CullingMask: 295 | serializedVersion: 2 296 | m_Bits: 4294967295 297 | m_RenderingPath: -1 298 | m_TargetTexture: {fileID: 0} 299 | m_TargetDisplay: 0 300 | m_TargetEye: 3 301 | m_HDR: 1 302 | m_AllowMSAA: 1 303 | m_AllowDynamicResolution: 0 304 | m_ForceIntoRT: 0 305 | m_OcclusionCulling: 1 306 | m_StereoConvergence: 10 307 | m_StereoSeparation: 0.022 308 | --- !u!4 &566633656 309 | Transform: 310 | m_ObjectHideFlags: 0 311 | m_CorrespondingSourceObject: {fileID: 0} 312 | m_PrefabInstance: {fileID: 0} 313 | m_PrefabAsset: {fileID: 0} 314 | m_GameObject: {fileID: 566633653} 315 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 316 | m_LocalPosition: {x: 0, y: 1, z: -10} 317 | m_LocalScale: {x: 1, y: 1, z: 1} 318 | m_Children: [] 319 | m_Father: {fileID: 0} 320 | m_RootOrder: 0 321 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 322 | --- !u!1 &782103702 323 | GameObject: 324 | m_ObjectHideFlags: 0 325 | m_CorrespondingSourceObject: {fileID: 0} 326 | m_PrefabInstance: {fileID: 0} 327 | m_PrefabAsset: {fileID: 0} 328 | serializedVersion: 6 329 | m_Component: 330 | - component: {fileID: 782103705} 331 | - component: {fileID: 782103704} 332 | - component: {fileID: 782103703} 333 | m_Layer: 0 334 | m_Name: EventSystem 335 | m_TagString: Untagged 336 | m_Icon: {fileID: 0} 337 | m_NavMeshLayer: 0 338 | m_StaticEditorFlags: 0 339 | m_IsActive: 1 340 | --- !u!114 &782103703 341 | MonoBehaviour: 342 | m_ObjectHideFlags: 0 343 | m_CorrespondingSourceObject: {fileID: 0} 344 | m_PrefabInstance: {fileID: 0} 345 | m_PrefabAsset: {fileID: 0} 346 | m_GameObject: {fileID: 782103702} 347 | m_Enabled: 1 348 | m_EditorHideFlags: 0 349 | m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3} 350 | m_Name: 351 | m_EditorClassIdentifier: 352 | m_HorizontalAxis: Horizontal 353 | m_VerticalAxis: Vertical 354 | m_SubmitButton: Submit 355 | m_CancelButton: Cancel 356 | m_InputActionsPerSecond: 10 357 | m_RepeatDelay: 0.5 358 | m_ForceModuleActive: 0 359 | --- !u!114 &782103704 360 | MonoBehaviour: 361 | m_ObjectHideFlags: 0 362 | m_CorrespondingSourceObject: {fileID: 0} 363 | m_PrefabInstance: {fileID: 0} 364 | m_PrefabAsset: {fileID: 0} 365 | m_GameObject: {fileID: 782103702} 366 | m_Enabled: 1 367 | m_EditorHideFlags: 0 368 | m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3} 369 | m_Name: 370 | m_EditorClassIdentifier: 371 | m_FirstSelected: {fileID: 0} 372 | m_sendNavigationEvents: 1 373 | m_DragThreshold: 10 374 | --- !u!4 &782103705 375 | Transform: 376 | m_ObjectHideFlags: 0 377 | m_CorrespondingSourceObject: {fileID: 0} 378 | m_PrefabInstance: {fileID: 0} 379 | m_PrefabAsset: {fileID: 0} 380 | m_GameObject: {fileID: 782103702} 381 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 382 | m_LocalPosition: {x: 0, y: 0, z: 0} 383 | m_LocalScale: {x: 1, y: 1, z: 1} 384 | m_Children: [] 385 | m_Father: {fileID: 0} 386 | m_RootOrder: 2 387 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 388 | --- !u!1 &1264810847 389 | GameObject: 390 | m_ObjectHideFlags: 0 391 | m_CorrespondingSourceObject: {fileID: 0} 392 | m_PrefabInstance: {fileID: 0} 393 | m_PrefabAsset: {fileID: 0} 394 | serializedVersion: 6 395 | m_Component: 396 | - component: {fileID: 1264810851} 397 | - component: {fileID: 1264810850} 398 | - component: {fileID: 1264810849} 399 | - component: {fileID: 1264810848} 400 | m_Layer: 5 401 | m_Name: Canvas 402 | m_TagString: Untagged 403 | m_Icon: {fileID: 0} 404 | m_NavMeshLayer: 0 405 | m_StaticEditorFlags: 0 406 | m_IsActive: 1 407 | --- !u!114 &1264810848 408 | MonoBehaviour: 409 | m_ObjectHideFlags: 0 410 | m_CorrespondingSourceObject: {fileID: 0} 411 | m_PrefabInstance: {fileID: 0} 412 | m_PrefabAsset: {fileID: 0} 413 | m_GameObject: {fileID: 1264810847} 414 | m_Enabled: 1 415 | m_EditorHideFlags: 0 416 | m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} 417 | m_Name: 418 | m_EditorClassIdentifier: 419 | m_IgnoreReversedGraphics: 1 420 | m_BlockingObjects: 0 421 | m_BlockingMask: 422 | serializedVersion: 2 423 | m_Bits: 4294967295 424 | --- !u!114 &1264810849 425 | MonoBehaviour: 426 | m_ObjectHideFlags: 0 427 | m_CorrespondingSourceObject: {fileID: 0} 428 | m_PrefabInstance: {fileID: 0} 429 | m_PrefabAsset: {fileID: 0} 430 | m_GameObject: {fileID: 1264810847} 431 | m_Enabled: 1 432 | m_EditorHideFlags: 0 433 | m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} 434 | m_Name: 435 | m_EditorClassIdentifier: 436 | m_UiScaleMode: 1 437 | m_ReferencePixelsPerUnit: 100 438 | m_ScaleFactor: 1 439 | m_ReferenceResolution: {x: 1920, y: 1080} 440 | m_ScreenMatchMode: 0 441 | m_MatchWidthOrHeight: 0 442 | m_PhysicalUnit: 3 443 | m_FallbackScreenDPI: 96 444 | m_DefaultSpriteDPI: 96 445 | m_DynamicPixelsPerUnit: 1 446 | m_PresetInfoIsWorld: 0 447 | --- !u!223 &1264810850 448 | Canvas: 449 | m_ObjectHideFlags: 0 450 | m_CorrespondingSourceObject: {fileID: 0} 451 | m_PrefabInstance: {fileID: 0} 452 | m_PrefabAsset: {fileID: 0} 453 | m_GameObject: {fileID: 1264810847} 454 | m_Enabled: 1 455 | serializedVersion: 3 456 | m_RenderMode: 0 457 | m_Camera: {fileID: 0} 458 | m_PlaneDistance: 100 459 | m_PixelPerfect: 0 460 | m_ReceivesEvents: 1 461 | m_OverrideSorting: 0 462 | m_OverridePixelPerfect: 0 463 | m_SortingBucketNormalizedSize: 0 464 | m_AdditionalShaderChannelsFlag: 0 465 | m_SortingLayerID: 0 466 | m_SortingOrder: 0 467 | m_TargetDisplay: 0 468 | --- !u!224 &1264810851 469 | RectTransform: 470 | m_ObjectHideFlags: 0 471 | m_CorrespondingSourceObject: {fileID: 0} 472 | m_PrefabInstance: {fileID: 0} 473 | m_PrefabAsset: {fileID: 0} 474 | m_GameObject: {fileID: 1264810847} 475 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 476 | m_LocalPosition: {x: 0, y: 0, z: 0} 477 | m_LocalScale: {x: 0, y: 0, z: 0} 478 | m_Children: 479 | - {fileID: 365962688} 480 | m_Father: {fileID: 0} 481 | m_RootOrder: 1 482 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 483 | m_AnchorMin: {x: 0, y: 0} 484 | m_AnchorMax: {x: 0, y: 0} 485 | m_AnchoredPosition: {x: 0, y: 0} 486 | m_SizeDelta: {x: 0, y: 0} 487 | m_Pivot: {x: 0, y: 0} 488 | -------------------------------------------------------------------------------- /Scenes/Demo Background Recompiler.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e8e43033e51a3854b8de1426ad8b0cfa 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fae96f3a54bb65b418b4ba8e35878456 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Scripts/BackgroundRecompiler.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_EDITOR 2 | 3 | // Made by INeatFreak 4 | // Asset Store: https://u3d.as/2W4H 5 | // GitHub: https://github.com/INeatFreak/unity-background-recompiler 6 | 7 | using System.IO; 8 | using System.Reflection; 9 | using System.Threading; 10 | 11 | using UnityEngine; 12 | 13 | using UnityEditor; 14 | 15 | namespace Plugins.BackgroundRecompiler 16 | { 17 | public static class BackgroundRecompiler 18 | { 19 | // constants 20 | public const string Version = "1.0.2"; 21 | public const string AssetStoreURL = "https://u3d.as/2W4H"; 22 | public const string GitHubURL = "https://github.com/INeatFreak/unity-background-recompiler"; 23 | 24 | // variables 25 | public static bool Enabled = true; 26 | public static bool DebugMode = false; 27 | public static bool LogWhenBackgroundCompiled = true; 28 | private static bool shouldRecompile = false; 29 | 30 | private static FileSystemWatcher watcher; 31 | 32 | private static MethodInfo CanReloadAssembliesMethod; 33 | private static bool IsAssemblyLocked 34 | { 35 | get { 36 | if (CanReloadAssembliesMethod == null) { 37 | // get the method info for the CanReloadAssemblies method 38 | // source: https://github.com/Unity-Technologies/UnityCsReference/blob/master/Editor/Mono/EditorApplication.bindings.cs#L154 39 | CanReloadAssembliesMethod = typeof(EditorApplication).GetMethod("CanReloadAssemblies", BindingFlags.NonPublic | BindingFlags.Static); 40 | 41 | if (CanReloadAssembliesMethod == null) { 42 | Debug.LogError("Can't find CanReloadAssemblies method. It might have been renamed or removed."); 43 | } 44 | } 45 | 46 | return !(bool)CanReloadAssembliesMethod.Invoke(null, null); 47 | } 48 | } 49 | 50 | // gets called when the editor is started and after the editor is recompile 51 | [InitializeOnLoadMethod] 52 | private static void Initialize() 53 | { 54 | LoadPrefs(); 55 | 56 | SetActive(Enabled); 57 | } 58 | 59 | private static void OnUpdate() 60 | { 61 | //// + TODO: check if assembly compiling is locked. Incase 'EditorApplication.LockReloadAssemblies();' is used. 62 | 63 | 64 | if (shouldRecompile == false) return; 65 | if (EditorApplication.isCompiling) return; 66 | if (EditorApplication.isUpdating) return; 67 | 68 | 69 | if (Enabled == false) { 70 | shouldRecompile = false; // to prevent recompile when changes are made while and enabled again 71 | return; 72 | } 73 | 74 | if (IsAssemblyLocked) { 75 | Log("Changes detected in background! But cannot recompile because the assembly compiling is locked."); 76 | shouldRecompile = false; 77 | return; 78 | } 79 | 80 | 81 | // . Recompile 82 | if (LogWhenBackgroundCompiled) { 83 | Log("Changes detected in background! Auto Recompiling..."); 84 | } 85 | 86 | // disabled because it might not be needed 87 | // if (watcher != null) 88 | // watcher.Dispose(); 89 | 90 | // Calling Refresh will be enough for unity 91 | // to detect script changes and recompile 92 | // Must be called inside editor update loop! 93 | AssetDatabase.Refresh(); 94 | 95 | shouldRecompile = false; 96 | } 97 | 98 | 99 | public static void SetActive(bool newState) 100 | { 101 | Enabled = newState; 102 | 103 | if (newState) { 104 | // Enable 105 | 106 | var timer1 = System.Diagnostics.Stopwatch.StartNew(); 107 | 108 | if (watcher != null) 109 | watcher.Dispose(); 110 | 111 | // create watcher in a seperate thread to prevent unity from freezing and increasing recompile times 112 | var dataPath = Application.dataPath; 113 | var thread = new Thread( 114 | () => { 115 | var timer2 = System.Diagnostics.Stopwatch.StartNew(); 116 | 117 | // watch for any file changes with the .cs extension 118 | watcher = new FileSystemWatcher(dataPath, "*.cs") 119 | { 120 | NotifyFilter = 121 | NotifyFilters.LastAccess | 122 | NotifyFilters.LastWrite | 123 | NotifyFilters.FileName | 124 | NotifyFilters.DirectoryName , 125 | IncludeSubdirectories = true , 126 | EnableRaisingEvents = true , 127 | }; 128 | 129 | watcher.Changed += OnScriptFileChange; 130 | watcher.Created += OnScriptFileChange; 131 | watcher.Deleted += OnScriptFileChange; 132 | watcher.Renamed += OnScriptFileChange; 133 | 134 | // unsubscribe when disposed 135 | watcher.Disposed += (sender, args) => { 136 | watcher.Changed -= OnScriptFileChange; 137 | watcher.Created -= OnScriptFileChange; 138 | watcher.Deleted -= OnScriptFileChange; 139 | watcher.Renamed -= OnScriptFileChange; 140 | }; 141 | 142 | timer2.Stop(); 143 | LogDebug("Watcher created in " + timer2.ElapsedMilliseconds + " ms using separate thread!"); 144 | } 145 | ); 146 | thread.Start(); 147 | 148 | 149 | EditorApplication.update += OnUpdate; 150 | 151 | // Log("Auto background compiler is enabled."); 152 | 153 | timer1.Stop(); 154 | LogDebug("Initialized in " + timer1.ElapsedMilliseconds + " ms."); 155 | 156 | } else { 157 | // Disable 158 | 159 | if (watcher != null) 160 | watcher.Dispose(); 161 | 162 | // Log("Auto background compiler is disabled."); 163 | 164 | LogDebug("Plugin disabled and disposed of watcher!"); 165 | 166 | EditorApplication.update -= OnUpdate; 167 | } 168 | } 169 | 170 | private static void OnScriptFileChange(object sender, FileSystemEventArgs e) { 171 | shouldRecompile = true; 172 | } 173 | 174 | 175 | 176 | #region Preferences 177 | private const string PREFS_KEY = "BACKGROUND_RECOMPILER_"; 178 | private const string PREFS_KEY_ENABLED = PREFS_KEY + "ENABLED"; 179 | private const string PREFS_KEY_DEBUG_MODE = PREFS_KEY + "DEBUG_MODE"; 180 | private const string PREFS_KEY_LOG_COMPILES = PREFS_KEY + "LOG_COMPILES"; 181 | 182 | public static void SavePrefs() 183 | { 184 | EditorPrefs.SetBool(PREFS_KEY_ENABLED, Enabled); 185 | EditorPrefs.SetBool(PREFS_KEY_DEBUG_MODE, DebugMode); 186 | EditorPrefs.SetBool(PREFS_KEY_LOG_COMPILES, LogWhenBackgroundCompiled); 187 | } 188 | public static void LoadPrefs() 189 | { 190 | Enabled = EditorPrefs.GetBool(PREFS_KEY_ENABLED, Enabled); 191 | DebugMode = EditorPrefs.GetBool(PREFS_KEY_DEBUG_MODE, DebugMode); 192 | LogWhenBackgroundCompiled = EditorPrefs.GetBool(PREFS_KEY_LOG_COMPILES, LogWhenBackgroundCompiled); 193 | } 194 | #endregion Preferences 195 | 196 | 197 | // custom logging 198 | private const string LOG_PREFIX = "[ Background Recompiler ] - "; 199 | private const string LOG_POSTFIX = "\n\n- You can disable this log in the preferences window @\"Preferences/Plugins/Background Recompiler\".\n"; 200 | 201 | private static void Log(string message) 202 | { 203 | UnityEngine.Debug.Log(LOG_PREFIX + message + LOG_POSTFIX); 204 | } 205 | private static void LogDebug(string message) 206 | { 207 | if (DebugMode) 208 | UnityEngine.Debug.Log(LOG_PREFIX + "Debug - " + message); 209 | } 210 | private static void LogError(string message) 211 | { 212 | UnityEngine.Debug.LogError(LOG_PREFIX + message + LOG_POSTFIX); 213 | } 214 | 215 | 216 | 217 | #if PACKAGE_SETTINGS_MANAGER // this define is declared in assembly definition file (located in the same directory) when the package is installed in the project. 218 | 219 | // Preferences Window Entry 220 | internal class PluginPrefsProvider : SettingsProvider 221 | { 222 | private const string PreferencePath = "Plugins/Background Recompiler"; 223 | 224 | 225 | private static PluginPrefsProvider provider; 226 | 227 | 228 | private PluginPrefsProvider(string path, SettingsScope scope) 229 | : base(path, scope) {} 230 | 231 | 232 | public override void OnGUI(string searchContext) 233 | { 234 | EditorGUI.BeginChangeCheck(); 235 | 236 | GUILayout.Space(10); 237 | 238 | EditorGUILayout.BeginHorizontal(); 239 | GUILayout.Space(10); 240 | EditorGUIUtility.labelWidth += 100; 241 | EditorGUILayout.BeginVertical(); 242 | 243 | 244 | // draw pref fields 245 | var enabled = EditorGUILayout.Toggle("Enabled", BackgroundRecompiler.Enabled); 246 | if (enabled != BackgroundRecompiler.Enabled) { 247 | BackgroundRecompiler.SetActive(enabled); 248 | } 249 | var debugMode = EditorGUILayout.Toggle("Debug Mode", BackgroundRecompiler.DebugMode); 250 | if (debugMode != BackgroundRecompiler.DebugMode) { 251 | BackgroundRecompiler.DebugMode = debugMode; 252 | } 253 | 254 | GUILayout.Space(10); 255 | 256 | BackgroundRecompiler.LogWhenBackgroundCompiled = EditorGUILayout.Toggle("Log When Background Compiled", BackgroundRecompiler.LogWhenBackgroundCompiled); 257 | 258 | 259 | 260 | EditorGUILayout.EndVertical(); 261 | EditorGUIUtility.labelWidth -= 100; 262 | GUILayout.Space(10); 263 | EditorGUILayout.EndHorizontal(); 264 | 265 | GUILayout.FlexibleSpace(); 266 | 267 | GUILayout.BeginHorizontal(); 268 | GUILayout.FlexibleSpace(); 269 | string label = "Background Recompiler v" + BackgroundRecompiler.Version + " by INeatFreak"; 270 | if (GUILayout.Button(new GUIContent(label, "Click to open the Asset Store page!"), EditorStyles.miniLabel)) { 271 | Application.OpenURL(AssetStoreURL); 272 | } 273 | GUILayout.FlexibleSpace(); 274 | GUILayout.EndHorizontal(); 275 | 276 | GUILayout.Space(5); 277 | 278 | if(EditorGUI.EndChangeCheck()) { 279 | BackgroundRecompiler.SavePrefs(); 280 | } 281 | } 282 | 283 | 284 | [SettingsProvider] 285 | private static SettingsProvider GetSettingsProvider() 286 | { 287 | if (provider == null) { 288 | provider = new PluginPrefsProvider(PreferencePath, SettingsScope.User); 289 | } 290 | 291 | return provider; 292 | } 293 | } 294 | 295 | #else // when Settings Manager package not included 296 | 297 | // Preferences Menu Item 298 | private const string MENU_ITEM_PATH = "Plugins/Background Recompiler/"; 299 | private const string MENU_ITEM_ENABLED = MENU_ITEM_PATH + "Enabled"; 300 | private const string MENU_ITEM_DEBUG_MODE = MENU_ITEM_PATH + "Debug Mode"; 301 | private const string MENU_ITEM_LOG_COMPILES = MENU_ITEM_PATH + "Log Compiles"; 302 | 303 | [MenuItem(MENU_ITEM_ENABLED)] 304 | private static void ToggleOnOff() { 305 | Enabled = !Enabled; 306 | SavePrefs(); 307 | 308 | Menu.SetChecked(MENU_ITEM_ENABLED, Enabled); 309 | } 310 | 311 | [MenuItem(MENU_ITEM_DEBUG_MODE)] 312 | private static void ToggleDebugMode() { 313 | DebugMode = !DebugMode; 314 | SavePrefs(); 315 | 316 | Menu.SetChecked(MENU_ITEM_DEBUG_MODE, DebugMode); 317 | } 318 | 319 | [MenuItem(MENU_ITEM_LOG_COMPILES)] 320 | private static void ToggleLogCompiles() { 321 | LogWhenBackgroundCompiled = !LogWhenBackgroundCompiled; 322 | SavePrefs(); 323 | 324 | Menu.SetChecked(MENU_ITEM_LOG_COMPILES, LogWhenBackgroundCompiled); 325 | } 326 | 327 | // add dependend packages 328 | [MenuItem("Help/Plugins/Background Recompiler/Fix")] 329 | private static void HelpFixPlugin() 330 | { 331 | if (EditorUtility.DisplayDialog("Missing Dependencies", "Plugin needs SettingsManager package to create preferences window. Import now?", "Yes", "No")) { 332 | 333 | var request = UnityEditor.PackageManager.Client.Add("com.unity.settings-manager@1.0.0"); 334 | while (!request.IsCompleted) { 335 | if (request.Status == UnityEditor.PackageManager.StatusCode.Failure) { 336 | LogError("Failed to add package: " + request.Error.message); 337 | break; 338 | } 339 | } 340 | } 341 | } 342 | #endif 343 | } 344 | } 345 | 346 | #endif -------------------------------------------------------------------------------- /Scripts/BackgroundRecompiler.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f11f30525695e1b40990f6e9e8079a80 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Scripts/Plugins.BackgroundRecompiler.Editor.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Plugins.BackgroundRecompiler.Editor", 3 | "rootNamespace": "", 4 | "references": [], 5 | "includePlatforms": [ 6 | "Editor" 7 | ], 8 | "excludePlatforms": [], 9 | "allowUnsafeCode": false, 10 | "overrideReferences": false, 11 | "precompiledReferences": [], 12 | "autoReferenced": true, 13 | "defineConstraints": [], 14 | "versionDefines": [ 15 | { 16 | "name": "com.unity.settings-manager", 17 | "expression": "1.0.0", 18 | "define": "PACKAGE_SETTINGS_MANAGER" 19 | } 20 | ], 21 | "noEngineReferences": false 22 | } -------------------------------------------------------------------------------- /Scripts/Plugins.BackgroundRecompiler.Editor.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7183d2233e41f3342bc2964fcc4a0e13 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.ineatfreak.background-recompiler", 3 | "displayName": "Background Recompiler", 4 | "description": "Auto recompiles the editor when saving the scripts. Without the need to ALT+TAB out of the code editor back into the unity to start recompiling.", 5 | "version": "1.0.2", 6 | "unity": "2020.3", 7 | "keywords": [ 8 | "tool", 9 | "utility", 10 | "recompile" 11 | ], 12 | "type": "tool", 13 | "dependencies": { 14 | "com.unity.settings-manager": "1.0.0" 15 | }, 16 | "homepage": "https://assetstore.unity.com/publishers/44558", 17 | "changelogUrl": "CHANGELOG.md", 18 | "documentationUrl": "Documentation.pdf", 19 | "author": { 20 | "name": "INeatFreak", 21 | "email": "freakwares@gmail.com", 22 | "url": "https://assetstore.unity.com/publishers/44558" 23 | } 24 | } -------------------------------------------------------------------------------- /package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0e8877fdce6d29646a11ee32afcc074f 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | --------------------------------------------------------------------------------