├── Images~ ├── 1.png └── 2.png ├── Editor ├── CodeHelper.cs.meta ├── BaseCodeCreator.cs.meta ├── CSCodeCreator.cs.meta ├── CodeBindRefresher.cs.meta ├── EditorSetting.cs.meta ├── MonoCodeCreator.cs.meta ├── CSCodeCreatorWindow.cs.meta ├── CodeBind.Editor.asmdef.meta ├── BaseBinder.cs.meta ├── BaseCodeBinder.cs.meta ├── CSCodeBinder.cs.meta ├── CodeBindData.cs.meta ├── MonoCodeBinder.cs.meta ├── ReferenceBinder.cs.meta ├── CSCodeBindMonoInspector.cs.meta ├── MonoCodeCreatorWindow.cs.meta ├── CodeBindNameTypeCollection.cs.meta ├── DefaultCodeBindNameTypeConfig.cs.meta ├── MonoCodeBindPropertyProcessor.cs.meta ├── ReferenceBindMonoInspector.cs.meta ├── CodeBind.Editor.asmdef ├── CodeBindData.cs ├── EditorSetting.cs ├── CSCodeCreator.cs ├── MonoCodeCreator.cs ├── ReferenceBinder.cs ├── DefaultCodeBindNameTypeConfig.cs ├── CSCodeBinder.cs ├── BaseCodeCreator.cs ├── BaseCodeBinder.cs ├── MonoCodeBindPropertyProcessor.cs ├── MonoCodeBinder.cs ├── CSCodeCreatorWindow.cs ├── MonoCodeCreatorWindow.cs ├── CodeBindRefresher.cs ├── CodeBindNameTypeCollection.cs ├── CSCodeBindMonoInspector.cs ├── ReferenceBindMonoInspector.cs ├── CodeHelper.cs └── BaseBinder.cs ├── Samples~ ├── Demo │ ├── TestCS.cs │ ├── TestPrefab.prefab.meta │ ├── CodeBindDemo.unity.meta │ ├── CodeBind.Demo.asmdef.meta │ ├── TestCS.cs.meta │ ├── TestCS.Bind.cs.meta │ ├── TestMono.cs.meta │ ├── TestMono.Bind.cs.meta │ ├── TestMono.cs │ ├── CodeBind.Demo.asmdef │ ├── TestPrefab.prefab │ ├── TestCS.Bind.cs │ ├── TestMono.Bind.cs │ └── CodeBindDemo.unity └── Demo.meta ├── LICENSE.meta ├── CHANGELOG.md.meta ├── README.md.meta ├── package.json.meta ├── Editor.meta ├── Runtime.meta ├── Runtime ├── CodeBind.asmdef.meta ├── ICSCodeBind.cs.meta ├── CSCodeBindMono.cs.meta ├── CSCodeBindPool.cs.meta ├── CodeBindAttribute.cs.meta ├── CodeBindExtension.cs.meta ├── ReferenceBindMono.cs.meta ├── CodeBindNameAttribute.cs.meta ├── MonoCodeBindAttribute.cs.meta ├── CodeBindNameTypeAttribute.cs.meta ├── ICSCodeBind.cs ├── CodeBindAttribute.cs ├── CodeBind.asmdef ├── CodeBindNameTypeAttribute.cs ├── MonoCodeBindAttribute.cs ├── CodeBindNameAttribute.cs ├── CSCodeBindPool.cs ├── CodeBindExtension.cs ├── CSCodeBindMono.cs └── ReferenceBindMono.cs ├── CHANGELOG.md ├── package.json ├── LICENSE └── README.md /Images~/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XuToWei/CodeBind/HEAD/Images~/1.png -------------------------------------------------------------------------------- /Images~/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XuToWei/CodeBind/HEAD/Images~/2.png -------------------------------------------------------------------------------- /Editor/CodeHelper.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e8064977319444e4a2a6c45c41172e3b 3 | timeCreated: 1742549616 -------------------------------------------------------------------------------- /Editor/BaseCodeCreator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: be5dcd2b0a974a449bbdc4b88f9e7b5e 3 | timeCreated: 1742548309 -------------------------------------------------------------------------------- /Editor/CSCodeCreator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8c3cb656fcb74ffd92287b5b2962e827 3 | timeCreated: 1742985807 -------------------------------------------------------------------------------- /Editor/CodeBindRefresher.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9508a458dc5440689cd03807374d1b80 3 | timeCreated: 1753682311 -------------------------------------------------------------------------------- /Editor/EditorSetting.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9f2be7c9dfeb4250aa9b157003a21712 3 | timeCreated: 1742985675 -------------------------------------------------------------------------------- /Editor/MonoCodeCreator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 46ba7010fca5450c8ba63da5f368919f 3 | timeCreated: 1742549508 -------------------------------------------------------------------------------- /Editor/CSCodeCreatorWindow.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 909e357d8f0a4a1db1a4056e62f86585 3 | timeCreated: 1742986131 -------------------------------------------------------------------------------- /Samples~/Demo/TestCS.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | public partial class TestCS 4 | { 5 | public void Test() 6 | { 7 | Debug.Log("Test!"); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /LICENSE.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a363a1d549b30b048812b27ce16759a8 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /CHANGELOG.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9cb73e3e0b9bcf5478c6300aecba4965 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e48a6ed75d06fe04298bee6903d98b65 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0a9df64e710650342bced296edbd0cf3 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 819e8939b1bfdaa4ea4eb4e04bbf3522 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a51c7b6e12cbc384a82bdbc4089d12bc 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/Demo/TestPrefab.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1bbd5ed9be130da43b3a37ae9bc5ff20 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Runtime/CodeBind.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bf5d445a0162ae24c8e1e74ec5ccb251 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Samples~/Demo.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a4e48ff819dc2334e9d4a58359d203af 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/Demo/CodeBindDemo.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3e52f6da93753dc40ac9e83f8aa33d81 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Editor/CodeBind.Editor.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 452fed5de53241648a63c1912ad987ee 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Samples~/Demo/CodeBind.Demo.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c422a76e038f2aa4aabf1c2c89a83a12 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Editor/BaseBinder.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c4aad3b58d2509543863b1d710e10245 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/BaseCodeBinder.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3d7e21a1c0a851143aee826207fb36be 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/CSCodeBinder.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f308c02ecb754ed40b41b08c321151bc 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/CodeBindData.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 147543332be13d24fae2bd91f2a6c14e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/MonoCodeBinder.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 56b94ba11f358c140bd320f8f9f5cb3f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/ICSCodeBind.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 986db3df5de9d89459c0cd1e8c52ca95 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Samples~/Demo/TestCS.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: af79efec0e6b8e44f8f95a0516e9784a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/ReferenceBinder.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ee5b280965fd5b0489af6cc09f8c2cd7 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/CSCodeBindMono.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5452a0c3619826c4f889a047605eef79 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/CSCodeBindPool.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 41051bc624f94f9448c306648e0cfd9d 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/CodeBindAttribute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d27d221b50e26c644a76f8877ce2e1d3 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/CodeBindExtension.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8317e1681a5a3ea4c9e890e955389661 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/ReferenceBindMono.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 804d393d1d453f5448cd493372e9a1a2 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Samples~/Demo/TestCS.Bind.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 14ea3557ea6c4e6489e804a514eb604e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Samples~/Demo/TestMono.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dcb4af7312c4dd1418dfa5e1d91f2c61 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/CSCodeBindMonoInspector.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4dddcd056b01480418d7a9a2557d4ac2 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/MonoCodeCreatorWindow.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 72b3b1f9da81fc14c96396a5621fef28 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/CodeBindNameAttribute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 58bc1c001217dc34ba379473880930ce 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/MonoCodeBindAttribute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1fe70df98957f0444a07a094df7b44d2 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Samples~/Demo/TestMono.Bind.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5d887706843d2454b88766949cb84bd5 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/CodeBindNameTypeCollection.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8d4a96391a2afc24e940f2d1db444d9e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/DefaultCodeBindNameTypeConfig.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6662eaec20b2b16458ddde2de0e8135d 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/MonoCodeBindPropertyProcessor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5656232a85fbad44498ee3a3f75cf563 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/ReferenceBindMonoInspector.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cd5c4246ac54fae47a1aee6d80a1876d 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/CodeBindNameTypeAttribute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b06ad4186364e9846b18926ae045df39 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/ICSCodeBind.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace CodeBind 4 | { 5 | /// 6 | /// 非Mono类绑定数据接口 7 | /// 8 | public interface ICSCodeBind 9 | { 10 | CSCodeBindMono Mono { get; } 11 | Transform Transform { get; } 12 | void InitBind(CSCodeBindMono csCodeBindMono); 13 | void ClearBind(); 14 | } 15 | } -------------------------------------------------------------------------------- /Runtime/CodeBindAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | 4 | namespace CodeBind 5 | { 6 | /// 7 | /// 绑定库识别,添加了支持嵌套,不会识别子物体 8 | /// 9 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] 10 | [Conditional("UNITY_EDITOR")] 11 | public class CodeBindAttribute : Attribute 12 | { 13 | } 14 | } -------------------------------------------------------------------------------- /Runtime/CodeBind.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "CodeBind", 3 | "rootNamespace": "CodeBind", 4 | "references": [], 5 | "includePlatforms": [], 6 | "excludePlatforms": [], 7 | "allowUnsafeCode": false, 8 | "overrideReferences": false, 9 | "precompiledReferences": [], 10 | "autoReferenced": true, 11 | "defineConstraints": [], 12 | "versionDefines": [], 13 | "noEngineReferences": false 14 | } -------------------------------------------------------------------------------- /Samples~/Demo/TestMono.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace CodeBind.Demo 4 | { 5 | [MonoCodeBind('_')] 6 | public partial class TestMono : MonoBehaviour 7 | { 8 | // Start is called before the first frame update 9 | void Start() 10 | { 11 | 12 | } 13 | 14 | // Update is called once per frame 15 | void Update() 16 | { 17 | 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Runtime/CodeBindNameTypeAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | 4 | namespace CodeBind 5 | { 6 | /// 7 | /// 用于添加绑定类型的名字组,方便引擎类型使用 8 | /// 必须给static的Dictionary使用 9 | /// string是绑定的节点识别名,Type是绑定的脚本类型 10 | /// 优先级高于CodeBindNameAttribute 11 | /// 12 | [Conditional("UNITY_EDITOR")] 13 | [AttributeUsage(AttributeTargets.Field)] 14 | public sealed class CodeBindNameTypeAttribute : Attribute 15 | { 16 | } 17 | } -------------------------------------------------------------------------------- /Samples~/Demo/CodeBind.Demo.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "CodeBind.Demo", 3 | "rootNamespace": "", 4 | "references": [ 5 | "CodeBind", 6 | "StateController" 7 | ], 8 | "includePlatforms": [], 9 | "excludePlatforms": [], 10 | "allowUnsafeCode": false, 11 | "overrideReferences": false, 12 | "precompiledReferences": [], 13 | "autoReferenced": true, 14 | "defineConstraints": [ 15 | "UNITY_EDITOR" 16 | ], 17 | "versionDefines": [], 18 | "noEngineReferences": false 19 | } -------------------------------------------------------------------------------- /Editor/CodeBind.Editor.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "CodeBind.Editor", 3 | "rootNamespace": "CodeBind.Editor", 4 | "references": [ 5 | "CodeBind", 6 | "StateController" 7 | ], 8 | "includePlatforms": [ 9 | "Editor" 10 | ], 11 | "excludePlatforms": [], 12 | "allowUnsafeCode": false, 13 | "overrideReferences": false, 14 | "precompiledReferences": [], 15 | "autoReferenced": true, 16 | "defineConstraints": [], 17 | "versionDefines": [], 18 | "noEngineReferences": false 19 | } -------------------------------------------------------------------------------- /Runtime/MonoCodeBindAttribute.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | 3 | namespace CodeBind 4 | { 5 | [Conditional("UNITY_EDITOR")] 6 | public sealed class MonoCodeBindAttribute : CodeBindAttribute 7 | { 8 | public readonly char SeparatorChar; 9 | 10 | public MonoCodeBindAttribute(char separatorChar) 11 | { 12 | SeparatorChar = separatorChar; 13 | } 14 | 15 | public MonoCodeBindAttribute() 16 | { 17 | SeparatorChar = '_'; 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## [1.0.6] - 2024-5-28 4 | - ReferenceBindMono添加自动数据绑定 5 | 6 | ## [1.0.5] - 2024-3-15 7 | - 添加STATE_CONTROLLER_CODE_BNIND可以支持StateController数据代码生成 8 | - 优化类型收集调用实际,降低ReloadDomain耗时 9 | 10 | ## [1.0.4] - 2024-3-13 11 | - 支持继承的名称准确识别 12 | 13 | ## [1.0.3] - 2024-3-9 14 | - fix the problem of nested judgment error 15 | 16 | ## [1.0.2] - 2024-1-26 17 | - change name style 18 | 19 | ## [1.0.1] - 2024-1-20 20 | - support bind gameObject 21 | - fix binding partially duplicated components, the name may be modified. 22 | - add bind editor group view. 23 | 24 | ## [1.0.0] - 2023-10-18 -------------------------------------------------------------------------------- /Runtime/CodeBindNameAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | 4 | namespace CodeBind 5 | { 6 | /// 7 | /// 用于添加绑定类型的名字,方便自定义类型使用 8 | /// 直接加在需要绑定的类上即可 9 | /// 10 | [Conditional("UNITY_EDITOR")] 11 | [AttributeUsage(AttributeTargets.Class)] 12 | public sealed class CodeBindNameAttribute : Attribute 13 | { 14 | public string BindName 15 | { 16 | get; 17 | } 18 | 19 | /// 20 | /// 绑定特性的构造函数 21 | /// 22 | /// 绑定的节点识别名 23 | public CodeBindNameAttribute(string bindName) 24 | { 25 | BindName = bindName; 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "me.xw.codebind", 3 | "version": "1.0.6", 4 | "displayName": "CodeBind", 5 | "description": "better CodeBind", 6 | "repository": { 7 | "type": "git", 8 | "url": "https://github.com/XuToWei/CodeBind.git" 9 | }, 10 | "unity": "2019.4", 11 | "documentationUrl": "https://github.com/XuToWei/CodeBind/blob/master/README.md", 12 | "licensesUrl": "https://github.com/XuToWei/CodeBind/blob/master/LICENSE.md", 13 | "dependencies": { 14 | }, 15 | "keywords": [ 16 | ], 17 | "author": { 18 | "name": "Xu Wei", 19 | "email": "", 20 | "url": "" 21 | }, 22 | "samples": [ 23 | { 24 | "displayName": "Demo", 25 | "description": "Contains CodeBind demo", 26 | "path": "Samples~/Demo" 27 | } 28 | ] 29 | } 30 | -------------------------------------------------------------------------------- /Samples~/Demo/TestPrefab.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &1163687246830712436 4 | GameObject: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | serializedVersion: 6 10 | m_Component: 11 | - component: {fileID: 4658126080938021571} 12 | m_Layer: 0 13 | m_Name: TestPrefab 14 | m_TagString: Untagged 15 | m_Icon: {fileID: 0} 16 | m_NavMeshLayer: 0 17 | m_StaticEditorFlags: 0 18 | m_IsActive: 1 19 | --- !u!4 &4658126080938021571 20 | Transform: 21 | m_ObjectHideFlags: 0 22 | m_CorrespondingSourceObject: {fileID: 0} 23 | m_PrefabInstance: {fileID: 0} 24 | m_PrefabAsset: {fileID: 0} 25 | m_GameObject: {fileID: 1163687246830712436} 26 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 27 | m_LocalPosition: {x: 0, y: 0, z: 0} 28 | m_LocalScale: {x: 1, y: 1, z: 1} 29 | m_ConstrainProportionsScale: 0 30 | m_Children: [] 31 | m_Father: {fileID: 0} 32 | m_RootOrder: 0 33 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 34 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Xu Wei 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 | -------------------------------------------------------------------------------- /Editor/CodeBindData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace CodeBind.Editor 5 | { 6 | internal sealed class CodeBindData : IComparable 7 | { 8 | public string BindName 9 | { 10 | get; 11 | } 12 | 13 | public Type BindType 14 | { 15 | get; 16 | } 17 | 18 | public string BindPrefix 19 | { 20 | get; 21 | } 22 | 23 | public Transform BindTransform 24 | { 25 | get; 26 | } 27 | 28 | public CodeBindData(string bindName, Type bindType, string bindPrefix, Transform bindTransform) 29 | { 30 | BindName = bindName; 31 | BindType = bindType; 32 | BindPrefix = bindPrefix; 33 | BindTransform = bindTransform; 34 | } 35 | 36 | public int CompareTo(CodeBindData other) 37 | { 38 | int compare = String.CompareOrdinal(BindName, other.BindName); 39 | if (compare != 0) 40 | { 41 | return compare; 42 | } 43 | return String.CompareOrdinal(BindPrefix, other.BindPrefix); 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /Editor/EditorSetting.cs: -------------------------------------------------------------------------------- 1 | using UnityEditor; 2 | 3 | namespace CodeBind.Editor 4 | { 5 | internal static class EditorSetting 6 | { 7 | internal static string GetSaveCodePath() 8 | { 9 | return EditorPrefs.GetString("CodeBind.CodePath", "Assets/"); 10 | } 11 | 12 | internal static void SetSaveCodePath(string path) 13 | { 14 | EditorPrefs.SetString("CodeBind.CodePath", path); 15 | } 16 | 17 | internal static string GetSaveCodeNamespace() 18 | { 19 | return EditorPrefs.GetString("CodeBind.CodeNamespace", string.Empty); 20 | } 21 | 22 | internal static void SetSaveCodeNamespace(string codeNamespace) 23 | { 24 | EditorPrefs.SetString("CodeBind.CodeNamespace", codeNamespace); 25 | } 26 | 27 | internal static char GetSaveSeparatorChar() 28 | { 29 | return EditorPrefs.GetString("CodeBind.SeparatorChar", "_")[0]; 30 | } 31 | 32 | internal static void SetSaveSeparatorChar(char separatorChar) 33 | { 34 | EditorPrefs.SetString("CodeBind.SeparatorChar", separatorChar.ToString()); 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /Editor/CSCodeCreator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace CodeBind.Editor 5 | { 6 | /// 7 | /// 非Mono类的绑定代码生成器 8 | /// 9 | internal sealed class CSCodeCreator : BaseCodeCreator 10 | { 11 | public CSCodeCreator(string codePath, string codeName, string codeNamespace, Transform rootTransform, char separatorChar) : base(codePath, codeName, codeNamespace, rootTransform, separatorChar) 12 | { 13 | } 14 | 15 | protected override void SetSerialization() 16 | { 17 | throw new Exception("CSCodeCreator does not support serialization!"); 18 | } 19 | 20 | protected override string GetBindCode() 21 | { 22 | return CodeHelper.GetCSBindCodeString(m_ScriptNameSpace, m_ScriptClassName, m_BindDatas, m_BindArrayDataDict, m_BindArrayDatas); 23 | } 24 | 25 | protected override string GetClassCode() 26 | { 27 | if (!string.IsNullOrEmpty(m_ScriptNameSpace)) 28 | { 29 | return $@"namespace {m_ScriptNameSpace} 30 | {{ 31 | public partial class {m_ScriptClassName} 32 | {{ 33 | 34 | }} 35 | }}"; 36 | } 37 | else 38 | { 39 | return $@"public partial class {m_ScriptClassName} 40 | {{ 41 | 42 | }}"; 43 | } 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /Samples~/Demo/TestCS.Bind.cs: -------------------------------------------------------------------------------- 1 | // This is automatically generated by CodeBind. Please do not modify it. 2 | 3 | public partial class TestCS : CodeBind.ICSCodeBind 4 | { 5 | public CodeBind.CSCodeBindMono Mono { get; private set; } 6 | public UnityEngine.Transform Transform { get; private set; } 7 | 8 | public UnityEngine.Transform SelfTransform { get; private set; } 9 | public UnityEngine.Animation OtherAnimation { get; private set; } 10 | 11 | public UnityEngine.Animation[] ListAnimationArray { get; private set; } 12 | 13 | public void InitBind(CodeBind.CSCodeBindMono mono) 14 | { 15 | Mono = mono; 16 | Transform = mono.transform; 17 | SelfTransform = Mono.BindComponents[0] as UnityEngine.Transform; 18 | OtherAnimation = Mono.BindComponents[1] as UnityEngine.Animation; 19 | ListAnimationArray = new UnityEngine.Animation[4] 20 | { 21 | Mono.BindComponents[2] as UnityEngine.Animation, 22 | Mono.BindComponents[3] as UnityEngine.Animation, 23 | Mono.BindComponents[4] as UnityEngine.Animation, 24 | Mono.BindComponents[5] as UnityEngine.Animation, 25 | }; 26 | } 27 | 28 | public void ClearBind() 29 | { 30 | Mono = null; 31 | Transform = null; 32 | SelfTransform = null; 33 | OtherAnimation = null; 34 | ListAnimationArray = null; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Editor/MonoCodeCreator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace CodeBind.Editor 5 | { 6 | /// 7 | /// Mono类的绑定代码的生成器 8 | /// 9 | internal sealed class MonoCodeCreator : BaseCodeCreator 10 | { 11 | public MonoCodeCreator(string codePath, string codeName, string codeNamespace, Transform rootTransform, char separatorChar) : base(codePath, codeName, codeNamespace, rootTransform, separatorChar) 12 | { 13 | 14 | } 15 | 16 | protected override void SetSerialization() 17 | { 18 | throw new Exception("MonoCodeCreator does not support serialization!"); 19 | } 20 | 21 | protected override string GetBindCode() 22 | { 23 | return CodeHelper.GetMonoBindCodeString(m_ScriptNameSpace, m_ScriptClassName, m_BindDatas, m_BindArrayDataDict); 24 | } 25 | 26 | protected override string GetClassCode() 27 | { 28 | if (!string.IsNullOrEmpty(m_ScriptNameSpace)) 29 | { 30 | return $@"using UnityEngine; 31 | using CodeBind; 32 | 33 | namespace {m_ScriptNameSpace} 34 | {{ 35 | [MonoCodeBind('{m_SeparatorChar}')] 36 | public partial class {m_ScriptClassName} : MonoBehaviour 37 | {{ 38 | 39 | }} 40 | }}"; 41 | } 42 | else 43 | { 44 | return $@"using UnityEngine; 45 | using CodeBind; 46 | 47 | [MonoCodeBind('{m_SeparatorChar}')] 48 | public partial class {m_ScriptClassName} : MonoBehaviour 49 | {{ 50 | 51 | }}"; 52 | } 53 | } 54 | } 55 | } -------------------------------------------------------------------------------- /Runtime/CSCodeBindPool.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace CodeBind 5 | { 6 | /// 7 | /// 非Mono类绑定对象的缓存池 8 | /// 9 | internal sealed class CSCodeBindPool 10 | { 11 | private const int MaxCount = 128; 12 | 13 | private readonly Dictionary> m_Pool = new Dictionary>(); 14 | 15 | internal T Fetch(CSCodeBindMono mono) where T : class, ICSCodeBind, new() 16 | { 17 | T obj; 18 | if (!m_Pool.TryGetValue(typeof(T), out var queue)) 19 | { 20 | obj = Activator.CreateInstance(); 21 | } 22 | else 23 | { 24 | if (queue.Count == 0) 25 | { 26 | obj = Activator.CreateInstance(); 27 | } 28 | else 29 | { 30 | obj = (T)queue.Dequeue(); 31 | } 32 | } 33 | obj.InitBind(mono); 34 | return obj; 35 | } 36 | 37 | internal void Recycle(ICSCodeBind obj) 38 | { 39 | obj.ClearBind(); 40 | Type type = obj.GetType(); 41 | if (!m_Pool.TryGetValue(type, out var queue)) 42 | { 43 | queue = new Queue(); 44 | m_Pool.Add(type, queue); 45 | } 46 | 47 | if (queue.Count > MaxCount) 48 | { 49 | return; 50 | } 51 | 52 | queue.Enqueue(obj); 53 | } 54 | } 55 | } -------------------------------------------------------------------------------- /Editor/ReferenceBinder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace CodeBind.Editor 5 | { 6 | /// 7 | /// 引用绑定器 8 | /// 9 | internal sealed class ReferenceBinder : BaseBinder 10 | { 11 | private readonly ReferenceBindMono m_ReferenceBindMono; 12 | 13 | public ReferenceBinder(ReferenceBindMono referenceBindMono, char separatorChar) : base(referenceBindMono.transform, separatorChar) 14 | { 15 | m_ReferenceBindMono = referenceBindMono; 16 | } 17 | 18 | protected override void SetSerialization() 19 | { 20 | List bindNames = new List(); 21 | List bindComponents = new List(); 22 | foreach (CodeBindData bindData in m_BindDatas) 23 | { 24 | bindNames.Add(bindData.BindName + bindData.BindPrefix); 25 | if(!TryGetBindTarget(bindData.BindTransform, bindData.BindType, out var target)) 26 | { 27 | throw new Exception($"Bind '{bindData.BindTransform} - {bindData.BindType}' fail!"); 28 | } 29 | bindComponents.Add(target); 30 | } 31 | foreach (CodeBindData bindData in m_BindArrayDatas) 32 | { 33 | bindNames.Add($"{bindData.BindName}{bindData.BindPrefix}Array"); 34 | if(!TryGetBindTarget(bindData.BindTransform, bindData.BindType, out var target)) 35 | { 36 | throw new Exception($"Bind '{bindData.BindTransform} - {bindData.BindType}' fail!"); 37 | } 38 | bindComponents.Add(target); 39 | } 40 | m_ReferenceBindMono.SetAutoBindComponents(bindNames.ToArray(), bindComponents.ToArray()); 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /Runtime/CodeBindExtension.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace CodeBind 4 | { 5 | public static class CodeBindExtension 6 | { 7 | /// 8 | /// 获取绑定代码对象(自带缓存) 9 | /// 10 | /// 11 | /// 12 | /// 13 | public static T GetCSCodeBindObject(this Transform self) where T : class, ICSCodeBind, new() 14 | { 15 | CSCodeBindMono codeBindMono = self.GetComponent(); 16 | if (codeBindMono == null) 17 | { 18 | return null; 19 | } 20 | return codeBindMono.GetCSCodeBindObject(); 21 | } 22 | 23 | /// 24 | /// 获取绑定代码对象(自带缓存) 25 | /// 26 | /// 27 | /// 28 | /// 29 | public static T GetCSCodeBindObject(this GameObject self) where T : class, ICSCodeBind, new() 30 | { 31 | CSCodeBindMono codeBindMono = self.GetComponent(); 32 | if (codeBindMono == null) 33 | { 34 | return null; 35 | } 36 | return codeBindMono.GetCSCodeBindObject(); 37 | } 38 | 39 | /// 40 | /// 初始化绑定代码(非缓存池) 41 | /// 42 | /// 43 | /// 44 | public static void InitBind(this ICSCodeBind self, GameObject gameObject) 45 | { 46 | self.InitBind(gameObject.GetComponent()); 47 | } 48 | 49 | /// 50 | /// 初始化绑定代码(非缓存池) 51 | /// 52 | /// 53 | /// 54 | public static void InitBind(this ICSCodeBind self, Transform transform) 55 | { 56 | self.InitBind(transform.GetComponent()); 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /Editor/DefaultCodeBindNameTypeConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace CodeBind 5 | { 6 | /// 7 | /// 缺省绑定类型名称配置,会被CodeBindNameTypeAttribute的配置覆盖 8 | /// 9 | internal static class DefaultCodeBindNameTypeConfig 10 | { 11 | internal static readonly Dictionary BindNameTypeDict = new Dictionary() 12 | { 13 | { "Animation", typeof (UnityEngine.Animation) }, 14 | { "Animator", typeof (UnityEngine.Animator) }, 15 | { "Button", typeof (UnityEngine.UI.Button) }, 16 | { "Canvas", typeof (UnityEngine.Canvas) }, 17 | { "CanvasGroup", typeof (UnityEngine.CanvasGroup) }, 18 | { "Dropdown", typeof (UnityEngine.UI.Dropdown) }, 19 | { "GameObject", typeof (UnityEngine.GameObject) }, 20 | { "GridLayoutGroup", typeof (UnityEngine.UI.GridLayoutGroup) }, 21 | { "HorizontalLayoutGroup", typeof (UnityEngine.UI.HorizontalLayoutGroup) }, 22 | { "Image", typeof (UnityEngine.UI.Image) }, 23 | { "InputField", typeof (UnityEngine.UI.InputField) }, 24 | { "Mask", typeof (UnityEngine.UI.Mask) }, 25 | { "RawImage", typeof (UnityEngine.UI.RawImage) }, 26 | { "RectMask2D", typeof (UnityEngine.UI.RectMask2D) }, 27 | { "RectTransform", typeof (UnityEngine.RectTransform) }, 28 | { "Scrollbar", typeof (UnityEngine.UI.Scrollbar) }, 29 | { "ScrollRect", typeof (UnityEngine.UI.ScrollRect) }, 30 | { "Slider", typeof (UnityEngine.UI.Slider) }, 31 | { "SpriteRenderer", typeof (UnityEngine.SpriteRenderer) }, 32 | { "Text", typeof (UnityEngine.UI.Text) }, 33 | { "Transform", typeof (UnityEngine.Transform) }, 34 | { "Toggle", typeof (UnityEngine.UI.Toggle) }, 35 | { "ToggleGroup", typeof (UnityEngine.UI.ToggleGroup) }, 36 | { "VerticalLayoutGroup", typeof (UnityEngine.UI.VerticalLayoutGroup) }, 37 | #if STATE_CONTROLLER_CODE_BIND 38 | { "StateControllerMono", typeof(StateController.StateControllerMono)}, 39 | #endif 40 | }; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Editor/CSCodeBinder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using UnityEditor; 4 | using UnityEngine; 5 | 6 | namespace CodeBind.Editor 7 | { 8 | internal sealed class CSCodeBinder : BaseCodeBinder 9 | { 10 | private readonly CSCodeBindMono m_CsCodeBindMono; 11 | 12 | public CSCodeBinder(MonoScript script, Transform rootTransform, char separatorChar): base(script, rootTransform, separatorChar) 13 | { 14 | m_CsCodeBindMono = rootTransform.GetComponent(); 15 | if (m_CsCodeBindMono == null) 16 | { 17 | throw new Exception($"PureCSCodeBinder init fail! {rootTransform} has no CSCodeBindMono!"); 18 | } 19 | } 20 | 21 | protected override string GetGeneratedCode() 22 | { 23 | return CodeHelper.GetCSBindCodeString(m_ScriptNameSpace, m_ScriptClassName, m_BindDatas, m_BindArrayDataDict, m_BindArrayDatas); 24 | } 25 | 26 | protected override void SetSerialization() 27 | { 28 | List bindNames = new List(); 29 | List bindComponents = new List(); 30 | foreach (CodeBindData bindData in m_BindDatas) 31 | { 32 | bindNames.Add(bindData.BindName + bindData.BindPrefix); 33 | if(!TryGetBindTarget(bindData.BindTransform, bindData.BindType, out var target)) 34 | { 35 | throw new Exception($"Bind '{bindData.BindTransform} - {bindData.BindType}' fail!"); 36 | } 37 | bindComponents.Add(target); 38 | } 39 | foreach (CodeBindData bindData in m_BindArrayDatas) 40 | { 41 | bindNames.Add($"{bindData.BindName}{bindData.BindPrefix}Array"); 42 | if(!TryGetBindTarget(bindData.BindTransform, bindData.BindType, out var target)) 43 | { 44 | throw new Exception($"Bind '{bindData.BindTransform} - {bindData.BindType}' fail!"); 45 | } 46 | bindComponents.Add(target); 47 | } 48 | m_CsCodeBindMono.SetBindComponents(bindNames.ToArray(), bindComponents.ToArray()); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Editor/BaseCodeCreator.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using UnityEditor; 3 | using UnityEngine; 4 | 5 | namespace CodeBind.Editor 6 | { 7 | /// 8 | /// 基础代码创建器 9 | /// 10 | internal abstract class BaseCodeCreator : BaseBinder 11 | { 12 | private readonly string m_ScriptFullPath; 13 | private readonly string m_BindScriptFullPath; 14 | protected readonly string m_ScriptNameSpace; 15 | protected readonly string m_ScriptClassName; 16 | 17 | protected BaseCodeCreator(string codePath, string codeName, string codeNamespace, Transform rootTransform, char separatorChar) : base(rootTransform, separatorChar) 18 | { 19 | m_ScriptFullPath = Path.Combine(codePath, $"{codeName}.cs"); 20 | m_BindScriptFullPath = Path.Combine(codePath, $"{codeName}.Bind.cs"); 21 | m_ScriptNameSpace = codeNamespace; 22 | m_ScriptClassName = codeName; 23 | } 24 | 25 | public void TryCreateCodeFile() 26 | { 27 | if (File.Exists(m_ScriptFullPath)) 28 | { 29 | Debug.Log("文件已存在,不能重复生成。"); 30 | return; 31 | } 32 | if (File.Exists(m_BindScriptFullPath)) 33 | { 34 | File.Delete(m_BindScriptFullPath); 35 | } 36 | CodeBindNameTypeCollection.Do(); 37 | AutoFixChildBindName(); 38 | if (!TryGenerateNameMapTypeData()) 39 | { 40 | return; 41 | } 42 | string codeClassStr = GetClassCode().Replace("\t", " "); 43 | using StreamWriter classSw = new StreamWriter(m_ScriptFullPath); 44 | classSw.Write(codeClassStr); 45 | classSw.Close(); 46 | 47 | string codeBindStr = GetBindCode().Replace("\t", " "); 48 | using StreamWriter bindSw = new StreamWriter(m_BindScriptFullPath); 49 | bindSw.Write(codeBindStr); 50 | bindSw.Close(); 51 | AssetDatabase.ImportAsset(m_BindScriptFullPath); 52 | AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate); 53 | Debug.Log($"代码生成成功,生成路径: {m_ScriptFullPath}"); 54 | } 55 | 56 | protected abstract string GetBindCode(); 57 | protected abstract string GetClassCode(); 58 | } 59 | } -------------------------------------------------------------------------------- /Editor/BaseCodeBinder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using UnityEditor; 4 | using UnityEngine; 5 | 6 | namespace CodeBind.Editor 7 | { 8 | /// 9 | /// 基础代码绑定器 10 | /// 11 | internal abstract class BaseCodeBinder : BaseBinder 12 | { 13 | protected readonly string m_BindScriptFullPath; 14 | 15 | protected readonly string m_ScriptNameSpace; 16 | 17 | protected readonly string m_ScriptClassName; 18 | 19 | protected BaseCodeBinder(MonoScript script, Transform rootTransform, char separatorChar) : base(rootTransform, separatorChar) 20 | { 21 | if (script == null) 22 | { 23 | throw new Exception("请设置需要绑定的脚本!"); 24 | } 25 | if (script.name.EndsWith(".Bind")) 26 | { 27 | throw new Exception("不可以绑定“.Bind”结尾的脚本!"); 28 | } 29 | if (!script.text.Contains("partial")) 30 | { 31 | throw new Exception($"please add key word 'partial' into {script.GetClass().FullName}!"); 32 | } 33 | 34 | string scriptFullPath = AssetDatabase.GetAssetPath(script); 35 | m_BindScriptFullPath = scriptFullPath.Insert(scriptFullPath.LastIndexOf('.'), ".Bind"); 36 | m_ScriptNameSpace = script.GetClass().Namespace; 37 | m_ScriptClassName = script.GetClass().Name; 38 | } 39 | 40 | public void TryGenerateBindCode() 41 | { 42 | CodeBindNameTypeCollection.Do(); 43 | AutoFixChildBindName(); 44 | if (!TryGenerateNameMapTypeData()) 45 | { 46 | return; 47 | } 48 | string codeStr = GetGeneratedCode().Replace("\t", " "); 49 | if (File.Exists(m_BindScriptFullPath) && string.Equals(codeStr, File.ReadAllText(m_BindScriptFullPath))) 50 | { 51 | Debug.Log("文件内容相同,不需要重新生成。"); 52 | return; 53 | } 54 | using StreamWriter sw = new StreamWriter(m_BindScriptFullPath); 55 | sw.Write(codeStr); 56 | sw.Close(); 57 | AssetDatabase.ImportAsset(m_BindScriptFullPath); 58 | AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate); 59 | Debug.Log($"代码生成成功,生成路径: {m_BindScriptFullPath}"); 60 | } 61 | 62 | protected abstract string GetGeneratedCode(); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /Editor/MonoCodeBindPropertyProcessor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Sirenix.OdinInspector; 4 | using Sirenix.OdinInspector.Editor; 5 | using UnityEditor; 6 | using UnityEngine; 7 | 8 | namespace CodeBind.Editor 9 | { 10 | internal sealed class MonoCodeBindPropertyProcessor : OdinPropertyProcessor 11 | { 12 | public override void ProcessMemberProperties(List propertyInfos) 13 | { 14 | MonoCodeBindAttribute attribute = Property.GetAttribute(); 15 | 16 | propertyInfos.AddDelegate("Code Binder", (Action) (() => { }), -100000f, new Attribute[2] 17 | { 18 | (Attribute) new InfoBoxAttribute($"Separator Char:{attribute.SeparatorChar}"), 19 | (Attribute) new OnInspectorGUIAttribute("@") 20 | }); 21 | 22 | propertyInfos.AddDelegate("Generate Bind Code", TryGenerateBindCode, -100000f); 23 | propertyInfos.AddDelegate("Generate Serialization", TrySetSerialization, -100000f); 24 | } 25 | 26 | private void TryGenerateBindCode() 27 | { 28 | foreach (T t in ValueEntry.Values) 29 | { 30 | MonoCodeBindAttribute attribute = Property.GetAttribute(); 31 | MonoBehaviour mono = t as MonoBehaviour; 32 | if (mono == null) 33 | { 34 | throw new Exception($"{t.GetType()} is not inherit from MonoBehaviour!"); 35 | } 36 | MonoScript script = MonoScript.FromMonoBehaviour(mono); 37 | MonoCodeBinder codeBinder = new MonoCodeBinder(script, mono.transform, attribute.SeparatorChar); 38 | codeBinder.TryGenerateBindCode(); 39 | } 40 | } 41 | 42 | private void TrySetSerialization() 43 | { 44 | foreach (T t in ValueEntry.Values) 45 | { 46 | MonoCodeBindAttribute attribute = Property.GetAttribute(); 47 | MonoBehaviour mono = t as MonoBehaviour; 48 | if (mono == null) 49 | { 50 | throw new Exception($"{t.GetType()} is not inherit from MonoBehaviour!"); 51 | } 52 | MonoScript script = MonoScript.FromMonoBehaviour(mono); 53 | MonoCodeBinder codeBinder = new MonoCodeBinder(script, mono.transform, attribute.SeparatorChar); 54 | codeBinder.TrySetSerialization(); 55 | } 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Editor/MonoCodeBinder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Reflection; 4 | using UnityEditor; 5 | using UnityEngine; 6 | 7 | namespace CodeBind.Editor 8 | { 9 | internal sealed class MonoCodeBinder : BaseCodeBinder 10 | { 11 | private readonly MonoBehaviour m_MonoObj; 12 | 13 | public MonoCodeBinder(MonoScript script, Transform rootTransform, char separatorChar): base(script, rootTransform, separatorChar) 14 | { 15 | m_MonoObj = rootTransform.GetComponent(script.GetClass()) as MonoBehaviour; 16 | if (m_MonoObj == null) 17 | { 18 | throw new Exception("MonoCodeBinder only can be used of MonoBehaviour!"); 19 | } 20 | } 21 | 22 | protected override string GetGeneratedCode() 23 | { 24 | return CodeHelper.GetMonoBindCodeString(m_ScriptNameSpace, m_ScriptClassName, m_BindDatas, m_BindArrayDataDict); 25 | } 26 | 27 | protected override void SetSerialization() 28 | { 29 | if(EditorApplication.isCompiling) 30 | { 31 | throw new Exception("Unity正在编译,无法进行绑定数据生成,请稍后再试。"); 32 | } 33 | if (EditorApplication.isUpdating) 34 | { 35 | throw new Exception("Unity正在更新,无法进行绑定数据生成,请稍后再试。"); 36 | } 37 | if (EditorUtility.scriptCompilationFailed) 38 | { 39 | throw new Exception("Unity脚本编译失败,无法进行绑定数据生成,请修复脚本错误后再试。"); 40 | } 41 | Type monoType = m_MonoObj.GetType(); 42 | foreach (CodeBindData bindData in m_BindDatas) 43 | { 44 | FieldInfo fieldInfo = monoType.GetField($"m_{bindData.BindName}{bindData.BindPrefix}", BindingFlags.NonPublic | BindingFlags.Instance); 45 | if(!TryGetBindTarget(bindData.BindTransform, bindData.BindType, out var target)) 46 | { 47 | throw new Exception($"Bind '{bindData.BindTransform} - {bindData.BindType}' fail!"); 48 | } 49 | fieldInfo.SetValue(m_MonoObj, target); 50 | } 51 | 52 | foreach (KeyValuePair> kv in m_BindArrayDataDict) 53 | { 54 | List components = new List(); 55 | foreach (CodeBindData bindData in kv.Value) 56 | { 57 | if(!TryGetBindTarget(bindData.BindTransform, bindData.BindType, out var target)) 58 | { 59 | throw new Exception($"Bind '{bindData.BindTransform} - {bindData.BindType}' fail!"); 60 | } 61 | components.Add(target); 62 | } 63 | FieldInfo fieldInfo = monoType.GetField($"m_{kv.Key}Array", BindingFlags.NonPublic | BindingFlags.Instance); 64 | Type type = fieldInfo.FieldType.GetElementType(); 65 | Array filledArray = Array.CreateInstance(type, kv.Value.Count); 66 | Array.Copy(components.ToArray(), filledArray, kv.Value.Count); 67 | fieldInfo.SetValue(m_MonoObj, filledArray); 68 | } 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Editor/CSCodeCreatorWindow.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Reflection; 3 | using UnityEditor; 4 | using UnityEngine; 5 | 6 | namespace CodeBind.Editor 7 | { 8 | /// 9 | /// 非Mono类绑定代码创建窗口 10 | /// 11 | internal class CSCodeCreatorWindow : EditorWindow 12 | { 13 | private string m_CodePath; 14 | private string m_CodeName; 15 | private string m_CodeNamespace; 16 | private CSCodeBindMono m_CSCodeBindMono; 17 | 18 | [MenuItem("GameObject/CodeBind/CS Code Creator", priority = -3)] 19 | internal static void ShowWindow() 20 | { 21 | GetWindow("CSCodeCreatorWindow"); 22 | } 23 | 24 | private void OnEnable() 25 | { 26 | m_CodePath = EditorSetting.GetSaveCodePath(); 27 | m_CodeNamespace = EditorSetting.GetSaveCodeNamespace(); 28 | } 29 | 30 | private void OnGUI() 31 | { 32 | EditorGUILayout.BeginHorizontal(); 33 | 34 | m_CodePath = EditorGUILayout.TextField("Code Path", m_CodePath); 35 | 36 | if (GUILayout.Button("Select Code Path", GUILayout.MaxWidth(150))) 37 | { 38 | string path = EditorUtility.OpenFolderPanel("Select Code Path", m_CodePath, ""); 39 | if (!string.IsNullOrEmpty(path)) 40 | { 41 | m_CodePath = path.Replace(Application.dataPath, "Assets"); 42 | } 43 | } 44 | 45 | EditorGUILayout.EndHorizontal(); 46 | 47 | if(m_CSCodeBindMono == null) 48 | { 49 | GameObject selectedObject = Selection.activeGameObject; 50 | if (selectedObject != null) 51 | { 52 | m_CSCodeBindMono = selectedObject.GetComponent(); 53 | if (m_CSCodeBindMono != null) 54 | { 55 | m_CodeName = m_CSCodeBindMono.name.Replace("_", "").Replace(".", "").Replace(" ", ""); 56 | } 57 | } 58 | } 59 | m_CodeNamespace = EditorGUILayout.TextField("Code Namespace", m_CodeNamespace); 60 | m_CodeName = EditorGUILayout.TextField("Code Name", m_CodeName); 61 | m_CSCodeBindMono = (CSCodeBindMono)EditorGUILayout.ObjectField("Selected Object", m_CSCodeBindMono, typeof(CSCodeBindMono), true); 62 | // 如果文件名和目录名为空,则创建文件的按钮不可用 63 | EditorGUI.BeginDisabledGroup(string.IsNullOrEmpty(m_CodePath) || string.IsNullOrEmpty(m_CodeName) || m_CSCodeBindMono == null || !Directory.Exists(m_CodePath)); 64 | { 65 | if (GUILayout.Button("Create Code File")) 66 | { 67 | CreateCodeFileAndAdd(); 68 | EditorSetting.SetSaveCodePath(m_CodePath); 69 | EditorSetting.SetSaveCodeNamespace(m_CodeNamespace); 70 | Close(); 71 | } 72 | } 73 | EditorGUI.EndDisabledGroup(); 74 | } 75 | 76 | private void CreateCodeFileAndAdd() 77 | { 78 | CSCodeCreator codeCreator = new CSCodeCreator(m_CodePath, m_CodeName, m_CodeNamespace, m_CSCodeBindMono.transform, m_CSCodeBindMono.SeparatorChar); 79 | codeCreator.TryCreateCodeFile(); 80 | MonoScript script = AssetDatabase.LoadAssetAtPath(Path.Combine(m_CodePath, $"{m_CodeName}.cs")) ; 81 | FieldInfo bindScriptFieldInfo = m_CSCodeBindMono.GetType().GetField("m_BindScript", BindingFlags.NonPublic | BindingFlags.Instance); 82 | bindScriptFieldInfo.SetValue(m_CSCodeBindMono, script); 83 | } 84 | } 85 | } -------------------------------------------------------------------------------- /Editor/MonoCodeCreatorWindow.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Reflection; 3 | using UnityEditor; 4 | using UnityEditorInternal; 5 | using UnityEngine; 6 | 7 | namespace CodeBind.Editor 8 | { 9 | /// 10 | /// Mono类绑定代码生成器窗口 11 | /// 12 | internal class MonoCodeCreatorWindow : EditorWindow 13 | { 14 | private string m_CodePath; 15 | private string m_CodeName; 16 | private string m_CodeNamespace; 17 | private GameObject m_SelectedObject; 18 | private char m_SeparatorChar; 19 | 20 | private MethodInfo m_AddComponentMethod; 21 | 22 | [MenuItem("GameObject/CodeBind/Mono Code Creator", priority = -4)] 23 | private static void ShowWindow() 24 | { 25 | GetWindow("MonoCodeCreatorWindow"); 26 | } 27 | 28 | private void OnEnable() 29 | { 30 | m_CodePath = EditorSetting.GetSaveCodePath(); 31 | m_CodeNamespace = EditorSetting.GetSaveCodeNamespace(); 32 | m_SeparatorChar = EditorSetting.GetSaveSeparatorChar(); 33 | if(m_AddComponentMethod == null) 34 | { 35 | m_AddComponentMethod = typeof(InternalEditorUtility).GetMethod("AddScriptComponentUncheckedUndoable", BindingFlags.Static | BindingFlags.NonPublic); 36 | } 37 | } 38 | 39 | private void OnGUI() 40 | { 41 | EditorGUILayout.BeginHorizontal(); 42 | 43 | m_CodePath = EditorGUILayout.TextField("Code Path", m_CodePath); 44 | 45 | if (GUILayout.Button("Select Code Path", GUILayout.MaxWidth(150))) 46 | { 47 | string path = EditorUtility.OpenFolderPanel("Select Code Path", m_CodePath, ""); 48 | if (!string.IsNullOrEmpty(path)) 49 | { 50 | m_CodePath = path.Replace(Application.dataPath, "Assets"); 51 | } 52 | } 53 | 54 | EditorGUILayout.EndHorizontal(); 55 | 56 | if(m_SelectedObject == null) 57 | { 58 | m_SelectedObject = Selection.activeGameObject; 59 | if (m_SelectedObject != null) 60 | { 61 | m_CodeName = m_SelectedObject.name.Replace("_", "").Replace(".", "").Replace(" ", ""); 62 | } 63 | } 64 | m_CodeNamespace = EditorGUILayout.TextField("Code Namespace", m_CodeNamespace); 65 | m_CodeName = EditorGUILayout.TextField("Code Name", m_CodeName); 66 | string separatorChar = EditorGUILayout.TextField("Separator Char", m_SeparatorChar.ToString()); 67 | if (!string.IsNullOrEmpty(separatorChar)) 68 | { 69 | m_SeparatorChar = separatorChar[0]; 70 | } 71 | m_SelectedObject = (GameObject)EditorGUILayout.ObjectField("Selected Object", m_SelectedObject, typeof(GameObject), true); 72 | 73 | // 如果文件名和目录名为空,则创建文件的按钮不可用 74 | EditorGUI.BeginDisabledGroup(string.IsNullOrEmpty(m_CodePath) || string.IsNullOrEmpty(m_CodeName) || m_SelectedObject == null || !Directory.Exists(m_CodePath)); 75 | { 76 | if (GUILayout.Button("Create Code File")) 77 | { 78 | CreateCodeFileAndAdd(); 79 | EditorSetting.SetSaveCodePath(m_CodePath); 80 | EditorSetting.SetSaveCodeNamespace(m_CodeNamespace); 81 | EditorSetting.SetSaveSeparatorChar(m_SeparatorChar); 82 | Close(); 83 | } 84 | } 85 | EditorGUI.EndDisabledGroup(); 86 | } 87 | 88 | private void CreateCodeFileAndAdd() 89 | { 90 | MonoCodeCreator codeCreator = new MonoCodeCreator(m_CodePath, m_CodeName, m_CodeNamespace, m_SelectedObject.transform, m_SeparatorChar); 91 | codeCreator.TryCreateCodeFile(); 92 | MonoScript script = AssetDatabase.LoadAssetAtPath(Path.Combine(m_CodePath, $"{m_CodeName}.cs")); 93 | m_AddComponentMethod.Invoke(null, new object[] { m_SelectedObject, script }); 94 | } 95 | } 96 | } -------------------------------------------------------------------------------- /Runtime/CSCodeBindMono.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace CodeBind 5 | { 6 | /// 7 | /// 非Mono类绑定数据的Mono 8 | /// 9 | [CodeBind] 10 | [CodeBindName("CSCodeBindMono")] 11 | [DisallowMultipleComponent] 12 | public sealed class CSCodeBindMono : MonoBehaviour 13 | { 14 | private static readonly CSCodeBindPool s_Pool = new CSCodeBindPool(); 15 | 16 | [SerializeField] 17 | private UnityEngine.Object[] m_BindComponents; 18 | 19 | public UnityEngine.Object[] BindComponents => m_BindComponents; 20 | 21 | private ICSCodeBind m_CSCodeBindObject; 22 | 23 | #if UNITY_EDITOR 24 | [SerializeField] 25 | private char m_SeparatorChar; 26 | 27 | [SerializeField] 28 | private UnityEditor.MonoScript m_BindScript; 29 | 30 | [SerializeField] 31 | private string[] m_BindComponentNames; 32 | 33 | public char SeparatorChar 34 | { 35 | get => m_SeparatorChar; 36 | set => m_SeparatorChar = value; 37 | } 38 | 39 | public UnityEditor.MonoScript BindScript 40 | { 41 | get => m_BindScript; 42 | set => m_BindScript = value; 43 | } 44 | 45 | public string[] BindComponentNames => m_BindComponentNames; 46 | 47 | public void SetBindComponents(string[] names, UnityEngine.Object[] components) 48 | { 49 | if (names == null && components != null) 50 | { 51 | throw new Exception("Names cant be null!"); 52 | } 53 | if (names != null && components == null) 54 | { 55 | throw new Exception("Components cant be null!"); 56 | } 57 | if (names != null && components != null && names.Length != components.Length) 58 | { 59 | throw new Exception("Name count must be same with Component count!"); 60 | } 61 | m_BindComponentNames = names; 62 | m_BindComponents = components; 63 | } 64 | 65 | public bool CheckBindDataExitEmpty() 66 | { 67 | if (m_BindComponents != null) 68 | { 69 | for (int i = 0; i < m_BindComponents.Length; i++) 70 | { 71 | if (m_BindComponents[i] == null) 72 | { 73 | return true; 74 | } 75 | } 76 | } 77 | return false; 78 | } 79 | #endif 80 | 81 | /// 82 | /// 获取绑定代码的的对象 83 | /// 84 | /// 85 | /// 86 | public T GetCSCodeBindObject() where T : class, ICSCodeBind, new() 87 | { 88 | #if UNITY_EDITOR 89 | Type bindType = m_BindScript.GetClass(); 90 | Type getType = typeof(T); 91 | if (bindType != getType) 92 | { 93 | Debug.LogWarning($"{gameObject.name} bind type is {bindType}, but get is {getType}."); 94 | } 95 | #endif 96 | if (m_CSCodeBindObject == null) 97 | { 98 | m_CSCodeBindObject = s_Pool.Fetch(this); 99 | } 100 | else 101 | { 102 | if (m_CSCodeBindObject is not T) 103 | { 104 | Debug.LogWarning($"Get different object(type:{typeof(T)}, the old object(type:{m_CSCodeBindObject.GetType()} will recycle!)"); 105 | s_Pool.Recycle(m_CSCodeBindObject); 106 | m_CSCodeBindObject = s_Pool.Fetch(this); 107 | } 108 | } 109 | return (T)m_CSCodeBindObject; 110 | } 111 | 112 | private void OnDestroy() 113 | { 114 | if (m_CSCodeBindObject != null) 115 | { 116 | var obj = m_CSCodeBindObject; 117 | m_CSCodeBindObject = null; 118 | s_Pool.Recycle(obj); 119 | } 120 | } 121 | } 122 | } -------------------------------------------------------------------------------- /Editor/CodeBindRefresher.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEditor; 3 | using UnityEngine; 4 | 5 | namespace CodeBind.Editor 6 | { 7 | internal class CodeBindRefresher 8 | { 9 | [MenuItem("GameObject/CodeBind/Refresh All Code", priority = -2)] 10 | private static void RefreshAllMonoCode() 11 | { 12 | if (Selection.gameObjects.Length < 1) 13 | { 14 | Debug.LogError("Please select at least one GameObject to refresh bind code."); 15 | return; 16 | } 17 | foreach (GameObject go in Selection.gameObjects) 18 | { 19 | MonoBehaviour[] monos = go.GetComponentsInChildren(true); 20 | foreach (MonoBehaviour mono in monos) 21 | { 22 | object[] attributes = mono.GetType().GetCustomAttributes(typeof(MonoCodeBindAttribute), false); 23 | if (attributes.Length > 0) 24 | { 25 | MonoCodeBindAttribute attribute = attributes[0] as MonoCodeBindAttribute; 26 | if (attribute == null) 27 | { 28 | throw new Exception($"{mono.GetType()} is not inherit from MonoCodeBindAttribute!"); 29 | } 30 | MonoScript script = MonoScript.FromMonoBehaviour(mono); 31 | MonoCodeBinder codeBinder = new MonoCodeBinder(script, mono.transform, attribute.SeparatorChar); 32 | codeBinder.TryGenerateBindCode(); 33 | Debug.Log($"Refresh '{mono.name}({mono})' code successfully."); 34 | } 35 | } 36 | CSCodeBindMono[] csCodeBinds = go.GetComponentsInChildren(true); 37 | foreach (CSCodeBindMono bindMono in csCodeBinds) 38 | { 39 | CSCodeBinder codeBinder = new CSCodeBinder(bindMono.BindScript, bindMono.transform, bindMono.SeparatorChar); 40 | codeBinder.TryGenerateBindCode(); 41 | } 42 | } 43 | } 44 | 45 | [MenuItem("GameObject/CodeBind/Refresh All Serialization", priority = -1)] 46 | private static void RefreshAllMonoSerialization() 47 | { 48 | if (Selection.gameObjects.Length < 1) 49 | { 50 | Debug.LogError("Please select at least one GameObject to refresh bind serialization."); 51 | } 52 | foreach (GameObject go in Selection.gameObjects) 53 | { 54 | MonoBehaviour[] monos = go.GetComponentsInChildren(true); 55 | foreach (MonoBehaviour mono in monos) 56 | { 57 | object[] attributes = mono.GetType().GetCustomAttributes(typeof(MonoCodeBindAttribute), false); 58 | if (attributes.Length > 0) 59 | { 60 | MonoCodeBindAttribute attribute = attributes[0] as MonoCodeBindAttribute; 61 | if (attribute == null) 62 | { 63 | throw new Exception($"{mono.GetType()} is not inherit from MonoCodeBindAttribute!"); 64 | } 65 | MonoScript script = MonoScript.FromMonoBehaviour(mono); 66 | MonoCodeBinder codeBinder = new MonoCodeBinder(script, mono.transform, attribute.SeparatorChar); 67 | codeBinder.TrySetSerialization(); 68 | Debug.Log($"Refresh '{mono.name}({mono})' serialization successfully."); 69 | } 70 | } 71 | CSCodeBindMono[] csCodeBinds = go.GetComponentsInChildren(true); 72 | foreach (CSCodeBindMono bindMono in csCodeBinds) 73 | { 74 | CSCodeBinder codeBinder = new CSCodeBinder(bindMono.BindScript, bindMono.transform, bindMono.SeparatorChar); 75 | codeBinder.TrySetSerialization(); 76 | Debug.Log($"Refresh '{bindMono.name}({bindMono})' serialization successfully."); 77 | } 78 | } 79 | } 80 | } 81 | } -------------------------------------------------------------------------------- /Editor/CodeBindNameTypeCollection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using UnityEditor; 4 | using UnityEngine; 5 | 6 | namespace CodeBind.Editor 7 | { 8 | internal static class CodeBindNameTypeCollection 9 | { 10 | internal static readonly Dictionary BindNameTypeDict = new Dictionary(); 11 | internal static readonly Dictionary BindTypeNameDict = new Dictionary(); 12 | 13 | internal static void Do() 14 | { 15 | if (BindNameTypeDict.Count > 0) 16 | return; 17 | var fieldInfos = TypeCache.GetFieldsWithAttribute(); 18 | Type fieldType = typeof(Dictionary); 19 | foreach (var fieldInfo in fieldInfos) 20 | { 21 | if (!fieldInfo.IsStatic) 22 | { 23 | Debug.LogError($"Get BindNameType Fail! {fieldInfo.Name} is not static!"); 24 | continue; 25 | } 26 | if (fieldInfo.FieldType != fieldType) 27 | { 28 | Debug.LogError($"Get BindNameType Fail! {fieldInfo.Name} is not {fieldType}!"); 29 | continue; 30 | } 31 | object value = fieldInfo.GetValue(null); 32 | if (value == null) 33 | { 34 | Debug.LogError($"Get BindNameType Fail! {fieldInfo.Name} is null!"); 35 | continue; 36 | } 37 | Dictionary bindNameTypeDict = (Dictionary)value; 38 | foreach (var kv in bindNameTypeDict) 39 | { 40 | if (kv.Value == null || !kv.Value.IsSubclassOf(typeof(Component)) && kv.Value != typeof(GameObject)) 41 | { 42 | Debug.LogError($"Add BindNameType Fail! Type:{kv.Value} error! Only can bind sub class of 'Component'!"); 43 | continue; 44 | } 45 | if (BindNameTypeDict.TryGetValue(kv.Key, out Type type)) 46 | { 47 | Debug.LogError($"Add BindNameType Fail! Type name:{kv.Key}({type}) exist!"); 48 | continue; 49 | } 50 | if (BindTypeNameDict.TryGetValue(kv.Value, out string name)) 51 | { 52 | Debug.LogError($"Add BindNameType Fail! Type name:{name}({kv.Value}) exist!"); 53 | continue; 54 | } 55 | BindNameTypeDict.Add(kv.Key, kv.Value); 56 | BindTypeNameDict.Add(kv.Value, kv.Key); 57 | } 58 | } 59 | 60 | var types = TypeCache.GetTypesWithAttribute(); 61 | foreach (var type in types) 62 | { 63 | if (!type.IsSubclassOf(typeof(Component))) 64 | { 65 | Debug.LogError($"Add BindNameType Fail! Type:{type} error! Only can bind sub class of 'Component'!"); 66 | continue; 67 | } 68 | CodeBindNameAttribute attribute = (CodeBindNameAttribute)type.GetCustomAttributes(typeof(CodeBindNameAttribute), false)[0]; 69 | if (BindNameTypeDict.TryGetValue(attribute.BindName, out Type bindType)) 70 | { 71 | Debug.LogError($"Add BindNameType Fail! Type name:{attribute.BindName}({bindType}) exist!"); 72 | continue; 73 | } 74 | if (BindTypeNameDict.TryGetValue(type, out string bindName)) 75 | { 76 | Debug.LogError($"Add BindNameType Fail! Type name:{bindName}({type}) exist!"); 77 | continue; 78 | } 79 | BindNameTypeDict.Add(attribute.BindName, type); 80 | BindTypeNameDict.Add(type, attribute.BindName); 81 | } 82 | 83 | foreach (var pair in DefaultCodeBindNameTypeConfig.BindNameTypeDict) 84 | { 85 | if (!BindNameTypeDict.ContainsKey(pair.Key) && !BindTypeNameDict.ContainsKey(pair.Value)) 86 | { 87 | BindNameTypeDict.Add(pair.Key, pair.Value); 88 | BindTypeNameDict.Add(pair.Value, pair.Key); 89 | } 90 | } 91 | } 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /Samples~/Demo/TestMono.Bind.cs: -------------------------------------------------------------------------------- 1 | // This is automatically generated by CodeBind. Please do not modify it. 2 | 3 | namespace CodeBind.Demo 4 | { 5 | public partial class TestMono 6 | { 7 | [UnityEngine.SerializeField, Sirenix.OdinInspector.FoldoutGroup("BindData"), Sirenix.OdinInspector.ReadOnly] 8 | private UnityEngine.Transform m_TestTransform; 9 | [UnityEngine.SerializeField, Sirenix.OdinInspector.FoldoutGroup("BindData"), Sirenix.OdinInspector.ReadOnly] 10 | private UnityEngine.Animator m_TestAnimator; 11 | [UnityEngine.SerializeField, Sirenix.OdinInspector.FoldoutGroup("BindData"), Sirenix.OdinInspector.ReadOnly] 12 | private UnityEngine.GameObject m_Test2GameObject; 13 | [UnityEngine.SerializeField, Sirenix.OdinInspector.FoldoutGroup("BindData"), Sirenix.OdinInspector.ReadOnly] 14 | private UnityEngine.Transform m_Test2Transform; 15 | [UnityEngine.SerializeField, Sirenix.OdinInspector.FoldoutGroup("BindData"), Sirenix.OdinInspector.ReadOnly] 16 | private UnityEngine.Animator m_Test2Animator; 17 | [UnityEngine.SerializeField, Sirenix.OdinInspector.FoldoutGroup("BindData"), Sirenix.OdinInspector.ReadOnly] 18 | private CodeBind.CSCodeBindMono m_TestCSCodeBindMono; 19 | [UnityEngine.SerializeField, Sirenix.OdinInspector.FoldoutGroup("BindData"), Sirenix.OdinInspector.ReadOnly] 20 | private CodeBind.ReferenceBindMono m_TestReferenceBindMono; 21 | [UnityEngine.SerializeField, Sirenix.OdinInspector.FoldoutGroup("BindData"), Sirenix.OdinInspector.ReadOnly] 22 | private UnityEngine.Transform m_Test3Transform; 23 | [UnityEngine.SerializeField, Sirenix.OdinInspector.FoldoutGroup("BindData"), Sirenix.OdinInspector.ReadOnly] 24 | private UnityEngine.UI.Slider m_Test3Slider; 25 | [UnityEngine.SerializeField, Sirenix.OdinInspector.FoldoutGroup("BindData"), Sirenix.OdinInspector.ReadOnly] 26 | private UnityEngine.GameObject m_Test4GameObject; 27 | [UnityEngine.SerializeField, Sirenix.OdinInspector.FoldoutGroup("BindData"), Sirenix.OdinInspector.ReadOnly] 28 | private UnityEngine.RectTransform m_Test4RectTransform; 29 | [UnityEngine.SerializeField, Sirenix.OdinInspector.FoldoutGroup("BindData"), Sirenix.OdinInspector.ReadOnly] 30 | private UnityEngine.UI.Slider m_Test4Slider; 31 | 32 | [UnityEngine.SerializeField, Sirenix.OdinInspector.FoldoutGroup("BindData"), Sirenix.OdinInspector.ReadOnly] 33 | private UnityEngine.Animator[] m_Test2AnimatorArray; 34 | [UnityEngine.SerializeField, Sirenix.OdinInspector.FoldoutGroup("BindData"), Sirenix.OdinInspector.ReadOnly] 35 | private UnityEngine.GameObject[] m_Test2GameObjectArray; 36 | [UnityEngine.SerializeField, Sirenix.OdinInspector.FoldoutGroup("BindData"), Sirenix.OdinInspector.ReadOnly] 37 | private UnityEngine.Transform[] m_Test2TransformArray; 38 | [UnityEngine.SerializeField, Sirenix.OdinInspector.FoldoutGroup("BindData"), Sirenix.OdinInspector.ReadOnly] 39 | private UnityEngine.Animator[] m_TestAnimatorArray; 40 | [UnityEngine.SerializeField, Sirenix.OdinInspector.FoldoutGroup("BindData"), Sirenix.OdinInspector.ReadOnly] 41 | private UnityEngine.Transform[] m_TestTransformArray; 42 | 43 | public UnityEngine.Transform TestTransform => m_TestTransform; 44 | public UnityEngine.Animator TestAnimator => m_TestAnimator; 45 | public UnityEngine.GameObject Test2GameObject => m_Test2GameObject; 46 | public UnityEngine.Transform Test2Transform => m_Test2Transform; 47 | public UnityEngine.Animator Test2Animator => m_Test2Animator; 48 | public CodeBind.CSCodeBindMono TestCSCodeBindMono => m_TestCSCodeBindMono; 49 | public CodeBind.ReferenceBindMono TestReferenceBindMono => m_TestReferenceBindMono; 50 | public UnityEngine.Transform Test3Transform => m_Test3Transform; 51 | public UnityEngine.UI.Slider Test3Slider => m_Test3Slider; 52 | public UnityEngine.GameObject Test4GameObject => m_Test4GameObject; 53 | public UnityEngine.RectTransform Test4RectTransform => m_Test4RectTransform; 54 | public UnityEngine.UI.Slider Test4Slider => m_Test4Slider; 55 | 56 | public UnityEngine.Animator[] Test2AnimatorArray => m_Test2AnimatorArray; 57 | public UnityEngine.GameObject[] Test2GameObjectArray => m_Test2GameObjectArray; 58 | public UnityEngine.Transform[] Test2TransformArray => m_Test2TransformArray; 59 | public UnityEngine.Animator[] TestAnimatorArray => m_TestAnimatorArray; 60 | public UnityEngine.Transform[] TestTransformArray => m_TestTransformArray; 61 | 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Runtime/ReferenceBindMono.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | namespace CodeBind 6 | { 7 | /// 8 | /// 引用绑定的Mono 9 | /// 10 | [CodeBind] 11 | [CodeBindName("ReferenceBindMono")] 12 | [DisallowMultipleComponent] 13 | public sealed class ReferenceBindMono : MonoBehaviour 14 | { 15 | [SerializeField] private string[] m_BindNames; 16 | [SerializeField] private GameObject[] m_BindGameObjects; 17 | [SerializeField] private string[] m_AutoBindComponentNames; 18 | [SerializeField] private UnityEngine.Object[] m_AutoBindComponents; 19 | 20 | public GameObject[] BindGameObjects => m_BindGameObjects; 21 | public UnityEngine.Object[] AutoBindComponents => m_AutoBindComponents; 22 | 23 | #if UNITY_EDITOR 24 | [SerializeField] 25 | private char m_SeparatorChar; 26 | 27 | public char SeparatorChar 28 | { 29 | get => m_SeparatorChar; 30 | set => m_SeparatorChar = value; 31 | } 32 | 33 | public void SetAutoBindComponents(string[] names, UnityEngine.Object[] components) 34 | { 35 | if (names == null && components != null) 36 | { 37 | throw new Exception("Names cant be null!"); 38 | } 39 | if (names != null && components == null) 40 | { 41 | throw new Exception("Components cant be null!"); 42 | } 43 | if (names != null && components != null && names.Length != components.Length) 44 | { 45 | throw new Exception("Name count must be same with Component count!"); 46 | } 47 | m_AutoBindComponentNames = names; 48 | m_AutoBindComponents = components; 49 | } 50 | 51 | public bool CheckBindDataExitEmpty() 52 | { 53 | if (m_BindGameObjects != null) 54 | { 55 | for (int i = 0; i < m_BindGameObjects.Length; i++) 56 | { 57 | if (m_BindGameObjects[i] == null) 58 | { 59 | return true; 60 | } 61 | } 62 | } 63 | if (m_AutoBindComponents != null) 64 | { 65 | for (int i = 0; i < m_AutoBindComponents.Length; i++) 66 | { 67 | if (m_AutoBindComponents[i] == null) 68 | { 69 | return true; 70 | } 71 | } 72 | } 73 | return false; 74 | } 75 | #endif 76 | 77 | private readonly Dictionary m_GameObjectDict = new Dictionary(); 78 | private readonly Dictionary m_AutoBindDict = new Dictionary(); 79 | private readonly Dictionary m_AutoBindArrayDict = new Dictionary(); 80 | private readonly HashSet m_AutoBindArrayNames = new HashSet(); 81 | 82 | private void Awake() 83 | { 84 | for (int i = 0; i < m_BindNames.Length; i++) 85 | { 86 | m_GameObjectDict.Add(m_BindNames[i], m_BindGameObjects[i]); 87 | } 88 | for (int i = 0; i < m_AutoBindComponentNames.Length; i++) 89 | { 90 | var componentName = m_AutoBindComponentNames[i]; 91 | if (!m_AutoBindDict.TryAdd(componentName, m_AutoBindComponents[i])) 92 | { 93 | m_AutoBindArrayNames.Add(componentName); 94 | } 95 | } 96 | foreach (var componentName in m_AutoBindArrayNames) 97 | { 98 | m_AutoBindDict.Remove(componentName); 99 | } 100 | } 101 | 102 | public GameObject GetGameObject(string key) 103 | { 104 | m_GameObjectDict.TryGetValue(key, out GameObject go); 105 | return go; 106 | } 107 | 108 | public T GetAs(string key) where T : UnityEngine.Object 109 | { 110 | if (m_AutoBindDict.TryGetValue(key, out UnityEngine.Object obj)) 111 | { 112 | return obj as T; 113 | } 114 | return null; 115 | } 116 | 117 | public List GetList(string key) where T : UnityEngine.Object 118 | { 119 | if (m_AutoBindArrayDict.TryGetValue(key, out object listObj)) 120 | { 121 | return listObj as List; 122 | } 123 | if (m_AutoBindArrayNames.Contains(key)) 124 | { 125 | List list = null; 126 | for (int i = 0; i < m_AutoBindComponentNames.Length; i++) 127 | { 128 | if (m_AutoBindComponentNames[i] == key && m_AutoBindComponents[i] is T component) 129 | { 130 | if (list == null) 131 | { 132 | list = new List(); 133 | } 134 | list.Add(component); 135 | } 136 | } 137 | if (list != null) 138 | { 139 | m_AutoBindArrayDict.Add(key, list); 140 | return list; 141 | } 142 | } 143 | return null; 144 | } 145 | } 146 | } -------------------------------------------------------------------------------- /Editor/CSCodeBindMonoInspector.cs: -------------------------------------------------------------------------------- 1 | using Sirenix.Utilities.Editor; 2 | using UnityEditor; 3 | using UnityEngine; 4 | using Object = UnityEngine.Object; 5 | 6 | namespace CodeBind.Editor 7 | { 8 | /// 9 | /// 非Mono类绑定数据的Mono编辑器界面 10 | /// 11 | [CustomEditor(typeof(CSCodeBindMono))] 12 | [CanEditMultipleObjects] 13 | internal sealed class CSCodeBindMonoInspector : UnityEditor.Editor 14 | { 15 | private SerializedProperty m_SeparatorChar; 16 | private SerializedProperty m_BindScript; 17 | 18 | private SerializedProperty m_BindComponents; 19 | private SerializedProperty m_BindComponentNames; 20 | 21 | private bool m_ShowBindComponents; 22 | 23 | private void OnEnable() 24 | { 25 | m_SeparatorChar = serializedObject.FindProperty("m_SeparatorChar"); 26 | if (m_SeparatorChar.intValue == 0) 27 | { 28 | m_SeparatorChar.intValue = EditorSetting.GetSaveSeparatorChar(); 29 | serializedObject.ApplyModifiedProperties(); 30 | } 31 | m_BindScript = serializedObject.FindProperty("m_BindScript"); 32 | m_BindComponents = serializedObject.FindProperty("m_BindComponents"); 33 | m_BindComponentNames = serializedObject.FindProperty("m_BindComponentNames"); 34 | } 35 | 36 | public override void OnInspectorGUI() 37 | { 38 | serializedObject.Update(); 39 | 40 | EditorGUI.BeginDisabledGroup(EditorApplication.isPlayingOrWillChangePlaymode); 41 | { 42 | if(m_BindScript.objectReferenceValue == null) 43 | { 44 | if (GUILayout.Button("CodeBind Creator")) 45 | { 46 | CSCodeCreatorWindow.ShowWindow(); 47 | } 48 | } 49 | else 50 | { 51 | if (GUILayout.Button("Generate BindCode and Serialization")) 52 | { 53 | if (targets.Length > 1) 54 | { 55 | foreach (Object t in targets) 56 | { 57 | CSCodeBindMono bindMono = (CSCodeBindMono)t; 58 | CSCodeBinder codeBinder = new CSCodeBinder(bindMono.BindScript, bindMono.transform, bindMono.SeparatorChar); 59 | codeBinder.TryGenerateBindCode(); 60 | codeBinder.TrySetSerialization(); 61 | } 62 | } 63 | else 64 | { 65 | CSCodeBinder codeBinder = new CSCodeBinder((MonoScript)m_BindScript.objectReferenceValue, ((MonoBehaviour)target).transform, (char)m_SeparatorChar.intValue); 66 | codeBinder.TryGenerateBindCode(); 67 | codeBinder.TrySetSerialization(); 68 | } 69 | } 70 | } 71 | 72 | EditorGUI.BeginChangeCheck(); 73 | EditorGUILayout.PropertyField(m_SeparatorChar); 74 | if (EditorGUI.EndChangeCheck()) 75 | { 76 | EditorSetting.SetSaveSeparatorChar((char)m_SeparatorChar.intValue); 77 | } 78 | 79 | EditorGUILayout.PropertyField(m_BindScript); 80 | 81 | if (GUILayout.Button("Clear Serialization")) 82 | { 83 | if (targets.Length > 1) 84 | { 85 | foreach (var t in targets) 86 | { 87 | ((CSCodeBindMono)t).SetBindComponents(null, null); 88 | } 89 | } 90 | else 91 | { 92 | ((CSCodeBindMono)target).SetBindComponents(null, null); 93 | } 94 | } 95 | 96 | if (targets.Length > 1) 97 | { 98 | foreach (var t in targets) 99 | { 100 | if (((CSCodeBindMono)t).CheckBindDataExitEmpty()) 101 | { 102 | SirenixEditorGUI.MessageBox("BindData exist empty.", MessageType.Warning); 103 | break; 104 | } 105 | } 106 | } 107 | else 108 | { 109 | if (((CSCodeBindMono)target).CheckBindDataExitEmpty()) 110 | { 111 | SirenixEditorGUI.MessageBox("BindData exist empty.", MessageType.Warning); 112 | } 113 | } 114 | 115 | SirenixEditorGUI.BeginBox(); 116 | SirenixEditorGUI.BeginBoxHeader(); 117 | string labelText = $"Bind Data (count:{m_BindComponents.arraySize})"; 118 | m_ShowBindComponents = SirenixEditorGUI.Foldout(m_ShowBindComponents, labelText); 119 | SirenixEditorGUI.EndBoxHeader(); 120 | if (SirenixEditorGUI.BeginFadeGroup(labelText, m_ShowBindComponents)) 121 | { 122 | EditorGUI.BeginDisabledGroup(true); 123 | { 124 | GUILayout.BeginHorizontal(); 125 | EditorGUILayout.LabelField("Name"); 126 | EditorGUILayout.LabelField("Component"); 127 | GUILayout.EndHorizontal(); 128 | for (int i = 0; i < m_BindComponents.arraySize; i++) 129 | { 130 | GUILayout.BeginHorizontal(); 131 | string cName = m_BindComponentNames.GetArrayElementAtIndex(i).stringValue; 132 | EditorGUILayout.TextField(cName); 133 | EditorGUILayout.ObjectField(m_BindComponents.GetArrayElementAtIndex(i).objectReferenceValue, typeof (Component), true); 134 | GUILayout.EndHorizontal(); 135 | } 136 | } 137 | EditorGUI.EndDisabledGroup(); 138 | } 139 | SirenixEditorGUI.EndFadeGroup(); 140 | SirenixEditorGUI.EndBox(); 141 | } 142 | EditorGUI.EndDisabledGroup(); 143 | 144 | serializedObject.ApplyModifiedProperties(); 145 | } 146 | } 147 | } 148 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CodeBind - Unity 组件绑定代码生成工具 2 | 3 |

4 | Unity Version 5 | License 6 | Language 7 |

8 | 9 | > 🚀 基于节点命名规则的智能代码生成工具,告别手动拖拽组件的繁琐操作! 10 | 11 | CodeBind 是一款为 Unity 开发者设计的高效代码生成工具,通过简单的命名规则和特性标记,自动生成与预制体绑定的脚本代码。**零侵入性设计**,无需修改现有代码结构,即可大幅提升开发效率。 12 | 13 | --- 14 | 15 | ## ✨ 核心特性 16 | 17 | ### 🎯 智能命名识别 18 | - **模糊匹配**:节点名称支持缩写识别,`Self_Tr` 自动识别为 `Transform` 19 | - **多组件绑定**:单节点支持绑定多个组件,如 `Self_Transform_Button` 或 `Self_Tr_But` 20 | - **全匹配模式**:使用通配符 `*` 绑定节点所有脚本,如 `Self_*` 21 | - **数组支持**:通过括号标记自动生成数组,如 `Button (1)`、`Button (2)` 22 | 23 | ### 🔧 灵活配置 24 | - **自定义分隔符**:根据团队命名习惯自由设置分隔字符 25 | - **命名空间支持**:自动生成指定命名空间的代码 26 | - **路径记忆**:自动记住上次使用的代码生成路径 27 | 28 | ### 🏗️ 两种工作模式 29 | - **MonoBehaviour 模式**:直接在 MonoBehaviour 类上使用,最便捷的使用方式 30 | - **纯 C# 模式**:通过 `ICSCodeBind` 接口支持非 MonoBehaviour 类,适合需要分离逻辑的场景 31 | 32 | ### 🎨 开发体验优化 33 | - **零侵入性**:生成的代码使用 partial class,不影响原有代码结构 34 | - **嵌套支持**:智能识别已绑定节点,避免重复绑定子节点,非常适合列表项(List Item)等场景 35 | - **引用丢失提示**:自动检测绑定数据中的空引用,及时在 Inspector 中显示警告信息 36 | - **多种操作方式**:支持 Inspector 面板按钮操作(Generate Bind Code / Generate Serialization)和右键快捷菜单快速创建 37 | 38 | --- 39 | 40 | ## 📦 安装方式 41 | 42 | ### 方法一:通过 Unity Package Manager(推荐) 43 | 44 | 1. 打开 Unity 编辑器 45 | 2. 打开 **Window > Package Manager** 46 | 3. 点击左上角 **+** 按钮 47 | 4. 选择 **Add package from git URL** 48 | 5. 输入:`https://github.com/XuToWei/CodeBind.git` 49 | 6. 点击 **Add** 50 | 51 | ### 方法二:手动下载 52 | 53 | 下载本仓库并将其解压到项目的 `Packages` 文件夹中。 54 | 55 | --- 56 | 57 | ## ⚙️ 依赖项 58 | 59 | 本项目依赖以下插件(需自行安装): 60 | 61 | - [**Odin Inspector**](https://assetstore.unity.com/packages/tools/utilities/odin-inspector-and-serializer-89041) - 增强编辑器界面和序列化功能 62 | 63 | --- 64 | 65 | ## 🚀 快速开始 66 | 67 | ### 方式一:MonoBehaviour 模式(推荐) 68 | 69 | #### 1️⃣ 添加特性标记 70 | 71 | 在你的 MonoBehaviour 类上添加 `[MonoCodeBind]` 特性: 72 | 73 | ```csharp 74 | using UnityEngine; 75 | using CodeBind; 76 | 77 | namespace Game 78 | { 79 | [MonoCodeBind('_')] // '_' 为分隔符,可自定义 80 | public partial class TestMono : MonoBehaviour 81 | { 82 | // 你的业务代码 83 | private void Start() 84 | { 85 | // 自动生成的变量可以直接使用 86 | Self_Tr.position = Vector3.zero; 87 | Self_But.onClick.AddListener(OnButtonClick); 88 | } 89 | 90 | private void OnButtonClick() 91 | { 92 | Debug.Log("Button Clicked!"); 93 | } 94 | } 95 | } 96 | ``` 97 | 98 | #### 2️⃣ 设置节点命名 99 | 100 | 在 Unity Hierarchy 中按照命名规则设置节点名称: 101 | 102 | ``` 103 | TestGameObject 104 | ├── Self_Transform // 绑定 Transform 组件 105 | ├── Self_Button // 绑定 Button 组件 106 | ├── Title_Text // 绑定 Text 组件 107 | ├── Items_Transform_* // 绑定所有组件 108 | └── ListItems 109 | ├── Item (0) // 数组元素 110 | ├── Item (1) 111 | └── Item (2) 112 | ``` 113 | 114 | #### 3️⃣ 生成代码和数据 115 | 116 | 在 Inspector 面板中点击以下按钮: 117 | 118 | - **Generate Bind Code** - 生成绑定代码(.Bind.cs 文件) 119 | - **Generate Serialization** - 生成序列化数据(将组件引用保存到预制体) 120 | 121 | ![MonoBehaviour 模式示例](Images~/1.png) 122 | 123 | #### 4️⃣ 生成的代码示例 124 | 125 | 工具会自动生成 `TestMono.Bind.cs` 文件: 126 | 127 | ```csharp 128 | using UnityEngine; 129 | using UnityEngine.UI; 130 | 131 | namespace Game 132 | { 133 | public partial class TestMono 134 | { 135 | [SerializeField] private Transform Self_Tr; 136 | [SerializeField] private Button Self_But; 137 | [SerializeField] private Text Title_Text; 138 | [SerializeField] private Component[] Items_Transform_Star; 139 | [SerializeField] private Transform[] Item_Array; 140 | } 141 | } 142 | ``` 143 | 144 | --- 145 | 146 | ### 方式二:纯 C# 模式 147 | 148 | 适用于不希望继承 MonoBehaviour 的场景。 149 | 150 | #### 1️⃣ 创建 C# 类 151 | 152 | ```csharp 153 | using CodeBind; 154 | 155 | namespace Game 156 | { 157 | public partial class TestCS : ICSCodeBind 158 | { 159 | public void Initialize() 160 | { 161 | // 使用生成的绑定变量 162 | Title_Text.text = "Hello CodeBind!"; 163 | } 164 | } 165 | } 166 | ``` 167 | 168 | #### 2️⃣ 添加 CSCodeBindMono 组件 169 | 170 | 在 GameObject 上添加 `CSCodeBindMono` 组件,并拖入你的 C# 脚本。 171 | 172 | ![纯 C# 模式示例](Images~/2.png) 173 | 174 | #### 3️⃣ 获取绑定对象 175 | 176 | ```csharp 177 | // 自动缓存,无需担心性能 178 | TestCS testCS = gameObject.GetCSCodeBindObject(); 179 | testCS.Initialize(); 180 | ``` 181 | 182 | --- 183 | 184 | ## 📝 命名规则详解 185 | 186 | ### 基础格式 187 | 188 | ``` 189 | [变量名]_[组件类型][_组件类型2...][(数组索引)] 190 | ``` 191 | 192 | ### 组件类型缩写 193 | 194 | 支持模糊匹配,常用缩写包括: 195 | 196 | | 全称 | 缩写示例 | 197 | |------|---------| 198 | | Transform | Tr, Trans | 199 | | Button | But, Btn | 200 | | Text | Txt | 201 | | Image | Img | 202 | | RectTransform | Rect, RectTr | 203 | | GameObject | Go, Obj | 204 | 205 | 你也可以通过 `CodeBindNameAttribute` 和 `CodeBindNameTypeAttribute` 自定义命名规则。 206 | 207 | ### 示例 208 | 209 | ``` 210 | Player_Transform → Transform Player_Tr 211 | UI_Button_Image → Button UI_But, Image UI_Img 212 | Items_* → Component[] Items_Star (绑定所有组件) 213 | ListItem (0) → Transform[] ListItem_Array (索引 0) 214 | Child_Nested_Transform → 如果 Child 有 CodeBind 特性,Nested 不会被识别 215 | ``` 216 | 217 | --- 218 | 219 | ## 🛠️ 高级功能 220 | 221 | ### 右键快速生成 MonoBehaviour 222 | 223 | 1. 在 Hierarchy 中选中一个 GameObject 224 | 2. 右键选择 **GameObject > CodeBind > Mono Code Creator** 225 | 3. 在弹出窗口中设置: 226 | - **Code Name**:类名 227 | - **Code Namespace**:命名空间 228 | - **Code Path**:保存路径 229 | - **Separator Char**:分隔符 230 | 4. 点击 **Create Code File** 即可生成代码并自动添加到该 GameObject 231 | 232 | ### 自定义命名类型 233 | 234 | 通过 `CodeBindNameTypeAttribute` 扩展不可变的类型识别(应用于 static Dictionary 字段): 235 | 236 | ```csharp 237 | using System; 238 | using System.Collections.Generic; 239 | using UnityEngine; 240 | using CodeBind; 241 | 242 | public static class CustomBindTypeConfig 243 | { 244 | [CodeBindNameType] 245 | public static Dictionary CustomBindTypes = new Dictionary 246 | { 247 | { "MyCustomComponent", typeof(MyCustomComponent) }, 248 | { "MCC", typeof(MyCustomComponent) }, 249 | { "PlayerController", typeof(PlayerController) }, 250 | { "PC", typeof(PlayerController) } 251 | }; 252 | } 253 | ``` 254 | 255 | 通过 `CodeBindNameAttribute` 处理业务代码中的自定义类型(应用于 Component 类): 256 | 257 | ```csharp 258 | using UnityEngine; 259 | using CodeBind; 260 | 261 | [CodeBindName("MyCustomComponent")] 262 | public class MyCustomComponent : MonoBehaviour 263 | { 264 | // 你的自定义组件代码 265 | } 266 | ``` 267 | 268 | --- 269 | 270 | ## ❓ 常见问题 271 | 272 |
273 | Q: 生成的代码文件在哪里? 274 | 275 | 生成的代码文件默认与原脚本同目录,文件名为 `原类名.Bind.cs`。 276 | 277 |
278 | 279 |
280 | Q: 修改节点名称后需要重新生成吗? 281 | 282 | 是的,修改节点命名或结构后,需要重新点击 `Generate Bind Code` 和 `Generate Serialization`。 283 | 284 |
285 | 286 |
287 | Q: 支持嵌套预制体吗? 288 | 289 | 支持。已经标记了 `MonoCodeBind` 或 `CodeBindAttribute` 的节点,其子节点不会被父级识别,避免重复绑定。这个特性非常适合处理列表场景,例如:ScrollView 中的每个 ListItem 可以有自己的绑定脚本,父级 ScrollView 的绑定不会影响到 ListItem 内部的节点。 290 | 291 |
292 | 293 |
294 | Q: 是否支持其他编辑器扩展? 295 | 296 | 需要依赖 Odin Inspector,其他编辑器扩展不影响使用。 297 | 298 |
299 | 300 | --- 301 | 302 | ## 💬 交流与反馈 303 | 304 | - **QQ 交流群**:949482664 305 | - **问题反馈**:[GitHub Issues](https://github.com/XuToWei/CodeBind/issues) 306 | 307 | --- 308 | 309 | ## 📄 许可证 310 | 311 | 本项目基于 [MIT License](LICENSE) 开源。 312 | 313 | --- 314 | 315 | ## 🌟 为什么选择 CodeBind? 316 | 317 | | 传统方式 | 使用 CodeBind | 318 | |---------|--------------| 319 | | ❌ 手动拖拽几十个组件到脚本 | ✅ 按命名规则自动生成 | 320 | | ❌ 修改 UI 后重新拖拽 | ✅ 重新生成即可 | 321 | | ❌ 代码与数据耦合 | ✅ partial class 分离生成代码 | 322 | | ❌ 容易遗漏或拖错组件 | ✅ 自动识别,不会出错 | 323 | | ❌ 团队协作易冲突 | ✅ 生成代码规范统一 | 324 | 325 | --- 326 | 327 |

328 | ⭐ 如果这个工具对你有帮助,请给我们一个 Star! 329 |

330 | -------------------------------------------------------------------------------- /Editor/ReferenceBindMonoInspector.cs: -------------------------------------------------------------------------------- 1 | using Sirenix.Utilities.Editor; 2 | using UnityEditor; 3 | using UnityEngine; 4 | 5 | namespace CodeBind.Editor 6 | { 7 | [CustomEditor(typeof(ReferenceBindMono))] 8 | internal sealed class ReferenceBindMonoInspector : UnityEditor.Editor 9 | { 10 | private SerializedProperty m_SeparatorChar; 11 | 12 | private SerializedProperty m_BindNames; 13 | private SerializedProperty m_BindGameObjects; 14 | 15 | private SerializedProperty m_AutoBindComponentNames; 16 | private SerializedProperty m_AutoBindComponents; 17 | 18 | private string m_AddBindName; 19 | private GameObject m_AddBindGameObject; 20 | 21 | private bool m_IsGameObjectBindFoldout = true; 22 | private bool m_IsAutoBindFoldout = true; 23 | 24 | private void OnEnable() 25 | { 26 | m_SeparatorChar = serializedObject.FindProperty("m_SeparatorChar"); 27 | if (m_SeparatorChar.intValue == 0) 28 | { 29 | m_SeparatorChar.intValue = EditorSetting.GetSaveSeparatorChar(); 30 | serializedObject.ApplyModifiedProperties(); 31 | } 32 | m_BindNames = serializedObject.FindProperty("m_BindNames"); 33 | m_BindGameObjects = serializedObject.FindProperty("m_BindGameObjects"); 34 | m_AutoBindComponentNames = serializedObject.FindProperty("m_AutoBindComponentNames"); 35 | m_AutoBindComponents = serializedObject.FindProperty("m_AutoBindComponents"); 36 | } 37 | 38 | public override void OnInspectorGUI() 39 | { 40 | serializedObject.Update(); 41 | 42 | EditorGUI.BeginDisabledGroup(EditorApplication.isPlayingOrWillChangePlaymode); 43 | { 44 | SirenixEditorGUI.BeginBox(); 45 | SirenixEditorGUI.BeginBoxHeader(); 46 | string labelGameObjectText = "GameObject Bind"; 47 | m_IsGameObjectBindFoldout = SirenixEditorGUI.Foldout(m_IsGameObjectBindFoldout, labelGameObjectText); 48 | SirenixEditorGUI.EndBoxHeader(); 49 | if (SirenixEditorGUI.BeginFadeGroup(labelGameObjectText, m_IsGameObjectBindFoldout)) 50 | { 51 | GUILayout.BeginHorizontal(); 52 | EditorGUILayout.LabelField("Name"); 53 | EditorGUILayout.LabelField("GameObject"); 54 | GUILayout.EndHorizontal(); 55 | 56 | GUILayout.BeginHorizontal(); 57 | m_AddBindName = EditorGUILayout.TextField(m_AddBindName); 58 | m_AddBindGameObject = (GameObject)EditorGUILayout.ObjectField(m_AddBindGameObject, typeof(GameObject), true); 59 | if (GUILayout.Button("+") && !string.IsNullOrEmpty(m_AddBindName)) 60 | { 61 | bool isRepeated = false; 62 | for (int i = 0; i < m_BindNames.arraySize; i++) 63 | { 64 | string goName = m_BindNames.GetArrayElementAtIndex(i).stringValue; 65 | if (m_AddBindName == goName) 66 | { 67 | isRepeated = true; 68 | m_BindNames.GetArrayElementAtIndex(i).stringValue = m_AddBindName; 69 | m_BindGameObjects.GetArrayElementAtIndex(i).objectReferenceValue = m_AddBindGameObject; 70 | m_AddBindName = string.Empty; 71 | m_AddBindGameObject = null; 72 | break; 73 | } 74 | } 75 | 76 | if (!isRepeated) 77 | { 78 | m_BindNames.InsertArrayElementAtIndex(0); 79 | m_BindNames.GetArrayElementAtIndex(0).stringValue = m_AddBindName; 80 | m_BindGameObjects.InsertArrayElementAtIndex(0); 81 | m_BindGameObjects.GetArrayElementAtIndex(0).objectReferenceValue = m_AddBindGameObject; 82 | m_AddBindName = string.Empty; 83 | m_AddBindGameObject = null; 84 | } 85 | 86 | serializedObject.ApplyModifiedProperties(); 87 | } 88 | GUILayout.EndHorizontal(); 89 | 90 | for (int i = 0; i < m_BindNames.arraySize; i++) 91 | { 92 | GUILayout.BeginHorizontal(); 93 | var elementName = m_BindNames.GetArrayElementAtIndex(i); 94 | elementName.stringValue = EditorGUILayout.TextField(elementName.stringValue); 95 | var elementGameObject = m_BindGameObjects.GetArrayElementAtIndex(i); 96 | elementGameObject.objectReferenceValue = EditorGUILayout.ObjectField(elementGameObject.objectReferenceValue, typeof(GameObject), true); 97 | if (GUILayout.Button("-")) 98 | { 99 | m_BindNames.DeleteArrayElementAtIndex(i); 100 | m_BindGameObjects.DeleteArrayElementAtIndex(i); 101 | serializedObject.ApplyModifiedProperties(); 102 | } 103 | GUILayout.EndHorizontal(); 104 | } 105 | 106 | if (GUILayout.Button("Clear GameObject Serialization")) 107 | { 108 | m_BindNames.ClearArray(); 109 | m_BindGameObjects.ClearArray(); 110 | serializedObject.ApplyModifiedProperties(); 111 | } 112 | } 113 | SirenixEditorGUI.EndFadeGroup(); 114 | SirenixEditorGUI.EndBox(); 115 | 116 | if (((ReferenceBindMono)target).CheckBindDataExitEmpty()) 117 | { 118 | SirenixEditorGUI.MessageBox("BindData exist empty.", MessageType.Warning); 119 | } 120 | 121 | SirenixEditorGUI.BeginBox(); 122 | SirenixEditorGUI.BeginBoxHeader(); 123 | string labelAutoText = $"BindData (count:{m_AutoBindComponents.arraySize})"; 124 | m_IsAutoBindFoldout = SirenixEditorGUI.Foldout(m_IsAutoBindFoldout, labelAutoText); 125 | SirenixEditorGUI.EndBoxHeader(); 126 | if (SirenixEditorGUI.BeginFadeGroup(labelAutoText, m_IsAutoBindFoldout)) 127 | { 128 | GUILayout.BeginHorizontal(); 129 | if (GUILayout.Button("Generate Serialization")) 130 | { 131 | ReferenceBinder referenceBinder = new ReferenceBinder((ReferenceBindMono)target, (char)m_SeparatorChar.intValue); 132 | referenceBinder.TrySetSerialization(); 133 | } 134 | if (GUILayout.Button("Clear Serialization")) 135 | { 136 | m_AutoBindComponentNames.ClearArray(); 137 | m_AutoBindComponents.ClearArray(); 138 | } 139 | GUILayout.EndHorizontal(); 140 | 141 | EditorGUI.BeginChangeCheck(); 142 | EditorGUILayout.PropertyField(m_SeparatorChar); 143 | if (EditorGUI.EndChangeCheck()) 144 | { 145 | EditorSetting.SetSaveSeparatorChar((char)m_SeparatorChar.intValue); 146 | } 147 | 148 | EditorGUI.BeginDisabledGroup(true); 149 | { 150 | GUILayout.BeginHorizontal(); 151 | EditorGUILayout.LabelField("Name"); 152 | EditorGUILayout.LabelField("Component"); 153 | GUILayout.EndHorizontal(); 154 | for (int i = 0; i < m_AutoBindComponents.arraySize; i++) 155 | { 156 | GUILayout.BeginHorizontal(); 157 | EditorGUILayout.TextField(m_AutoBindComponentNames.GetArrayElementAtIndex(i).stringValue); 158 | EditorGUILayout.ObjectField(m_AutoBindComponents.GetArrayElementAtIndex(i).objectReferenceValue, typeof (UnityEngine.Object), true); 159 | GUILayout.EndHorizontal(); 160 | } 161 | } 162 | EditorGUI.EndDisabledGroup(); 163 | } 164 | SirenixEditorGUI.EndFadeGroup(); 165 | SirenixEditorGUI.EndBox(); 166 | 167 | if (GUILayout.Button("Clear All Serialization")) 168 | { 169 | m_BindNames.ClearArray(); 170 | m_BindGameObjects.ClearArray(); 171 | m_AutoBindComponentNames.ClearArray(); 172 | m_AutoBindComponents.ClearArray(); 173 | } 174 | } 175 | EditorGUI.EndDisabledGroup(); 176 | 177 | serializedObject.ApplyModifiedProperties(); 178 | } 179 | } 180 | } 181 | -------------------------------------------------------------------------------- /Editor/CodeHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace CodeBind.Editor 6 | { 7 | internal static class CodeHelper 8 | { 9 | internal static string GetMonoBindCodeString(string nameSpace, string className, List bindDatas, SortedDictionary> bindArrayDataDict) 10 | { 11 | StringBuilder stringBuilder = new StringBuilder(); 12 | stringBuilder.AppendLine("// This is automatically generated by CodeBind. Please do not modify it."); 13 | stringBuilder.AppendLine(""); 14 | string indentation = string.Empty; 15 | bool needNameSpace = !string.IsNullOrEmpty(nameSpace); 16 | //命名空间 17 | if (needNameSpace) 18 | { 19 | stringBuilder.AppendLine($"namespace {nameSpace}"); 20 | stringBuilder.AppendLine("{"); 21 | indentation = "\t"; 22 | } 23 | //类名 24 | stringBuilder.AppendLine($"{indentation}public partial class {className}"); 25 | stringBuilder.AppendLine($"{indentation}{{"); 26 | //组件字段 27 | foreach (CodeBindData bindData in bindDatas) 28 | { 29 | stringBuilder.AppendLine($"{indentation}\t[UnityEngine.SerializeField, Sirenix.OdinInspector.FoldoutGroup(\"BindData\"), Sirenix.OdinInspector.ReadOnly]"); 30 | stringBuilder.AppendLine($"{indentation}\tprivate {bindData.BindType.FullName} m_{bindData.BindName}{bindData.BindPrefix};"); 31 | } 32 | stringBuilder.AppendLine(""); 33 | foreach (KeyValuePair> kv in bindArrayDataDict) 34 | { 35 | stringBuilder.AppendLine($"{indentation}\t[UnityEngine.SerializeField, Sirenix.OdinInspector.FoldoutGroup(\"BindData\"), Sirenix.OdinInspector.ReadOnly]"); 36 | stringBuilder.AppendLine($"{indentation}\tprivate {kv.Value[0].BindType.FullName}[] m_{kv.Key}Array;"); 37 | } 38 | stringBuilder.AppendLine(""); 39 | foreach (CodeBindData bindData in bindDatas) 40 | { 41 | stringBuilder.AppendLine($"{indentation}\tpublic {bindData.BindType.FullName} {bindData.BindName}{bindData.BindPrefix} => m_{bindData.BindName}{bindData.BindPrefix};"); 42 | } 43 | stringBuilder.AppendLine(""); 44 | foreach (KeyValuePair> kv in bindArrayDataDict) 45 | { 46 | stringBuilder.AppendLine($"{indentation}\tpublic {kv.Value[0].BindType.FullName}[] {kv.Key}Array => m_{kv.Key}Array;"); 47 | } 48 | stringBuilder.AppendLine(""); 49 | #if STATE_CONTROLLER_CODE_BIND 50 | //StateController 51 | Type stateControllerMonoType = typeof(StateController.StateControllerMono); 52 | if (CodeBindNameTypeCollection.BindTypeNameDict.TryGetValue(stateControllerMonoType, out string prefix)) 53 | { 54 | foreach (CodeBindData bindData in bindDatas) 55 | { 56 | if (bindData.BindType == stateControllerMonoType) 57 | { 58 | var controller = bindData.BindTransform.GetComponent(); 59 | foreach (var data in controller.EditorControllerDatas) 60 | { 61 | stringBuilder.AppendLine($"{indentation}\tprivate StateController.StateControllerData m_{bindData.BindName}{data.Name}StateControllerData;"); 62 | stringBuilder.AppendLine($"{indentation}\tpublic StateController.StateControllerData {bindData.BindName}{data.Name}StateControllerData => m_{bindData.BindName}{data.Name}StateControllerData ??= {bindData.BindName}{bindData.BindPrefix}.GetData(\"{data.Name}\");"); 63 | stringBuilder.AppendLine($"{indentation}\tpublic static class {bindData.BindName}{data.Name}StateName"); 64 | stringBuilder.AppendLine($"{indentation}\t{{"); 65 | foreach (var stateName in data.StateNames) 66 | { 67 | stringBuilder.AppendLine($"{indentation}\t\tpublic const string {stateName} = \"{stateName}\";"); 68 | } 69 | stringBuilder.AppendLine($"{indentation}\t}}"); 70 | stringBuilder.AppendLine($"{indentation}\tpublic static class {bindData.BindName}{data.Name}StateIndex"); 71 | stringBuilder.AppendLine($"{indentation}\t{{"); 72 | for (int index = 0; index < data.StateNames.Count; index++) 73 | { 74 | stringBuilder.AppendLine($"{indentation}\t\tpublic const int {data.StateNames[index]} = {index};"); 75 | } 76 | stringBuilder.AppendLine($"{indentation}\t}}"); 77 | } 78 | stringBuilder.AppendLine(""); 79 | } 80 | } 81 | } 82 | #endif 83 | //CheckBindDataExitEmpty方法 84 | stringBuilder.AppendLine("#if UNITY_EDITOR"); 85 | stringBuilder.AppendLine($"{indentation}\t[Sirenix.OdinInspector.HideLabel, Sirenix.OdinInspector.ReadOnly, Sirenix.OdinInspector.ShowInInspector]"); 86 | stringBuilder.AppendLine($"{indentation}\t[Sirenix.OdinInspector.GUIColor(1f, 0.8f, 0f), Sirenix.OdinInspector.PropertyOrder(-99999)]"); 87 | stringBuilder.AppendLine($"{indentation}\t[Sirenix.OdinInspector.ShowIf(nameof(CheckBindDataExitEmpty))]"); 88 | stringBuilder.AppendLine($"{indentation}\tprivate string BindDataExitEmptyWarning => \"BindData exit empty, please check.\";"); 89 | stringBuilder.AppendLine(""); 90 | stringBuilder.AppendLine($"{indentation}\tprivate bool CheckBindDataExitEmpty()"); 91 | stringBuilder.AppendLine($"{indentation}\t{{"); 92 | foreach (CodeBindData bindData in bindDatas) 93 | { 94 | stringBuilder.AppendLine($"{indentation}\t\tif (this.m_{bindData.BindName}{bindData.BindPrefix} == null) return true;"); 95 | } 96 | foreach (KeyValuePair> kv in bindArrayDataDict) 97 | { 98 | stringBuilder.AppendLine($"{indentation}\t\tif (this.m_{kv.Key}Array == null || this.m_{kv.Key}Array.Length == 0) return true;"); 99 | stringBuilder.AppendLine($"{indentation}\t\tfor (int i = 0; i < this.m_{kv.Key}Array.Length; i++)"); 100 | stringBuilder.AppendLine($"{indentation}\t\t\tif (this.m_{kv.Key}Array[i] == null) return true;"); 101 | } 102 | stringBuilder.AppendLine($"{indentation}\t\treturn false;"); 103 | stringBuilder.AppendLine($"{indentation}\t}}"); 104 | stringBuilder.AppendLine("#endif"); 105 | 106 | stringBuilder.AppendLine($"{indentation}}}"); 107 | if (needNameSpace) 108 | { 109 | stringBuilder.AppendLine("}"); 110 | } 111 | return stringBuilder.ToString(); 112 | } 113 | 114 | internal static string GetCSBindCodeString(string nameSpace, string className, List bindDatas, SortedDictionary> bindArrayDataDict, List bindArrayDatas) 115 | { 116 | StringBuilder stringBuilder = new StringBuilder(); 117 | stringBuilder.AppendLine("// This is automatically generated by CodeBind. Please do not modify it."); 118 | stringBuilder.AppendLine(""); 119 | string indentation = string.Empty; 120 | bool needNameSpace = !string.IsNullOrEmpty(nameSpace); 121 | //命名空间 122 | if (needNameSpace) 123 | { 124 | stringBuilder.AppendLine($"namespace {nameSpace}"); 125 | stringBuilder.AppendLine("{"); 126 | indentation = "\t"; 127 | } 128 | //类名 129 | stringBuilder.AppendLine($"{indentation}public partial class {className} : CodeBind.ICSCodeBind"); 130 | stringBuilder.AppendLine($"{indentation}{{"); 131 | //组件字段 132 | stringBuilder.AppendLine($"{indentation}\tpublic CodeBind.CSCodeBindMono Mono {{ get; private set; }}"); 133 | stringBuilder.AppendLine($"{indentation}\tpublic UnityEngine.Transform Transform {{ get; private set; }}"); 134 | stringBuilder.AppendLine(""); 135 | foreach (CodeBindData bindData in bindDatas) 136 | { 137 | stringBuilder.AppendLine($"{indentation}\tpublic {bindData.BindType.FullName} {bindData.BindName}{bindData.BindPrefix} {{ get; private set; }}"); 138 | } 139 | stringBuilder.AppendLine(""); 140 | foreach (KeyValuePair> kv in bindArrayDataDict) 141 | { 142 | stringBuilder.AppendLine($"{indentation}\tpublic {kv.Value[0].BindType.FullName}[] {kv.Key}Array {{ get; private set; }}"); 143 | } 144 | stringBuilder.AppendLine(""); 145 | #if STATE_CONTROLLER_CODE_BIND 146 | //StateController 147 | Type stateControllerMonoType = typeof(StateController.StateControllerMono); 148 | if (CodeBindNameTypeCollection.BindTypeNameDict.TryGetValue(stateControllerMonoType, out string prefix)) 149 | { 150 | foreach (CodeBindData bindData in bindDatas) 151 | { 152 | if (bindData.BindType == stateControllerMonoType) 153 | { 154 | var controller = bindData.BindTransform.GetComponent(); 155 | foreach (var data in controller.EditorControllerDatas) 156 | { 157 | stringBuilder.AppendLine($"{indentation}\tprivate StateController.StateControllerData m_{bindData.BindName}{data.Name}StateControllerData;"); 158 | stringBuilder.AppendLine($"{indentation}\tpublic StateController.StateControllerData {bindData.BindName}{data.Name}StateControllerData => m_{bindData.BindName}{data.Name}StateControllerData ??= {bindData.BindName}{bindData.BindPrefix}.GetData(\"{data.Name}\");"); 159 | stringBuilder.AppendLine($"{indentation}\tpublic static class {bindData.BindName}{data.Name}StateName"); 160 | stringBuilder.AppendLine($"{indentation}\t{{"); 161 | foreach (var stateName in data.StateNames) 162 | { 163 | stringBuilder.AppendLine($"{indentation}\t\tpublic const string {stateName} = \"{stateName}\";"); 164 | } 165 | stringBuilder.AppendLine($"{indentation}\t}}"); 166 | stringBuilder.AppendLine($"{indentation}\tpublic static class {bindData.BindName}{data.Name}StateIndex"); 167 | stringBuilder.AppendLine($"{indentation}\t{{"); 168 | for (int index = 0; index < data.StateNames.Count; index++) 169 | { 170 | stringBuilder.AppendLine($"{indentation}\t\tpublic const int {data.StateNames[index]} = {index};"); 171 | } 172 | stringBuilder.AppendLine($"{indentation}\t}}"); 173 | } 174 | stringBuilder.AppendLine(""); 175 | } 176 | } 177 | } 178 | #endif 179 | //InitBind方法 180 | stringBuilder.AppendLine($"{indentation}\tpublic void InitBind(CodeBind.CSCodeBindMono mono)"); 181 | stringBuilder.AppendLine($"{indentation}\t{{"); 182 | stringBuilder.AppendLine($"{indentation}\t\tMono = mono;"); 183 | stringBuilder.AppendLine($"{indentation}\t\tTransform = mono.transform;"); 184 | for (int i = 0; i < bindDatas.Count; i++) 185 | { 186 | CodeBindData bindData = bindDatas[i]; 187 | stringBuilder.AppendLine($"{indentation}\t\t{bindData.BindName}{bindData.BindPrefix} = Mono.BindComponents[{i}] as {bindData.BindType.FullName};"); 188 | } 189 | foreach (KeyValuePair> kv in bindArrayDataDict) 190 | { 191 | stringBuilder.AppendLine($"{indentation}\t\t{kv.Key}Array = new {kv.Value[0].BindType.FullName}[{kv.Value.Count}]"); 192 | stringBuilder.AppendLine($"{indentation}\t\t{{"); 193 | for (int i = 0; i < kv.Value.Count; i++) 194 | { 195 | CodeBindData bindData = kv.Value[i]; 196 | stringBuilder.AppendLine($"{indentation}\t\t\tMono.BindComponents[{bindArrayDatas.IndexOf(bindData) + bindDatas.Count}] as {bindData.BindType.FullName},"); 197 | } 198 | stringBuilder.AppendLine($"{indentation}\t\t}};"); 199 | } 200 | stringBuilder.AppendLine($"{indentation}\t}}"); 201 | //Clear方法 202 | stringBuilder.AppendLine(""); 203 | stringBuilder.AppendLine($"{indentation}\tpublic void ClearBind()"); 204 | stringBuilder.AppendLine($"{indentation}\t{{"); 205 | stringBuilder.AppendLine($"{indentation}\t\tMono = null;"); 206 | stringBuilder.AppendLine($"{indentation}\t\tTransform = null;"); 207 | for (int i = 0; i < bindDatas.Count; i++) 208 | { 209 | CodeBindData bindData = bindDatas[i]; 210 | stringBuilder.AppendLine($"{indentation}\t\t{bindData.BindName}{bindData.BindPrefix} = null;"); 211 | } 212 | foreach (KeyValuePair> kv in bindArrayDataDict) 213 | { 214 | stringBuilder.AppendLine($"{indentation}\t\t{kv.Key}Array = null;"); 215 | } 216 | stringBuilder.AppendLine($"{indentation}\t}}"); 217 | 218 | stringBuilder.AppendLine($"{indentation}}}"); 219 | if (needNameSpace) 220 | { 221 | stringBuilder.AppendLine("}"); 222 | } 223 | return stringBuilder.ToString(); 224 | } 225 | } 226 | } 227 | -------------------------------------------------------------------------------- /Editor/BaseBinder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text.RegularExpressions; 5 | using UnityEditor; 6 | using UnityEngine; 7 | 8 | namespace CodeBind.Editor 9 | { 10 | /// 11 | /// 基础绑定器 12 | /// 13 | internal abstract class BaseBinder 14 | { 15 | protected readonly char m_SeparatorChar; 16 | protected readonly Transform m_RootTransform; 17 | protected readonly List m_BindDatas; 18 | protected readonly List m_BindArrayDatas; 19 | protected readonly SortedDictionary> m_BindArrayDataDict; 20 | 21 | private readonly Regex m_ArrayIndexRegex; 22 | private readonly Regex m_VariableNameRegex; 23 | private readonly List m_ComponentCacheList; 24 | 25 | protected BaseBinder(Transform rootTransform, char separatorChar) 26 | { 27 | m_RootTransform = rootTransform; 28 | m_BindDatas = new List(); 29 | m_BindArrayDatas = new List(); 30 | m_BindArrayDataDict = new SortedDictionary>(); 31 | m_SeparatorChar = separatorChar; 32 | m_ArrayIndexRegex = new Regex(@"\(-?\d*\)$"); 33 | m_VariableNameRegex = new Regex(@"^([A-Za-z0-9\._-]+/)*[A-Za-z0-9\._-]+$"); 34 | m_ComponentCacheList = new List(); 35 | } 36 | 37 | protected bool TryGenerateNameMapTypeData() 38 | { 39 | bool TryGetBindDatas(Transform child, string[] strArray, ref List bindDatas) 40 | { 41 | m_ComponentCacheList.Clear(); 42 | child.GetComponents(m_ComponentCacheList); 43 | string bindName = strArray[0]; 44 | for (int i = 1; i < strArray.Length; i++) 45 | { 46 | string typeStr = strArray[i]; 47 | if (string.Equals(typeStr, "*", StringComparison.OrdinalIgnoreCase)) 48 | { 49 | //自动补齐所有存在的脚本,如果存在继承关系的保留子类即可 50 | Type bindType = typeof(GameObject); 51 | if (CodeBindNameTypeCollection.BindTypeNameDict.TryGetValue(bindType, out var bindPrefix)) 52 | { 53 | CodeBindData bindData = new CodeBindData(bindName, bindType, bindPrefix, child); 54 | bindDatas.Add(bindData); 55 | } 56 | foreach (var component in m_ComponentCacheList) 57 | { 58 | bindType = component.GetType(); 59 | //有继承关系的脚本,脚本部分重名,先判断有没有直接能匹配的 60 | if (CodeBindNameTypeCollection.BindTypeNameDict.TryGetValue(bindType, out bindPrefix)) 61 | { 62 | CodeBindData bindData = new CodeBindData(bindName, bindType, bindPrefix, child); 63 | bindDatas.Add(bindData); 64 | } 65 | else 66 | { 67 | //没有直接匹配,可以找父类可以绑定的 68 | foreach (var kv in CodeBindNameTypeCollection.BindNameTypeDict) 69 | { 70 | if (bindType.IsSubclassOf(kv.Value) && TryGetBindTarget(child, kv.Value, out _)) 71 | { 72 | CodeBindData bindData = new CodeBindData(bindName, kv.Value, kv.Key, child); 73 | bindDatas.Add(bindData); 74 | break; 75 | } 76 | } 77 | } 78 | } 79 | } 80 | else if (CodeBindNameTypeCollection.BindNameTypeDict.TryGetValue(typeStr, out Type type) && TryGetBindTarget(child, type, out _)) 81 | { 82 | CodeBindData bindData = new CodeBindData(bindName, type, typeStr, child); 83 | bindDatas.Add(bindData); 84 | } 85 | else 86 | { 87 | throw new Exception($"{child.name}的命名中{typeStr}不存在对应的组件类型,绑定失败!"); 88 | } 89 | } 90 | m_ComponentCacheList.Clear(); 91 | if (bindDatas.Count <= 0) 92 | { 93 | throw new Exception("获取的Bind对象个数为0,绑定失败!"); 94 | } 95 | return true; 96 | } 97 | 98 | bool TryGetBindComponents(Transform child, out List bindDatas) 99 | { 100 | bindDatas = new List(); 101 | string[] strArray = child.name.Split(m_SeparatorChar); 102 | string lastStr = strArray[^1]; 103 | MatchCollection matchCollection = m_ArrayIndexRegex.Matches(lastStr); 104 | if (matchCollection.Count > 0) 105 | { 106 | return false; 107 | } 108 | if (!TryGetBindDatas(child, strArray, ref bindDatas)) 109 | { 110 | return false; 111 | } 112 | return true; 113 | } 114 | 115 | bool TryGetBindArrayComponents(Transform child, out List bindDatas) 116 | { 117 | bindDatas = new List(); 118 | string[] strArray = child.name.Split(m_SeparatorChar); 119 | string lastStr = strArray[^1]; 120 | MatchCollection matchCollection = m_ArrayIndexRegex.Matches(lastStr); 121 | if (matchCollection.Count < 1) 122 | { 123 | return false; 124 | } 125 | for (int i = 0; i < matchCollection.Count; i++) 126 | { 127 | lastStr = lastStr.Replace(matchCollection[i].Value, string.Empty); 128 | } 129 | strArray[^1] = lastStr.Replace(" ", string.Empty); 130 | if (!TryGetBindDatas(child, strArray, ref bindDatas)) 131 | { 132 | return false; 133 | } 134 | return true; 135 | } 136 | 137 | m_BindDatas.Clear(); 138 | m_BindArrayDatas.Clear(); 139 | m_BindArrayDataDict.Clear(); 140 | #if STATE_CONTROLLER_CODE_BIND 141 | if (!m_RootTransform.name.Contains(m_SeparatorChar)) 142 | { 143 | //如果根节点有StateControllerMono,生成Root 144 | Type scmType = typeof(StateController.StateControllerMono); 145 | if (CodeBindNameTypeCollection.BindTypeNameDict.TryGetValue(scmType, out var bindPrefix)) 146 | { 147 | StateController.StateControllerMono scm = m_RootTransform.GetComponent(); 148 | if (scm != null) 149 | { 150 | CodeBindData bindData = new CodeBindData("Root", scmType, bindPrefix, m_RootTransform); 151 | m_BindDatas.Add(bindData); 152 | } 153 | } 154 | } 155 | #endif 156 | foreach (Transform child in m_RootTransform.GetComponentsInChildren(true)) 157 | { 158 | if (child == m_RootTransform || !child.name.Contains(m_SeparatorChar) || CheckIsInOtherBind(child)) 159 | { 160 | continue; 161 | } 162 | if (TryGetBindComponents(child, out List bindDatas)) 163 | { 164 | foreach (CodeBindData bindData in bindDatas) 165 | { 166 | if (m_BindDatas.Find(data => data.BindName == bindData.BindName && data.BindPrefix == bindData.BindPrefix) != null) 167 | { 168 | m_BindDatas.Clear(); 169 | throw new Exception($"绑定对象中存在同名[{bindData.BindName}]-[{bindData.BindPrefix}]-[{bindData.BindTransform}],请修改后重新生成。"); 170 | } 171 | m_BindDatas.Add(bindData); 172 | } 173 | } 174 | if (TryGetBindArrayComponents(child, out List bindArrayDatas)) 175 | { 176 | foreach (CodeBindData bindData in bindArrayDatas) 177 | { 178 | if (m_BindArrayDatas.Find(data => data.BindName == bindData.BindName && data.BindPrefix == bindData.BindPrefix && data.BindTransform == bindData.BindTransform) != null) 179 | { 180 | m_BindArrayDatas.Clear(); 181 | throw new Exception($"绑定数组对象中存在重复[{bindData.BindName}]-[{bindData.BindPrefix}]-[{bindData.BindTransform}],请修改后重新生成。"); 182 | } 183 | m_BindArrayDatas.Add(bindData); 184 | } 185 | } 186 | } 187 | if (m_BindDatas.Count < 1 && m_BindArrayDatas.Count < 1) 188 | { 189 | throw new Exception("绑定数量为0,生成失败。"); 190 | } 191 | for (int i = 0; i < m_BindArrayDatas.Count - 1; i++) 192 | { 193 | CodeBindData firstBindData = m_BindArrayDatas[i]; 194 | string arrayName = firstBindData.BindName + firstBindData.BindPrefix; 195 | if (m_BindArrayDataDict.TryGetValue(arrayName, out List bindDatas)) 196 | { 197 | continue; 198 | } 199 | bindDatas = new List() { firstBindData }; 200 | m_BindArrayDataDict.Add(arrayName, bindDatas); 201 | for (int j = i + 1; j < m_BindArrayDatas.Count; j++) 202 | { 203 | CodeBindData bindData = m_BindArrayDatas[j]; 204 | if (!string.Equals(bindData.BindName + bindData.BindPrefix, arrayName, StringComparison.Ordinal)) 205 | { 206 | continue; 207 | } 208 | bindDatas.Add(bindData); 209 | } 210 | } 211 | //进行排序,保证不同名字相同节点顺序不同的预制可以公用绑定脚本 212 | m_BindDatas.Sort(); 213 | return true; 214 | } 215 | 216 | protected void AutoFixChildBindName() 217 | { 218 | DoCheck(); 219 | Dictionary transformNameDict = new Dictionary(); 220 | Dictionary> arrayTransformDict = new Dictionary>(); 221 | foreach (Transform child in m_RootTransform.GetComponentsInChildren(true)) 222 | { 223 | if (child == m_RootTransform || !child.name.Contains(m_SeparatorChar) || CheckIsInOtherBind(child)) 224 | { 225 | continue; 226 | } 227 | List strList = child.name.Split(m_SeparatorChar).ToList(); 228 | if(string.IsNullOrEmpty(strList[0])) 229 | { 230 | throw new Exception($"变量名为空:{child.name}"); 231 | } 232 | if (!m_VariableNameRegex.IsMatch(strList[0])) 233 | { 234 | throw new Exception($"{child.name}的变量名格式不对:{strList[0]}"); 235 | } 236 | //(xxx)结尾的识别为数组,方便复制 237 | string lastStr = strList[^1]; 238 | MatchCollection matchCollection = m_ArrayIndexRegex.Matches(lastStr); 239 | if (matchCollection.Count > 0) 240 | { 241 | if (arrayTransformDict.TryGetValue(strList[0], out List transforms)) 242 | { 243 | transforms.Add(child); 244 | } 245 | else 246 | { 247 | arrayTransformDict[strList[0]] = new List() { child }; 248 | } 249 | for (int i = 0; i < matchCollection.Count; i++) 250 | { 251 | lastStr = lastStr.Replace(matchCollection[i].Value, string.Empty); 252 | } 253 | strList[^1] = lastStr.Replace(" ", string.Empty); 254 | } 255 | bool hasAll = false; 256 | for (int i = 1; i < strList.Count; i++) 257 | { 258 | if (string.IsNullOrEmpty(strList[i])) 259 | { 260 | throw new Exception($"不支持自动补齐名字为空的脚本:{child.name}"); 261 | } 262 | if (string.Equals(strList[1], "*", StringComparison.OrdinalIgnoreCase)) 263 | { 264 | hasAll = true; 265 | } 266 | } 267 | if (hasAll) 268 | { 269 | strList = new List 270 | { 271 | strList[0], 272 | "*" 273 | }; 274 | } 275 | else 276 | { 277 | m_ComponentCacheList.Clear(); 278 | child.GetComponents(m_ComponentCacheList); 279 | //自动补齐名字残缺的 280 | for (int i = 1; i < strList.Count; i++) 281 | { 282 | string typeStr = strList[i]; 283 | //有的命名会有局部重复,这里如果脚本存在了就不参加模糊匹配 284 | if (CodeBindNameTypeCollection.BindNameTypeDict.TryGetValue(typeStr, out var comType) && TryGetBindTarget(child, comType, out _)) 285 | { 286 | continue; 287 | } 288 | Type bindType = typeof(GameObject); 289 | if (CodeBindNameTypeCollection.BindTypeNameDict.TryGetValue(bindType, out var bindPrefix) && 290 | (bindPrefix.Contains(typeStr, StringComparison.OrdinalIgnoreCase) || typeStr.Contains(bindPrefix, StringComparison.OrdinalIgnoreCase))) 291 | { 292 | strList[i] = bindPrefix; 293 | continue; 294 | } 295 | //有继承关系的脚本,脚本部分重名,先判断有没有直接能匹配的 296 | bool isContinue = false; 297 | foreach (var component in m_ComponentCacheList) 298 | { 299 | bindType = component.GetType(); 300 | if (CodeBindNameTypeCollection.BindTypeNameDict.TryGetValue(bindType, out bindPrefix) && 301 | (bindPrefix.Contains(typeStr, StringComparison.OrdinalIgnoreCase) || typeStr.Contains(bindPrefix, StringComparison.OrdinalIgnoreCase))) 302 | { 303 | strList[i] = bindPrefix; 304 | isContinue = true; 305 | break; 306 | } 307 | } 308 | if (isContinue) 309 | { 310 | continue; 311 | } 312 | //有继承关系的脚本,可以找到父类节点绑定 313 | foreach (var kv in CodeBindNameTypeCollection.BindNameTypeDict) 314 | { 315 | if ((kv.Key.Contains(typeStr, StringComparison.OrdinalIgnoreCase) || typeStr.Contains(kv.Key, StringComparison.OrdinalIgnoreCase)) && TryGetBindTarget(child, kv.Value, out _)) 316 | { 317 | strList[i] = kv.Key; 318 | break; 319 | } 320 | } 321 | } 322 | m_ComponentCacheList.Clear(); 323 | } 324 | for (int i = 1; i < strList.Count - 1; i++) 325 | { 326 | for (int j = i + 1; j < strList.Count; j++) 327 | { 328 | if (string.Equals(strList[i], strList[j], StringComparison.OrdinalIgnoreCase)) 329 | { 330 | throw new Exception($"Child:{child} component name is repeated or auto fix repeated!"); 331 | } 332 | } 333 | } 334 | transformNameDict.Add(child, string.Join(m_SeparatorChar, strList)); 335 | } 336 | //处理Array 337 | foreach (KeyValuePair> kv in arrayTransformDict) 338 | { 339 | if (kv.Value.Count < 2) 340 | { 341 | continue; 342 | } 343 | Transform first = kv.Value[0]; 344 | string firstName = transformNameDict[first]; 345 | for (int i = 1; i < kv.Value.Count; i++) 346 | { 347 | if (transformNameDict[kv.Value[i]] != firstName) 348 | { 349 | throw new Exception($"Child:{kv.Value[i]} has different component ({transformNameDict[kv.Value[i]]}:{firstName}) in array!"); 350 | } 351 | } 352 | transformNameDict[first] = $"{firstName} ({0})"; 353 | for (int i = 1; i < kv.Value.Count; i++) 354 | { 355 | string name = transformNameDict[kv.Value[i]]; 356 | transformNameDict[kv.Value[i]] = $"{name} ({i})"; 357 | } 358 | } 359 | 360 | foreach (KeyValuePair kv in transformNameDict) 361 | { 362 | kv.Key.name = kv.Value; 363 | } 364 | } 365 | 366 | protected bool TryGetBindTarget(Transform transform, Type type, out UnityEngine.Object target) 367 | { 368 | if (type == typeof(GameObject)) 369 | { 370 | target = transform.gameObject; 371 | return true; 372 | } 373 | target = transform.GetComponent(type); 374 | return target != null; 375 | } 376 | 377 | private bool CheckIsInOtherBind(Transform transform) 378 | { 379 | transform = transform.parent; 380 | //检查父节点有没有bind,支持bind嵌套 381 | bool nearestCodeBind = true; 382 | while (transform != null) 383 | { 384 | //子节点可以绑定,创建代码类型不需要判断特性 385 | if(transform == m_RootTransform) 386 | { 387 | return false; 388 | } 389 | MonoBehaviour[] components = transform.GetComponents(); 390 | foreach (MonoBehaviour component in components) 391 | { 392 | if (component.GetType().GetCustomAttributes(typeof(CodeBindAttribute), true).Length > 0) 393 | { 394 | if (nearestCodeBind && transform == m_RootTransform) 395 | { 396 | return false; 397 | } 398 | if (transform != m_RootTransform) 399 | { 400 | return true; 401 | } 402 | nearestCodeBind = false; 403 | } 404 | } 405 | transform = transform.parent; 406 | } 407 | return false; 408 | } 409 | 410 | public void TrySetSerialization() 411 | { 412 | CodeBindNameTypeCollection.Do(); 413 | AutoFixChildBindName(); 414 | if (!TryGenerateNameMapTypeData()) 415 | { 416 | return; 417 | } 418 | SetSerialization(); 419 | EditorUtility.SetDirty(m_RootTransform); 420 | AssetDatabase.SaveAssets(); 421 | AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate); 422 | } 423 | 424 | private void DoCheck() 425 | { 426 | foreach (var bindPrefix in CodeBindNameTypeCollection.BindNameTypeDict.Keys) 427 | { 428 | if (bindPrefix.Contains(m_SeparatorChar, StringComparison.OrdinalIgnoreCase)) 429 | { 430 | throw new Exception($"绑定名[{bindPrefix}]中不能含有分隔符[{m_SeparatorChar}]。"); 431 | } 432 | } 433 | } 434 | 435 | protected abstract void SetSerialization(); 436 | } 437 | } -------------------------------------------------------------------------------- /Samples~/Demo/CodeBindDemo.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.37322453, g: 0.38088855, b: 0.35889676, 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 &44103782 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: 44103783} 135 | - component: {fileID: 44103784} 136 | m_Layer: 0 137 | m_Name: Test_Transform_Animator (1) 138 | m_TagString: Untagged 139 | m_Icon: {fileID: 0} 140 | m_NavMeshLayer: 0 141 | m_StaticEditorFlags: 0 142 | m_IsActive: 1 143 | --- !u!4 &44103783 144 | Transform: 145 | m_ObjectHideFlags: 0 146 | m_CorrespondingSourceObject: {fileID: 0} 147 | m_PrefabInstance: {fileID: 0} 148 | m_PrefabAsset: {fileID: 0} 149 | m_GameObject: {fileID: 44103782} 150 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 151 | m_LocalPosition: {x: 0, y: 0, z: 0} 152 | m_LocalScale: {x: 1, y: 1, z: 1} 153 | m_ConstrainProportionsScale: 0 154 | m_Children: [] 155 | m_Father: {fileID: 727083143} 156 | m_RootOrder: 2 157 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 158 | --- !u!95 &44103784 159 | Animator: 160 | serializedVersion: 4 161 | m_ObjectHideFlags: 0 162 | m_CorrespondingSourceObject: {fileID: 0} 163 | m_PrefabInstance: {fileID: 0} 164 | m_PrefabAsset: {fileID: 0} 165 | m_GameObject: {fileID: 44103782} 166 | m_Enabled: 1 167 | m_Avatar: {fileID: 0} 168 | m_Controller: {fileID: 0} 169 | m_CullingMode: 0 170 | m_UpdateMode: 0 171 | m_ApplyRootMotion: 0 172 | m_LinearVelocityBlending: 0 173 | m_StabilizeFeet: 0 174 | m_WarningMessage: 175 | m_HasTransformHierarchy: 1 176 | m_AllowConstantClipSamplingOptimization: 1 177 | m_KeepAnimatorControllerStateOnDisable: 0 178 | --- !u!1 &253148093 179 | GameObject: 180 | m_ObjectHideFlags: 0 181 | m_CorrespondingSourceObject: {fileID: 0} 182 | m_PrefabInstance: {fileID: 0} 183 | m_PrefabAsset: {fileID: 0} 184 | serializedVersion: 6 185 | m_Component: 186 | - component: {fileID: 253148094} 187 | - component: {fileID: 253148096} 188 | - component: {fileID: 253148095} 189 | m_Layer: 0 190 | m_Name: Test_CSCodeBindMono_ReferenceBindMono 191 | m_TagString: Untagged 192 | m_Icon: {fileID: 0} 193 | m_NavMeshLayer: 0 194 | m_StaticEditorFlags: 0 195 | m_IsActive: 1 196 | --- !u!4 &253148094 197 | Transform: 198 | m_ObjectHideFlags: 0 199 | m_CorrespondingSourceObject: {fileID: 0} 200 | m_PrefabInstance: {fileID: 0} 201 | m_PrefabAsset: {fileID: 0} 202 | m_GameObject: {fileID: 253148093} 203 | m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} 204 | m_LocalPosition: {x: 0, y: 0, z: 0} 205 | m_LocalScale: {x: 1, y: 1, z: 1} 206 | m_ConstrainProportionsScale: 0 207 | m_Children: 208 | - {fileID: 1279417644} 209 | m_Father: {fileID: 727083143} 210 | m_RootOrder: 12 211 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 212 | --- !u!114 &253148095 213 | MonoBehaviour: 214 | m_ObjectHideFlags: 0 215 | m_CorrespondingSourceObject: {fileID: 0} 216 | m_PrefabInstance: {fileID: 0} 217 | m_PrefabAsset: {fileID: 0} 218 | m_GameObject: {fileID: 253148093} 219 | m_Enabled: 1 220 | m_EditorHideFlags: 0 221 | m_Script: {fileID: 11500000, guid: 804d393d1d453f5448cd493372e9a1a2, type: 3} 222 | m_Name: 223 | m_EditorClassIdentifier: 224 | m_BindNames: 225 | - TestPrefab 226 | m_BindGameObjects: 227 | - {fileID: 1163687246830712436, guid: 1bbd5ed9be130da43b3a37ae9bc5ff20, type: 3} 228 | m_AutoBindComponentNames: 229 | - SelfTransform 230 | - OtherAnimation 231 | - ListAnimationArray 232 | - ListAnimationArray 233 | - ListAnimationArray 234 | - ListAnimationArray 235 | m_AutoBindComponents: 236 | - {fileID: 1279417644} 237 | - {fileID: 517383984} 238 | - {fileID: 1640880387} 239 | - {fileID: 746566296} 240 | - {fileID: 1215201790} 241 | - {fileID: 1262308068} 242 | m_SeparatorChar: 95 243 | --- !u!114 &253148096 244 | MonoBehaviour: 245 | m_ObjectHideFlags: 0 246 | m_CorrespondingSourceObject: {fileID: 0} 247 | m_PrefabInstance: {fileID: 0} 248 | m_PrefabAsset: {fileID: 0} 249 | m_GameObject: {fileID: 253148093} 250 | m_Enabled: 1 251 | m_EditorHideFlags: 0 252 | m_Script: {fileID: 11500000, guid: 5452a0c3619826c4f889a047605eef79, type: 3} 253 | m_Name: 254 | m_EditorClassIdentifier: 255 | m_BindComponents: 256 | - {fileID: 1279417644} 257 | - {fileID: 517383984} 258 | - {fileID: 1640880387} 259 | - {fileID: 746566296} 260 | - {fileID: 1215201790} 261 | - {fileID: 1262308068} 262 | m_SeparatorChar: 95 263 | m_BindScript: {fileID: 11500000, guid: af79efec0e6b8e44f8f95a0516e9784a, type: 3} 264 | m_BindComponentNames: 265 | - SelfTransform 266 | - OtherAnimation 267 | - ListAnimationArray 268 | - ListAnimationArray 269 | - ListAnimationArray 270 | - ListAnimationArray 271 | --- !u!1 &285049429 272 | GameObject: 273 | m_ObjectHideFlags: 0 274 | m_CorrespondingSourceObject: {fileID: 0} 275 | m_PrefabInstance: {fileID: 0} 276 | m_PrefabAsset: {fileID: 0} 277 | serializedVersion: 6 278 | m_Component: 279 | - component: {fileID: 285049430} 280 | - component: {fileID: 285049431} 281 | m_Layer: 0 282 | m_Name: Test2_* 283 | m_TagString: Untagged 284 | m_Icon: {fileID: 0} 285 | m_NavMeshLayer: 0 286 | m_StaticEditorFlags: 0 287 | m_IsActive: 1 288 | --- !u!4 &285049430 289 | Transform: 290 | m_ObjectHideFlags: 0 291 | m_CorrespondingSourceObject: {fileID: 0} 292 | m_PrefabInstance: {fileID: 0} 293 | m_PrefabAsset: {fileID: 0} 294 | m_GameObject: {fileID: 285049429} 295 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 296 | m_LocalPosition: {x: 0, y: 0, z: 0} 297 | m_LocalScale: {x: 1, y: 1, z: 1} 298 | m_ConstrainProportionsScale: 0 299 | m_Children: [] 300 | m_Father: {fileID: 727083143} 301 | m_RootOrder: 6 302 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 303 | --- !u!95 &285049431 304 | Animator: 305 | serializedVersion: 4 306 | m_ObjectHideFlags: 0 307 | m_CorrespondingSourceObject: {fileID: 0} 308 | m_PrefabInstance: {fileID: 0} 309 | m_PrefabAsset: {fileID: 0} 310 | m_GameObject: {fileID: 285049429} 311 | m_Enabled: 1 312 | m_Avatar: {fileID: 0} 313 | m_Controller: {fileID: 0} 314 | m_CullingMode: 0 315 | m_UpdateMode: 0 316 | m_ApplyRootMotion: 0 317 | m_LinearVelocityBlending: 0 318 | m_StabilizeFeet: 0 319 | m_WarningMessage: 320 | m_HasTransformHierarchy: 1 321 | m_AllowConstantClipSamplingOptimization: 1 322 | m_KeepAnimatorControllerStateOnDisable: 0 323 | --- !u!1 &288023355 324 | GameObject: 325 | m_ObjectHideFlags: 0 326 | m_CorrespondingSourceObject: {fileID: 0} 327 | m_PrefabInstance: {fileID: 0} 328 | m_PrefabAsset: {fileID: 0} 329 | serializedVersion: 6 330 | m_Component: 331 | - component: {fileID: 288023356} 332 | m_Layer: 5 333 | m_Name: Handle Slide Area 334 | m_TagString: Untagged 335 | m_Icon: {fileID: 0} 336 | m_NavMeshLayer: 0 337 | m_StaticEditorFlags: 0 338 | m_IsActive: 1 339 | --- !u!224 &288023356 340 | RectTransform: 341 | m_ObjectHideFlags: 0 342 | m_CorrespondingSourceObject: {fileID: 0} 343 | m_PrefabInstance: {fileID: 0} 344 | m_PrefabAsset: {fileID: 0} 345 | m_GameObject: {fileID: 288023355} 346 | m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} 347 | m_LocalPosition: {x: 0, y: 0, z: 0} 348 | m_LocalScale: {x: 1, y: 1, z: 1} 349 | m_ConstrainProportionsScale: 0 350 | m_Children: 351 | - {fileID: 932792623} 352 | m_Father: {fileID: 2095429737} 353 | m_RootOrder: 2 354 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 355 | m_AnchorMin: {x: 0, y: 0} 356 | m_AnchorMax: {x: 1, y: 1} 357 | m_AnchoredPosition: {x: 0, y: 0} 358 | m_SizeDelta: {x: -20, y: 0} 359 | m_Pivot: {x: 0.5, y: 0.5} 360 | --- !u!1 &313808035 361 | GameObject: 362 | m_ObjectHideFlags: 0 363 | m_CorrespondingSourceObject: {fileID: 0} 364 | m_PrefabInstance: {fileID: 0} 365 | m_PrefabAsset: {fileID: 0} 366 | serializedVersion: 6 367 | m_Component: 368 | - component: {fileID: 313808036} 369 | m_Layer: 5 370 | m_Name: Fill Area 371 | m_TagString: Untagged 372 | m_Icon: {fileID: 0} 373 | m_NavMeshLayer: 0 374 | m_StaticEditorFlags: 0 375 | m_IsActive: 1 376 | --- !u!224 &313808036 377 | RectTransform: 378 | m_ObjectHideFlags: 0 379 | m_CorrespondingSourceObject: {fileID: 0} 380 | m_PrefabInstance: {fileID: 0} 381 | m_PrefabAsset: {fileID: 0} 382 | m_GameObject: {fileID: 313808035} 383 | m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} 384 | m_LocalPosition: {x: 0, y: 0, z: 0} 385 | m_LocalScale: {x: 1, y: 1, z: 1} 386 | m_ConstrainProportionsScale: 0 387 | m_Children: 388 | - {fileID: 468142595} 389 | m_Father: {fileID: 1799480873} 390 | m_RootOrder: 1 391 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 392 | m_AnchorMin: {x: 0, y: 0.25} 393 | m_AnchorMax: {x: 1, y: 0.75} 394 | m_AnchoredPosition: {x: -5, y: 0} 395 | m_SizeDelta: {x: -20, y: 0} 396 | m_Pivot: {x: 0.5, y: 0.5} 397 | --- !u!1 &459711675 398 | GameObject: 399 | m_ObjectHideFlags: 0 400 | m_CorrespondingSourceObject: {fileID: 0} 401 | m_PrefabInstance: {fileID: 0} 402 | m_PrefabAsset: {fileID: 0} 403 | serializedVersion: 6 404 | m_Component: 405 | - component: {fileID: 459711676} 406 | - component: {fileID: 459711677} 407 | m_Layer: 0 408 | m_Name: Test2_* (1) 409 | m_TagString: Untagged 410 | m_Icon: {fileID: 0} 411 | m_NavMeshLayer: 0 412 | m_StaticEditorFlags: 0 413 | m_IsActive: 1 414 | --- !u!4 &459711676 415 | Transform: 416 | m_ObjectHideFlags: 0 417 | m_CorrespondingSourceObject: {fileID: 0} 418 | m_PrefabInstance: {fileID: 0} 419 | m_PrefabAsset: {fileID: 0} 420 | m_GameObject: {fileID: 459711675} 421 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 422 | m_LocalPosition: {x: 0, y: 0, z: 0} 423 | m_LocalScale: {x: 1, y: 1, z: 1} 424 | m_ConstrainProportionsScale: 0 425 | m_Children: [] 426 | m_Father: {fileID: 727083143} 427 | m_RootOrder: 8 428 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 429 | --- !u!95 &459711677 430 | Animator: 431 | serializedVersion: 4 432 | m_ObjectHideFlags: 0 433 | m_CorrespondingSourceObject: {fileID: 0} 434 | m_PrefabInstance: {fileID: 0} 435 | m_PrefabAsset: {fileID: 0} 436 | m_GameObject: {fileID: 459711675} 437 | m_Enabled: 1 438 | m_Avatar: {fileID: 0} 439 | m_Controller: {fileID: 0} 440 | m_CullingMode: 0 441 | m_UpdateMode: 0 442 | m_ApplyRootMotion: 0 443 | m_LinearVelocityBlending: 0 444 | m_StabilizeFeet: 0 445 | m_WarningMessage: 446 | m_HasTransformHierarchy: 1 447 | m_AllowConstantClipSamplingOptimization: 1 448 | m_KeepAnimatorControllerStateOnDisable: 0 449 | --- !u!1 &468142594 450 | GameObject: 451 | m_ObjectHideFlags: 0 452 | m_CorrespondingSourceObject: {fileID: 0} 453 | m_PrefabInstance: {fileID: 0} 454 | m_PrefabAsset: {fileID: 0} 455 | serializedVersion: 6 456 | m_Component: 457 | - component: {fileID: 468142595} 458 | - component: {fileID: 468142597} 459 | - component: {fileID: 468142596} 460 | m_Layer: 5 461 | m_Name: Fill 462 | m_TagString: Untagged 463 | m_Icon: {fileID: 0} 464 | m_NavMeshLayer: 0 465 | m_StaticEditorFlags: 0 466 | m_IsActive: 1 467 | --- !u!224 &468142595 468 | RectTransform: 469 | m_ObjectHideFlags: 0 470 | m_CorrespondingSourceObject: {fileID: 0} 471 | m_PrefabInstance: {fileID: 0} 472 | m_PrefabAsset: {fileID: 0} 473 | m_GameObject: {fileID: 468142594} 474 | m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} 475 | m_LocalPosition: {x: 0, y: 0, z: 0} 476 | m_LocalScale: {x: 1, y: 1, z: 1} 477 | m_ConstrainProportionsScale: 0 478 | m_Children: [] 479 | m_Father: {fileID: 313808036} 480 | m_RootOrder: 0 481 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 482 | m_AnchorMin: {x: 0, y: 0} 483 | m_AnchorMax: {x: 0, y: 0} 484 | m_AnchoredPosition: {x: 0, y: 0} 485 | m_SizeDelta: {x: 10, y: 0} 486 | m_Pivot: {x: 0.5, y: 0.5} 487 | --- !u!114 &468142596 488 | MonoBehaviour: 489 | m_ObjectHideFlags: 0 490 | m_CorrespondingSourceObject: {fileID: 0} 491 | m_PrefabInstance: {fileID: 0} 492 | m_PrefabAsset: {fileID: 0} 493 | m_GameObject: {fileID: 468142594} 494 | m_Enabled: 1 495 | m_EditorHideFlags: 0 496 | m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} 497 | m_Name: 498 | m_EditorClassIdentifier: 499 | m_Material: {fileID: 0} 500 | m_Color: {r: 1, g: 1, b: 1, a: 1} 501 | m_RaycastTarget: 1 502 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 503 | m_Maskable: 1 504 | m_OnCullStateChanged: 505 | m_PersistentCalls: 506 | m_Calls: [] 507 | m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} 508 | m_Type: 1 509 | m_PreserveAspect: 0 510 | m_FillCenter: 1 511 | m_FillMethod: 4 512 | m_FillAmount: 1 513 | m_FillClockwise: 1 514 | m_FillOrigin: 0 515 | m_UseSpriteMesh: 0 516 | m_PixelsPerUnitMultiplier: 1 517 | --- !u!222 &468142597 518 | CanvasRenderer: 519 | m_ObjectHideFlags: 0 520 | m_CorrespondingSourceObject: {fileID: 0} 521 | m_PrefabInstance: {fileID: 0} 522 | m_PrefabAsset: {fileID: 0} 523 | m_GameObject: {fileID: 468142594} 524 | m_CullTransparentMesh: 1 525 | --- !u!1 &517383982 526 | GameObject: 527 | m_ObjectHideFlags: 0 528 | m_CorrespondingSourceObject: {fileID: 0} 529 | m_PrefabInstance: {fileID: 0} 530 | m_PrefabAsset: {fileID: 0} 531 | serializedVersion: 6 532 | m_Component: 533 | - component: {fileID: 517383983} 534 | - component: {fileID: 517383984} 535 | m_Layer: 0 536 | m_Name: Other_Animation 537 | m_TagString: Untagged 538 | m_Icon: {fileID: 0} 539 | m_NavMeshLayer: 0 540 | m_StaticEditorFlags: 0 541 | m_IsActive: 1 542 | --- !u!4 &517383983 543 | Transform: 544 | m_ObjectHideFlags: 0 545 | m_CorrespondingSourceObject: {fileID: 0} 546 | m_PrefabInstance: {fileID: 0} 547 | m_PrefabAsset: {fileID: 0} 548 | m_GameObject: {fileID: 517383982} 549 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 550 | m_LocalPosition: {x: 0, y: 0, z: 0} 551 | m_LocalScale: {x: 1, y: 1, z: 1} 552 | m_ConstrainProportionsScale: 0 553 | m_Children: [] 554 | m_Father: {fileID: 1279417644} 555 | m_RootOrder: 0 556 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 557 | --- !u!111 &517383984 558 | Animation: 559 | m_ObjectHideFlags: 0 560 | m_CorrespondingSourceObject: {fileID: 0} 561 | m_PrefabInstance: {fileID: 0} 562 | m_PrefabAsset: {fileID: 0} 563 | m_GameObject: {fileID: 517383982} 564 | m_Enabled: 1 565 | serializedVersion: 3 566 | m_Animation: {fileID: 0} 567 | m_Animations: [] 568 | m_WrapMode: 0 569 | m_PlayAutomatically: 1 570 | m_AnimatePhysics: 0 571 | m_CullingType: 0 572 | --- !u!1 &684527768 573 | GameObject: 574 | m_ObjectHideFlags: 0 575 | m_CorrespondingSourceObject: {fileID: 0} 576 | m_PrefabInstance: {fileID: 0} 577 | m_PrefabAsset: {fileID: 0} 578 | serializedVersion: 6 579 | m_Component: 580 | - component: {fileID: 684527769} 581 | m_Layer: 5 582 | m_Name: Handle Slide Area 583 | m_TagString: Untagged 584 | m_Icon: {fileID: 0} 585 | m_NavMeshLayer: 0 586 | m_StaticEditorFlags: 0 587 | m_IsActive: 1 588 | --- !u!224 &684527769 589 | RectTransform: 590 | m_ObjectHideFlags: 0 591 | m_CorrespondingSourceObject: {fileID: 0} 592 | m_PrefabInstance: {fileID: 0} 593 | m_PrefabAsset: {fileID: 0} 594 | m_GameObject: {fileID: 684527768} 595 | m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} 596 | m_LocalPosition: {x: 0, y: 0, z: 0} 597 | m_LocalScale: {x: 1, y: 1, z: 1} 598 | m_ConstrainProportionsScale: 0 599 | m_Children: 600 | - {fileID: 1397575958} 601 | m_Father: {fileID: 1799480873} 602 | m_RootOrder: 2 603 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 604 | m_AnchorMin: {x: 0, y: 0} 605 | m_AnchorMax: {x: 1, y: 1} 606 | m_AnchoredPosition: {x: 0, y: 0} 607 | m_SizeDelta: {x: -20, y: 0} 608 | m_Pivot: {x: 0.5, y: 0.5} 609 | --- !u!1 &727083141 610 | GameObject: 611 | m_ObjectHideFlags: 0 612 | m_CorrespondingSourceObject: {fileID: 0} 613 | m_PrefabInstance: {fileID: 0} 614 | m_PrefabAsset: {fileID: 0} 615 | serializedVersion: 6 616 | m_Component: 617 | - component: {fileID: 727083143} 618 | - component: {fileID: 727083144} 619 | m_Layer: 0 620 | m_Name: TestMono 621 | m_TagString: Untagged 622 | m_Icon: {fileID: 0} 623 | m_NavMeshLayer: 0 624 | m_StaticEditorFlags: 0 625 | m_IsActive: 1 626 | --- !u!4 &727083143 627 | Transform: 628 | m_ObjectHideFlags: 0 629 | m_CorrespondingSourceObject: {fileID: 0} 630 | m_PrefabInstance: {fileID: 0} 631 | m_PrefabAsset: {fileID: 0} 632 | m_GameObject: {fileID: 727083141} 633 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 634 | m_LocalPosition: {x: 0, y: 0, z: 0} 635 | m_LocalScale: {x: 1, y: 1, z: 1} 636 | m_ConstrainProportionsScale: 0 637 | m_Children: 638 | - {fileID: 1664885868} 639 | - {fileID: 798915802} 640 | - {fileID: 44103783} 641 | - {fileID: 1793382481} 642 | - {fileID: 819198769} 643 | - {fileID: 1319921645} 644 | - {fileID: 285049430} 645 | - {fileID: 2132282597} 646 | - {fileID: 459711676} 647 | - {fileID: 1351314022} 648 | - {fileID: 1829786442} 649 | - {fileID: 955000991} 650 | - {fileID: 253148094} 651 | - {fileID: 1166790939} 652 | m_Father: {fileID: 0} 653 | m_RootOrder: 1 654 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 655 | --- !u!114 &727083144 656 | MonoBehaviour: 657 | m_ObjectHideFlags: 0 658 | m_CorrespondingSourceObject: {fileID: 0} 659 | m_PrefabInstance: {fileID: 0} 660 | m_PrefabAsset: {fileID: 0} 661 | m_GameObject: {fileID: 727083141} 662 | m_Enabled: 1 663 | m_EditorHideFlags: 0 664 | m_Script: {fileID: 11500000, guid: dcb4af7312c4dd1418dfa5e1d91f2c61, type: 3} 665 | m_Name: 666 | m_EditorClassIdentifier: 667 | m_TestTransform: {fileID: 1664885868} 668 | m_TestAnimator: {fileID: 1664885869} 669 | m_Test2GameObject: {fileID: 285049429} 670 | m_Test2Transform: {fileID: 285049430} 671 | m_Test2Animator: {fileID: 285049431} 672 | m_TestCSCodeBindMono: {fileID: 253148096} 673 | m_TestReferenceBindMono: {fileID: 253148095} 674 | m_Test3Transform: {fileID: 2095429737} 675 | m_Test3Slider: {fileID: 2095429738} 676 | m_Test4GameObject: {fileID: 1799480872} 677 | m_Test4RectTransform: {fileID: 1799480873} 678 | m_Test4Slider: {fileID: 1799480874} 679 | m_Test2AnimatorArray: 680 | - {fileID: 2132282598} 681 | - {fileID: 459711677} 682 | - {fileID: 1351314023} 683 | - {fileID: 1829786443} 684 | - {fileID: 955000992} 685 | m_Test2GameObjectArray: 686 | - {fileID: 2132282596} 687 | - {fileID: 459711675} 688 | - {fileID: 1351314021} 689 | - {fileID: 1829786441} 690 | - {fileID: 955000990} 691 | m_Test2TransformArray: 692 | - {fileID: 2132282597} 693 | - {fileID: 459711676} 694 | - {fileID: 1351314022} 695 | - {fileID: 1829786442} 696 | - {fileID: 955000991} 697 | m_TestAnimatorArray: 698 | - {fileID: 798915803} 699 | - {fileID: 44103784} 700 | - {fileID: 1793382482} 701 | - {fileID: 819198770} 702 | - {fileID: 1319921646} 703 | m_TestTransformArray: 704 | - {fileID: 798915802} 705 | - {fileID: 44103783} 706 | - {fileID: 1793382481} 707 | - {fileID: 819198769} 708 | - {fileID: 1319921645} 709 | --- !u!1 &734554649 710 | GameObject: 711 | m_ObjectHideFlags: 0 712 | m_CorrespondingSourceObject: {fileID: 0} 713 | m_PrefabInstance: {fileID: 0} 714 | m_PrefabAsset: {fileID: 0} 715 | serializedVersion: 6 716 | m_Component: 717 | - component: {fileID: 734554650} 718 | - component: {fileID: 734554652} 719 | - component: {fileID: 734554651} 720 | m_Layer: 5 721 | m_Name: Background 722 | m_TagString: Untagged 723 | m_Icon: {fileID: 0} 724 | m_NavMeshLayer: 0 725 | m_StaticEditorFlags: 0 726 | m_IsActive: 1 727 | --- !u!224 &734554650 728 | RectTransform: 729 | m_ObjectHideFlags: 0 730 | m_CorrespondingSourceObject: {fileID: 0} 731 | m_PrefabInstance: {fileID: 0} 732 | m_PrefabAsset: {fileID: 0} 733 | m_GameObject: {fileID: 734554649} 734 | m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} 735 | m_LocalPosition: {x: 0, y: 0, z: 0} 736 | m_LocalScale: {x: 1, y: 1, z: 1} 737 | m_ConstrainProportionsScale: 0 738 | m_Children: [] 739 | m_Father: {fileID: 1799480873} 740 | m_RootOrder: 0 741 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 742 | m_AnchorMin: {x: 0, y: 0.25} 743 | m_AnchorMax: {x: 1, y: 0.75} 744 | m_AnchoredPosition: {x: 0, y: 0} 745 | m_SizeDelta: {x: 0, y: 0} 746 | m_Pivot: {x: 0.5, y: 0.5} 747 | --- !u!114 &734554651 748 | MonoBehaviour: 749 | m_ObjectHideFlags: 0 750 | m_CorrespondingSourceObject: {fileID: 0} 751 | m_PrefabInstance: {fileID: 0} 752 | m_PrefabAsset: {fileID: 0} 753 | m_GameObject: {fileID: 734554649} 754 | m_Enabled: 1 755 | m_EditorHideFlags: 0 756 | m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} 757 | m_Name: 758 | m_EditorClassIdentifier: 759 | m_Material: {fileID: 0} 760 | m_Color: {r: 1, g: 1, b: 1, a: 1} 761 | m_RaycastTarget: 1 762 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 763 | m_Maskable: 1 764 | m_OnCullStateChanged: 765 | m_PersistentCalls: 766 | m_Calls: [] 767 | m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} 768 | m_Type: 1 769 | m_PreserveAspect: 0 770 | m_FillCenter: 1 771 | m_FillMethod: 4 772 | m_FillAmount: 1 773 | m_FillClockwise: 1 774 | m_FillOrigin: 0 775 | m_UseSpriteMesh: 0 776 | m_PixelsPerUnitMultiplier: 1 777 | --- !u!222 &734554652 778 | CanvasRenderer: 779 | m_ObjectHideFlags: 0 780 | m_CorrespondingSourceObject: {fileID: 0} 781 | m_PrefabInstance: {fileID: 0} 782 | m_PrefabAsset: {fileID: 0} 783 | m_GameObject: {fileID: 734554649} 784 | m_CullTransparentMesh: 1 785 | --- !u!1 &746566294 786 | GameObject: 787 | m_ObjectHideFlags: 0 788 | m_CorrespondingSourceObject: {fileID: 0} 789 | m_PrefabInstance: {fileID: 0} 790 | m_PrefabAsset: {fileID: 0} 791 | serializedVersion: 6 792 | m_Component: 793 | - component: {fileID: 746566295} 794 | - component: {fileID: 746566296} 795 | m_Layer: 0 796 | m_Name: List_Animation (1) 797 | m_TagString: Untagged 798 | m_Icon: {fileID: 0} 799 | m_NavMeshLayer: 0 800 | m_StaticEditorFlags: 0 801 | m_IsActive: 1 802 | --- !u!4 &746566295 803 | Transform: 804 | m_ObjectHideFlags: 0 805 | m_CorrespondingSourceObject: {fileID: 0} 806 | m_PrefabInstance: {fileID: 0} 807 | m_PrefabAsset: {fileID: 0} 808 | m_GameObject: {fileID: 746566294} 809 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 810 | m_LocalPosition: {x: 0, y: 0, z: 0} 811 | m_LocalScale: {x: 1, y: 1, z: 1} 812 | m_ConstrainProportionsScale: 0 813 | m_Children: [] 814 | m_Father: {fileID: 1279417644} 815 | m_RootOrder: 2 816 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 817 | --- !u!111 &746566296 818 | Animation: 819 | m_ObjectHideFlags: 0 820 | m_CorrespondingSourceObject: {fileID: 0} 821 | m_PrefabInstance: {fileID: 0} 822 | m_PrefabAsset: {fileID: 0} 823 | m_GameObject: {fileID: 746566294} 824 | m_Enabled: 1 825 | serializedVersion: 3 826 | m_Animation: {fileID: 0} 827 | m_Animations: [] 828 | m_WrapMode: 0 829 | m_PlayAutomatically: 1 830 | m_AnimatePhysics: 0 831 | m_CullingType: 0 832 | --- !u!1 &798915801 833 | GameObject: 834 | m_ObjectHideFlags: 0 835 | m_CorrespondingSourceObject: {fileID: 0} 836 | m_PrefabInstance: {fileID: 0} 837 | m_PrefabAsset: {fileID: 0} 838 | serializedVersion: 6 839 | m_Component: 840 | - component: {fileID: 798915802} 841 | - component: {fileID: 798915803} 842 | m_Layer: 0 843 | m_Name: Test_Transform_Animator (0) 844 | m_TagString: Untagged 845 | m_Icon: {fileID: 0} 846 | m_NavMeshLayer: 0 847 | m_StaticEditorFlags: 0 848 | m_IsActive: 1 849 | --- !u!4 &798915802 850 | Transform: 851 | m_ObjectHideFlags: 0 852 | m_CorrespondingSourceObject: {fileID: 0} 853 | m_PrefabInstance: {fileID: 0} 854 | m_PrefabAsset: {fileID: 0} 855 | m_GameObject: {fileID: 798915801} 856 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 857 | m_LocalPosition: {x: 0, y: 0, z: 0} 858 | m_LocalScale: {x: 1, y: 1, z: 1} 859 | m_ConstrainProportionsScale: 0 860 | m_Children: [] 861 | m_Father: {fileID: 727083143} 862 | m_RootOrder: 1 863 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 864 | --- !u!95 &798915803 865 | Animator: 866 | serializedVersion: 4 867 | m_ObjectHideFlags: 0 868 | m_CorrespondingSourceObject: {fileID: 0} 869 | m_PrefabInstance: {fileID: 0} 870 | m_PrefabAsset: {fileID: 0} 871 | m_GameObject: {fileID: 798915801} 872 | m_Enabled: 1 873 | m_Avatar: {fileID: 0} 874 | m_Controller: {fileID: 0} 875 | m_CullingMode: 0 876 | m_UpdateMode: 0 877 | m_ApplyRootMotion: 0 878 | m_LinearVelocityBlending: 0 879 | m_StabilizeFeet: 0 880 | m_WarningMessage: 881 | m_HasTransformHierarchy: 1 882 | m_AllowConstantClipSamplingOptimization: 1 883 | m_KeepAnimatorControllerStateOnDisable: 0 884 | --- !u!1 &819198768 885 | GameObject: 886 | m_ObjectHideFlags: 0 887 | m_CorrespondingSourceObject: {fileID: 0} 888 | m_PrefabInstance: {fileID: 0} 889 | m_PrefabAsset: {fileID: 0} 890 | serializedVersion: 6 891 | m_Component: 892 | - component: {fileID: 819198769} 893 | - component: {fileID: 819198770} 894 | m_Layer: 0 895 | m_Name: Test_Transform_Animator (3) 896 | m_TagString: Untagged 897 | m_Icon: {fileID: 0} 898 | m_NavMeshLayer: 0 899 | m_StaticEditorFlags: 0 900 | m_IsActive: 1 901 | --- !u!4 &819198769 902 | Transform: 903 | m_ObjectHideFlags: 0 904 | m_CorrespondingSourceObject: {fileID: 0} 905 | m_PrefabInstance: {fileID: 0} 906 | m_PrefabAsset: {fileID: 0} 907 | m_GameObject: {fileID: 819198768} 908 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 909 | m_LocalPosition: {x: 0, y: 0, z: 0} 910 | m_LocalScale: {x: 1, y: 1, z: 1} 911 | m_ConstrainProportionsScale: 0 912 | m_Children: [] 913 | m_Father: {fileID: 727083143} 914 | m_RootOrder: 4 915 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 916 | --- !u!95 &819198770 917 | Animator: 918 | serializedVersion: 4 919 | m_ObjectHideFlags: 0 920 | m_CorrespondingSourceObject: {fileID: 0} 921 | m_PrefabInstance: {fileID: 0} 922 | m_PrefabAsset: {fileID: 0} 923 | m_GameObject: {fileID: 819198768} 924 | m_Enabled: 1 925 | m_Avatar: {fileID: 0} 926 | m_Controller: {fileID: 0} 927 | m_CullingMode: 0 928 | m_UpdateMode: 0 929 | m_ApplyRootMotion: 0 930 | m_LinearVelocityBlending: 0 931 | m_StabilizeFeet: 0 932 | m_WarningMessage: 933 | m_HasTransformHierarchy: 1 934 | m_AllowConstantClipSamplingOptimization: 1 935 | m_KeepAnimatorControllerStateOnDisable: 0 936 | --- !u!1 &932792622 937 | GameObject: 938 | m_ObjectHideFlags: 0 939 | m_CorrespondingSourceObject: {fileID: 0} 940 | m_PrefabInstance: {fileID: 0} 941 | m_PrefabAsset: {fileID: 0} 942 | serializedVersion: 6 943 | m_Component: 944 | - component: {fileID: 932792623} 945 | - component: {fileID: 932792625} 946 | - component: {fileID: 932792624} 947 | m_Layer: 5 948 | m_Name: Handle 949 | m_TagString: Untagged 950 | m_Icon: {fileID: 0} 951 | m_NavMeshLayer: 0 952 | m_StaticEditorFlags: 0 953 | m_IsActive: 1 954 | --- !u!224 &932792623 955 | RectTransform: 956 | m_ObjectHideFlags: 0 957 | m_CorrespondingSourceObject: {fileID: 0} 958 | m_PrefabInstance: {fileID: 0} 959 | m_PrefabAsset: {fileID: 0} 960 | m_GameObject: {fileID: 932792622} 961 | m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} 962 | m_LocalPosition: {x: 0, y: 0, z: 0} 963 | m_LocalScale: {x: 1, y: 1, z: 1} 964 | m_ConstrainProportionsScale: 0 965 | m_Children: [] 966 | m_Father: {fileID: 288023356} 967 | m_RootOrder: 0 968 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 969 | m_AnchorMin: {x: 0, y: 0} 970 | m_AnchorMax: {x: 0, y: 0} 971 | m_AnchoredPosition: {x: 0, y: 0} 972 | m_SizeDelta: {x: 20, y: 0} 973 | m_Pivot: {x: 0.5, y: 0.5} 974 | --- !u!114 &932792624 975 | MonoBehaviour: 976 | m_ObjectHideFlags: 0 977 | m_CorrespondingSourceObject: {fileID: 0} 978 | m_PrefabInstance: {fileID: 0} 979 | m_PrefabAsset: {fileID: 0} 980 | m_GameObject: {fileID: 932792622} 981 | m_Enabled: 1 982 | m_EditorHideFlags: 0 983 | m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} 984 | m_Name: 985 | m_EditorClassIdentifier: 986 | m_Material: {fileID: 0} 987 | m_Color: {r: 1, g: 1, b: 1, a: 1} 988 | m_RaycastTarget: 1 989 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 990 | m_Maskable: 1 991 | m_OnCullStateChanged: 992 | m_PersistentCalls: 993 | m_Calls: [] 994 | m_Sprite: {fileID: 10913, guid: 0000000000000000f000000000000000, type: 0} 995 | m_Type: 0 996 | m_PreserveAspect: 0 997 | m_FillCenter: 1 998 | m_FillMethod: 4 999 | m_FillAmount: 1 1000 | m_FillClockwise: 1 1001 | m_FillOrigin: 0 1002 | m_UseSpriteMesh: 0 1003 | m_PixelsPerUnitMultiplier: 1 1004 | --- !u!222 &932792625 1005 | CanvasRenderer: 1006 | m_ObjectHideFlags: 0 1007 | m_CorrespondingSourceObject: {fileID: 0} 1008 | m_PrefabInstance: {fileID: 0} 1009 | m_PrefabAsset: {fileID: 0} 1010 | m_GameObject: {fileID: 932792622} 1011 | m_CullTransparentMesh: 1 1012 | --- !u!1 &955000990 1013 | GameObject: 1014 | m_ObjectHideFlags: 0 1015 | m_CorrespondingSourceObject: {fileID: 0} 1016 | m_PrefabInstance: {fileID: 0} 1017 | m_PrefabAsset: {fileID: 0} 1018 | serializedVersion: 6 1019 | m_Component: 1020 | - component: {fileID: 955000991} 1021 | - component: {fileID: 955000992} 1022 | m_Layer: 0 1023 | m_Name: Test2_* (4) 1024 | m_TagString: Untagged 1025 | m_Icon: {fileID: 0} 1026 | m_NavMeshLayer: 0 1027 | m_StaticEditorFlags: 0 1028 | m_IsActive: 1 1029 | --- !u!4 &955000991 1030 | Transform: 1031 | m_ObjectHideFlags: 0 1032 | m_CorrespondingSourceObject: {fileID: 0} 1033 | m_PrefabInstance: {fileID: 0} 1034 | m_PrefabAsset: {fileID: 0} 1035 | m_GameObject: {fileID: 955000990} 1036 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 1037 | m_LocalPosition: {x: 0, y: 0, z: 0} 1038 | m_LocalScale: {x: 1, y: 1, z: 1} 1039 | m_ConstrainProportionsScale: 0 1040 | m_Children: [] 1041 | m_Father: {fileID: 727083143} 1042 | m_RootOrder: 11 1043 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 1044 | --- !u!95 &955000992 1045 | Animator: 1046 | serializedVersion: 4 1047 | m_ObjectHideFlags: 0 1048 | m_CorrespondingSourceObject: {fileID: 0} 1049 | m_PrefabInstance: {fileID: 0} 1050 | m_PrefabAsset: {fileID: 0} 1051 | m_GameObject: {fileID: 955000990} 1052 | m_Enabled: 1 1053 | m_Avatar: {fileID: 0} 1054 | m_Controller: {fileID: 0} 1055 | m_CullingMode: 0 1056 | m_UpdateMode: 0 1057 | m_ApplyRootMotion: 0 1058 | m_LinearVelocityBlending: 0 1059 | m_StabilizeFeet: 0 1060 | m_WarningMessage: 1061 | m_HasTransformHierarchy: 1 1062 | m_AllowConstantClipSamplingOptimization: 1 1063 | m_KeepAnimatorControllerStateOnDisable: 0 1064 | --- !u!1 &974169898 1065 | GameObject: 1066 | m_ObjectHideFlags: 0 1067 | m_CorrespondingSourceObject: {fileID: 0} 1068 | m_PrefabInstance: {fileID: 0} 1069 | m_PrefabAsset: {fileID: 0} 1070 | serializedVersion: 6 1071 | m_Component: 1072 | - component: {fileID: 974169899} 1073 | - component: {fileID: 974169901} 1074 | - component: {fileID: 974169900} 1075 | m_Layer: 5 1076 | m_Name: Background 1077 | m_TagString: Untagged 1078 | m_Icon: {fileID: 0} 1079 | m_NavMeshLayer: 0 1080 | m_StaticEditorFlags: 0 1081 | m_IsActive: 1 1082 | --- !u!224 &974169899 1083 | RectTransform: 1084 | m_ObjectHideFlags: 0 1085 | m_CorrespondingSourceObject: {fileID: 0} 1086 | m_PrefabInstance: {fileID: 0} 1087 | m_PrefabAsset: {fileID: 0} 1088 | m_GameObject: {fileID: 974169898} 1089 | m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} 1090 | m_LocalPosition: {x: 0, y: 0, z: 0} 1091 | m_LocalScale: {x: 1, y: 1, z: 1} 1092 | m_ConstrainProportionsScale: 0 1093 | m_Children: [] 1094 | m_Father: {fileID: 2095429737} 1095 | m_RootOrder: 0 1096 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 1097 | m_AnchorMin: {x: 0, y: 0.25} 1098 | m_AnchorMax: {x: 1, y: 0.75} 1099 | m_AnchoredPosition: {x: 0, y: 0} 1100 | m_SizeDelta: {x: 0, y: 0} 1101 | m_Pivot: {x: 0.5, y: 0.5} 1102 | --- !u!114 &974169900 1103 | MonoBehaviour: 1104 | m_ObjectHideFlags: 0 1105 | m_CorrespondingSourceObject: {fileID: 0} 1106 | m_PrefabInstance: {fileID: 0} 1107 | m_PrefabAsset: {fileID: 0} 1108 | m_GameObject: {fileID: 974169898} 1109 | m_Enabled: 1 1110 | m_EditorHideFlags: 0 1111 | m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} 1112 | m_Name: 1113 | m_EditorClassIdentifier: 1114 | m_Material: {fileID: 0} 1115 | m_Color: {r: 1, g: 1, b: 1, a: 1} 1116 | m_RaycastTarget: 1 1117 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 1118 | m_Maskable: 1 1119 | m_OnCullStateChanged: 1120 | m_PersistentCalls: 1121 | m_Calls: [] 1122 | m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} 1123 | m_Type: 1 1124 | m_PreserveAspect: 0 1125 | m_FillCenter: 1 1126 | m_FillMethod: 4 1127 | m_FillAmount: 1 1128 | m_FillClockwise: 1 1129 | m_FillOrigin: 0 1130 | m_UseSpriteMesh: 0 1131 | m_PixelsPerUnitMultiplier: 1 1132 | --- !u!222 &974169901 1133 | CanvasRenderer: 1134 | m_ObjectHideFlags: 0 1135 | m_CorrespondingSourceObject: {fileID: 0} 1136 | m_PrefabInstance: {fileID: 0} 1137 | m_PrefabAsset: {fileID: 0} 1138 | m_GameObject: {fileID: 974169898} 1139 | m_CullTransparentMesh: 1 1140 | --- !u!1 &1166790938 1141 | GameObject: 1142 | m_ObjectHideFlags: 0 1143 | m_CorrespondingSourceObject: {fileID: 0} 1144 | m_PrefabInstance: {fileID: 0} 1145 | m_PrefabAsset: {fileID: 0} 1146 | serializedVersion: 6 1147 | m_Component: 1148 | - component: {fileID: 1166790939} 1149 | - component: {fileID: 1166790942} 1150 | - component: {fileID: 1166790941} 1151 | - component: {fileID: 1166790940} 1152 | m_Layer: 5 1153 | m_Name: Canvas 1154 | m_TagString: Untagged 1155 | m_Icon: {fileID: 0} 1156 | m_NavMeshLayer: 0 1157 | m_StaticEditorFlags: 0 1158 | m_IsActive: 1 1159 | --- !u!224 &1166790939 1160 | RectTransform: 1161 | m_ObjectHideFlags: 0 1162 | m_CorrespondingSourceObject: {fileID: 0} 1163 | m_PrefabInstance: {fileID: 0} 1164 | m_PrefabAsset: {fileID: 0} 1165 | m_GameObject: {fileID: 1166790938} 1166 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 1167 | m_LocalPosition: {x: 0, y: 0, z: 0} 1168 | m_LocalScale: {x: 0, y: 0, z: 0} 1169 | m_ConstrainProportionsScale: 0 1170 | m_Children: 1171 | - {fileID: 2095429737} 1172 | - {fileID: 1799480873} 1173 | m_Father: {fileID: 727083143} 1174 | m_RootOrder: 13 1175 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 1176 | m_AnchorMin: {x: 0, y: 0} 1177 | m_AnchorMax: {x: 0, y: 0} 1178 | m_AnchoredPosition: {x: 0, y: 0} 1179 | m_SizeDelta: {x: 0, y: 0} 1180 | m_Pivot: {x: 0, y: 0} 1181 | --- !u!114 &1166790940 1182 | MonoBehaviour: 1183 | m_ObjectHideFlags: 0 1184 | m_CorrespondingSourceObject: {fileID: 0} 1185 | m_PrefabInstance: {fileID: 0} 1186 | m_PrefabAsset: {fileID: 0} 1187 | m_GameObject: {fileID: 1166790938} 1188 | m_Enabled: 1 1189 | m_EditorHideFlags: 0 1190 | m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} 1191 | m_Name: 1192 | m_EditorClassIdentifier: 1193 | m_IgnoreReversedGraphics: 1 1194 | m_BlockingObjects: 0 1195 | m_BlockingMask: 1196 | serializedVersion: 2 1197 | m_Bits: 55 1198 | --- !u!114 &1166790941 1199 | MonoBehaviour: 1200 | m_ObjectHideFlags: 0 1201 | m_CorrespondingSourceObject: {fileID: 0} 1202 | m_PrefabInstance: {fileID: 0} 1203 | m_PrefabAsset: {fileID: 0} 1204 | m_GameObject: {fileID: 1166790938} 1205 | m_Enabled: 1 1206 | m_EditorHideFlags: 0 1207 | m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} 1208 | m_Name: 1209 | m_EditorClassIdentifier: 1210 | m_UiScaleMode: 0 1211 | m_ReferencePixelsPerUnit: 100 1212 | m_ScaleFactor: 1 1213 | m_ReferenceResolution: {x: 800, y: 600} 1214 | m_ScreenMatchMode: 0 1215 | m_MatchWidthOrHeight: 0 1216 | m_PhysicalUnit: 3 1217 | m_FallbackScreenDPI: 96 1218 | m_DefaultSpriteDPI: 96 1219 | m_DynamicPixelsPerUnit: 1 1220 | m_PresetInfoIsWorld: 0 1221 | --- !u!223 &1166790942 1222 | Canvas: 1223 | m_ObjectHideFlags: 0 1224 | m_CorrespondingSourceObject: {fileID: 0} 1225 | m_PrefabInstance: {fileID: 0} 1226 | m_PrefabAsset: {fileID: 0} 1227 | m_GameObject: {fileID: 1166790938} 1228 | m_Enabled: 1 1229 | serializedVersion: 3 1230 | m_RenderMode: 0 1231 | m_Camera: {fileID: 0} 1232 | m_PlaneDistance: 100 1233 | m_PixelPerfect: 0 1234 | m_ReceivesEvents: 1 1235 | m_OverrideSorting: 0 1236 | m_OverridePixelPerfect: 0 1237 | m_SortingBucketNormalizedSize: 0 1238 | m_AdditionalShaderChannelsFlag: 0 1239 | m_SortingLayerID: 0 1240 | m_SortingOrder: 0 1241 | m_TargetDisplay: 0 1242 | --- !u!1 &1203590858 1243 | GameObject: 1244 | m_ObjectHideFlags: 0 1245 | m_CorrespondingSourceObject: {fileID: 0} 1246 | m_PrefabInstance: {fileID: 0} 1247 | m_PrefabAsset: {fileID: 0} 1248 | serializedVersion: 6 1249 | m_Component: 1250 | - component: {fileID: 1203590859} 1251 | m_Layer: 5 1252 | m_Name: Fill Area 1253 | m_TagString: Untagged 1254 | m_Icon: {fileID: 0} 1255 | m_NavMeshLayer: 0 1256 | m_StaticEditorFlags: 0 1257 | m_IsActive: 1 1258 | --- !u!224 &1203590859 1259 | RectTransform: 1260 | m_ObjectHideFlags: 0 1261 | m_CorrespondingSourceObject: {fileID: 0} 1262 | m_PrefabInstance: {fileID: 0} 1263 | m_PrefabAsset: {fileID: 0} 1264 | m_GameObject: {fileID: 1203590858} 1265 | m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} 1266 | m_LocalPosition: {x: 0, y: 0, z: 0} 1267 | m_LocalScale: {x: 1, y: 1, z: 1} 1268 | m_ConstrainProportionsScale: 0 1269 | m_Children: 1270 | - {fileID: 1998178784} 1271 | m_Father: {fileID: 2095429737} 1272 | m_RootOrder: 1 1273 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 1274 | m_AnchorMin: {x: 0, y: 0.25} 1275 | m_AnchorMax: {x: 1, y: 0.75} 1276 | m_AnchoredPosition: {x: -5, y: 0} 1277 | m_SizeDelta: {x: -20, y: 0} 1278 | m_Pivot: {x: 0.5, y: 0.5} 1279 | --- !u!1 &1215201788 1280 | GameObject: 1281 | m_ObjectHideFlags: 0 1282 | m_CorrespondingSourceObject: {fileID: 0} 1283 | m_PrefabInstance: {fileID: 0} 1284 | m_PrefabAsset: {fileID: 0} 1285 | serializedVersion: 6 1286 | m_Component: 1287 | - component: {fileID: 1215201789} 1288 | - component: {fileID: 1215201790} 1289 | m_Layer: 0 1290 | m_Name: List_Animation (2) 1291 | m_TagString: Untagged 1292 | m_Icon: {fileID: 0} 1293 | m_NavMeshLayer: 0 1294 | m_StaticEditorFlags: 0 1295 | m_IsActive: 1 1296 | --- !u!4 &1215201789 1297 | Transform: 1298 | m_ObjectHideFlags: 0 1299 | m_CorrespondingSourceObject: {fileID: 0} 1300 | m_PrefabInstance: {fileID: 0} 1301 | m_PrefabAsset: {fileID: 0} 1302 | m_GameObject: {fileID: 1215201788} 1303 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 1304 | m_LocalPosition: {x: 0, y: 0, z: 0} 1305 | m_LocalScale: {x: 1, y: 1, z: 1} 1306 | m_ConstrainProportionsScale: 0 1307 | m_Children: [] 1308 | m_Father: {fileID: 1279417644} 1309 | m_RootOrder: 3 1310 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 1311 | --- !u!111 &1215201790 1312 | Animation: 1313 | m_ObjectHideFlags: 0 1314 | m_CorrespondingSourceObject: {fileID: 0} 1315 | m_PrefabInstance: {fileID: 0} 1316 | m_PrefabAsset: {fileID: 0} 1317 | m_GameObject: {fileID: 1215201788} 1318 | m_Enabled: 1 1319 | serializedVersion: 3 1320 | m_Animation: {fileID: 0} 1321 | m_Animations: [] 1322 | m_WrapMode: 0 1323 | m_PlayAutomatically: 1 1324 | m_AnimatePhysics: 0 1325 | m_CullingType: 0 1326 | --- !u!1 &1262308066 1327 | GameObject: 1328 | m_ObjectHideFlags: 0 1329 | m_CorrespondingSourceObject: {fileID: 0} 1330 | m_PrefabInstance: {fileID: 0} 1331 | m_PrefabAsset: {fileID: 0} 1332 | serializedVersion: 6 1333 | m_Component: 1334 | - component: {fileID: 1262308067} 1335 | - component: {fileID: 1262308068} 1336 | m_Layer: 0 1337 | m_Name: List_Animation (3) 1338 | m_TagString: Untagged 1339 | m_Icon: {fileID: 0} 1340 | m_NavMeshLayer: 0 1341 | m_StaticEditorFlags: 0 1342 | m_IsActive: 1 1343 | --- !u!4 &1262308067 1344 | Transform: 1345 | m_ObjectHideFlags: 0 1346 | m_CorrespondingSourceObject: {fileID: 0} 1347 | m_PrefabInstance: {fileID: 0} 1348 | m_PrefabAsset: {fileID: 0} 1349 | m_GameObject: {fileID: 1262308066} 1350 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 1351 | m_LocalPosition: {x: 0, y: 0, z: 0} 1352 | m_LocalScale: {x: 1, y: 1, z: 1} 1353 | m_ConstrainProportionsScale: 0 1354 | m_Children: [] 1355 | m_Father: {fileID: 1279417644} 1356 | m_RootOrder: 4 1357 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 1358 | --- !u!111 &1262308068 1359 | Animation: 1360 | m_ObjectHideFlags: 0 1361 | m_CorrespondingSourceObject: {fileID: 0} 1362 | m_PrefabInstance: {fileID: 0} 1363 | m_PrefabAsset: {fileID: 0} 1364 | m_GameObject: {fileID: 1262308066} 1365 | m_Enabled: 1 1366 | serializedVersion: 3 1367 | m_Animation: {fileID: 0} 1368 | m_Animations: [] 1369 | m_WrapMode: 0 1370 | m_PlayAutomatically: 1 1371 | m_AnimatePhysics: 0 1372 | m_CullingType: 0 1373 | --- !u!1 &1279417643 1374 | GameObject: 1375 | m_ObjectHideFlags: 0 1376 | m_CorrespondingSourceObject: {fileID: 0} 1377 | m_PrefabInstance: {fileID: 0} 1378 | m_PrefabAsset: {fileID: 0} 1379 | serializedVersion: 6 1380 | m_Component: 1381 | - component: {fileID: 1279417644} 1382 | m_Layer: 0 1383 | m_Name: Self_Transform 1384 | m_TagString: Untagged 1385 | m_Icon: {fileID: 0} 1386 | m_NavMeshLayer: 0 1387 | m_StaticEditorFlags: 0 1388 | m_IsActive: 1 1389 | --- !u!4 &1279417644 1390 | Transform: 1391 | m_ObjectHideFlags: 0 1392 | m_CorrespondingSourceObject: {fileID: 0} 1393 | m_PrefabInstance: {fileID: 0} 1394 | m_PrefabAsset: {fileID: 0} 1395 | m_GameObject: {fileID: 1279417643} 1396 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 1397 | m_LocalPosition: {x: 0, y: 0, z: 0} 1398 | m_LocalScale: {x: 1, y: 1, z: 1} 1399 | m_ConstrainProportionsScale: 0 1400 | m_Children: 1401 | - {fileID: 517383983} 1402 | - {fileID: 1640880386} 1403 | - {fileID: 746566295} 1404 | - {fileID: 1215201789} 1405 | - {fileID: 1262308067} 1406 | m_Father: {fileID: 253148094} 1407 | m_RootOrder: 0 1408 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 1409 | --- !u!1 &1319921644 1410 | GameObject: 1411 | m_ObjectHideFlags: 0 1412 | m_CorrespondingSourceObject: {fileID: 0} 1413 | m_PrefabInstance: {fileID: 0} 1414 | m_PrefabAsset: {fileID: 0} 1415 | serializedVersion: 6 1416 | m_Component: 1417 | - component: {fileID: 1319921645} 1418 | - component: {fileID: 1319921646} 1419 | m_Layer: 0 1420 | m_Name: Test_Transform_Animator (4) 1421 | m_TagString: Untagged 1422 | m_Icon: {fileID: 0} 1423 | m_NavMeshLayer: 0 1424 | m_StaticEditorFlags: 0 1425 | m_IsActive: 1 1426 | --- !u!4 &1319921645 1427 | Transform: 1428 | m_ObjectHideFlags: 0 1429 | m_CorrespondingSourceObject: {fileID: 0} 1430 | m_PrefabInstance: {fileID: 0} 1431 | m_PrefabAsset: {fileID: 0} 1432 | m_GameObject: {fileID: 1319921644} 1433 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 1434 | m_LocalPosition: {x: 0, y: 0, z: 0} 1435 | m_LocalScale: {x: 1, y: 1, z: 1} 1436 | m_ConstrainProportionsScale: 0 1437 | m_Children: [] 1438 | m_Father: {fileID: 727083143} 1439 | m_RootOrder: 5 1440 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 1441 | --- !u!95 &1319921646 1442 | Animator: 1443 | serializedVersion: 4 1444 | m_ObjectHideFlags: 0 1445 | m_CorrespondingSourceObject: {fileID: 0} 1446 | m_PrefabInstance: {fileID: 0} 1447 | m_PrefabAsset: {fileID: 0} 1448 | m_GameObject: {fileID: 1319921644} 1449 | m_Enabled: 1 1450 | m_Avatar: {fileID: 0} 1451 | m_Controller: {fileID: 0} 1452 | m_CullingMode: 0 1453 | m_UpdateMode: 0 1454 | m_ApplyRootMotion: 0 1455 | m_LinearVelocityBlending: 0 1456 | m_StabilizeFeet: 0 1457 | m_WarningMessage: 1458 | m_HasTransformHierarchy: 1 1459 | m_AllowConstantClipSamplingOptimization: 1 1460 | m_KeepAnimatorControllerStateOnDisable: 0 1461 | --- !u!1 &1351314021 1462 | GameObject: 1463 | m_ObjectHideFlags: 0 1464 | m_CorrespondingSourceObject: {fileID: 0} 1465 | m_PrefabInstance: {fileID: 0} 1466 | m_PrefabAsset: {fileID: 0} 1467 | serializedVersion: 6 1468 | m_Component: 1469 | - component: {fileID: 1351314022} 1470 | - component: {fileID: 1351314023} 1471 | m_Layer: 0 1472 | m_Name: Test2_* (2) 1473 | m_TagString: Untagged 1474 | m_Icon: {fileID: 0} 1475 | m_NavMeshLayer: 0 1476 | m_StaticEditorFlags: 0 1477 | m_IsActive: 1 1478 | --- !u!4 &1351314022 1479 | Transform: 1480 | m_ObjectHideFlags: 0 1481 | m_CorrespondingSourceObject: {fileID: 0} 1482 | m_PrefabInstance: {fileID: 0} 1483 | m_PrefabAsset: {fileID: 0} 1484 | m_GameObject: {fileID: 1351314021} 1485 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 1486 | m_LocalPosition: {x: 0, y: 0, z: 0} 1487 | m_LocalScale: {x: 1, y: 1, z: 1} 1488 | m_ConstrainProportionsScale: 0 1489 | m_Children: [] 1490 | m_Father: {fileID: 727083143} 1491 | m_RootOrder: 9 1492 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 1493 | --- !u!95 &1351314023 1494 | Animator: 1495 | serializedVersion: 4 1496 | m_ObjectHideFlags: 0 1497 | m_CorrespondingSourceObject: {fileID: 0} 1498 | m_PrefabInstance: {fileID: 0} 1499 | m_PrefabAsset: {fileID: 0} 1500 | m_GameObject: {fileID: 1351314021} 1501 | m_Enabled: 1 1502 | m_Avatar: {fileID: 0} 1503 | m_Controller: {fileID: 0} 1504 | m_CullingMode: 0 1505 | m_UpdateMode: 0 1506 | m_ApplyRootMotion: 0 1507 | m_LinearVelocityBlending: 0 1508 | m_StabilizeFeet: 0 1509 | m_WarningMessage: 1510 | m_HasTransformHierarchy: 1 1511 | m_AllowConstantClipSamplingOptimization: 1 1512 | m_KeepAnimatorControllerStateOnDisable: 0 1513 | --- !u!1 &1397575957 1514 | GameObject: 1515 | m_ObjectHideFlags: 0 1516 | m_CorrespondingSourceObject: {fileID: 0} 1517 | m_PrefabInstance: {fileID: 0} 1518 | m_PrefabAsset: {fileID: 0} 1519 | serializedVersion: 6 1520 | m_Component: 1521 | - component: {fileID: 1397575958} 1522 | - component: {fileID: 1397575960} 1523 | - component: {fileID: 1397575959} 1524 | m_Layer: 5 1525 | m_Name: Handle 1526 | m_TagString: Untagged 1527 | m_Icon: {fileID: 0} 1528 | m_NavMeshLayer: 0 1529 | m_StaticEditorFlags: 0 1530 | m_IsActive: 1 1531 | --- !u!224 &1397575958 1532 | RectTransform: 1533 | m_ObjectHideFlags: 0 1534 | m_CorrespondingSourceObject: {fileID: 0} 1535 | m_PrefabInstance: {fileID: 0} 1536 | m_PrefabAsset: {fileID: 0} 1537 | m_GameObject: {fileID: 1397575957} 1538 | m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} 1539 | m_LocalPosition: {x: 0, y: 0, z: 0} 1540 | m_LocalScale: {x: 1, y: 1, z: 1} 1541 | m_ConstrainProportionsScale: 0 1542 | m_Children: [] 1543 | m_Father: {fileID: 684527769} 1544 | m_RootOrder: 0 1545 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 1546 | m_AnchorMin: {x: 0, y: 0} 1547 | m_AnchorMax: {x: 0, y: 0} 1548 | m_AnchoredPosition: {x: 0, y: 0} 1549 | m_SizeDelta: {x: 20, y: 0} 1550 | m_Pivot: {x: 0.5, y: 0.5} 1551 | --- !u!114 &1397575959 1552 | MonoBehaviour: 1553 | m_ObjectHideFlags: 0 1554 | m_CorrespondingSourceObject: {fileID: 0} 1555 | m_PrefabInstance: {fileID: 0} 1556 | m_PrefabAsset: {fileID: 0} 1557 | m_GameObject: {fileID: 1397575957} 1558 | m_Enabled: 1 1559 | m_EditorHideFlags: 0 1560 | m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} 1561 | m_Name: 1562 | m_EditorClassIdentifier: 1563 | m_Material: {fileID: 0} 1564 | m_Color: {r: 1, g: 1, b: 1, a: 1} 1565 | m_RaycastTarget: 1 1566 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 1567 | m_Maskable: 1 1568 | m_OnCullStateChanged: 1569 | m_PersistentCalls: 1570 | m_Calls: [] 1571 | m_Sprite: {fileID: 10913, guid: 0000000000000000f000000000000000, type: 0} 1572 | m_Type: 0 1573 | m_PreserveAspect: 0 1574 | m_FillCenter: 1 1575 | m_FillMethod: 4 1576 | m_FillAmount: 1 1577 | m_FillClockwise: 1 1578 | m_FillOrigin: 0 1579 | m_UseSpriteMesh: 0 1580 | m_PixelsPerUnitMultiplier: 1 1581 | --- !u!222 &1397575960 1582 | CanvasRenderer: 1583 | m_ObjectHideFlags: 0 1584 | m_CorrespondingSourceObject: {fileID: 0} 1585 | m_PrefabInstance: {fileID: 0} 1586 | m_PrefabAsset: {fileID: 0} 1587 | m_GameObject: {fileID: 1397575957} 1588 | m_CullTransparentMesh: 1 1589 | --- !u!1 &1640880385 1590 | GameObject: 1591 | m_ObjectHideFlags: 0 1592 | m_CorrespondingSourceObject: {fileID: 0} 1593 | m_PrefabInstance: {fileID: 0} 1594 | m_PrefabAsset: {fileID: 0} 1595 | serializedVersion: 6 1596 | m_Component: 1597 | - component: {fileID: 1640880386} 1598 | - component: {fileID: 1640880387} 1599 | m_Layer: 0 1600 | m_Name: List_Animation (0) 1601 | m_TagString: Untagged 1602 | m_Icon: {fileID: 0} 1603 | m_NavMeshLayer: 0 1604 | m_StaticEditorFlags: 0 1605 | m_IsActive: 1 1606 | --- !u!4 &1640880386 1607 | Transform: 1608 | m_ObjectHideFlags: 0 1609 | m_CorrespondingSourceObject: {fileID: 0} 1610 | m_PrefabInstance: {fileID: 0} 1611 | m_PrefabAsset: {fileID: 0} 1612 | m_GameObject: {fileID: 1640880385} 1613 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 1614 | m_LocalPosition: {x: 0, y: 0, z: 0} 1615 | m_LocalScale: {x: 1, y: 1, z: 1} 1616 | m_ConstrainProportionsScale: 0 1617 | m_Children: [] 1618 | m_Father: {fileID: 1279417644} 1619 | m_RootOrder: 1 1620 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 1621 | --- !u!111 &1640880387 1622 | Animation: 1623 | m_ObjectHideFlags: 0 1624 | m_CorrespondingSourceObject: {fileID: 0} 1625 | m_PrefabInstance: {fileID: 0} 1626 | m_PrefabAsset: {fileID: 0} 1627 | m_GameObject: {fileID: 1640880385} 1628 | m_Enabled: 1 1629 | serializedVersion: 3 1630 | m_Animation: {fileID: 0} 1631 | m_Animations: [] 1632 | m_WrapMode: 0 1633 | m_PlayAutomatically: 1 1634 | m_AnimatePhysics: 0 1635 | m_CullingType: 0 1636 | --- !u!1 &1664885867 1637 | GameObject: 1638 | m_ObjectHideFlags: 0 1639 | m_CorrespondingSourceObject: {fileID: 0} 1640 | m_PrefabInstance: {fileID: 0} 1641 | m_PrefabAsset: {fileID: 0} 1642 | serializedVersion: 6 1643 | m_Component: 1644 | - component: {fileID: 1664885868} 1645 | - component: {fileID: 1664885869} 1646 | m_Layer: 0 1647 | m_Name: Test_Transform_Animator 1648 | m_TagString: Untagged 1649 | m_Icon: {fileID: 0} 1650 | m_NavMeshLayer: 0 1651 | m_StaticEditorFlags: 0 1652 | m_IsActive: 1 1653 | --- !u!4 &1664885868 1654 | Transform: 1655 | m_ObjectHideFlags: 0 1656 | m_CorrespondingSourceObject: {fileID: 0} 1657 | m_PrefabInstance: {fileID: 0} 1658 | m_PrefabAsset: {fileID: 0} 1659 | m_GameObject: {fileID: 1664885867} 1660 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 1661 | m_LocalPosition: {x: 0, y: 0, z: 0} 1662 | m_LocalScale: {x: 1, y: 1, z: 1} 1663 | m_ConstrainProportionsScale: 0 1664 | m_Children: [] 1665 | m_Father: {fileID: 727083143} 1666 | m_RootOrder: 0 1667 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 1668 | --- !u!95 &1664885869 1669 | Animator: 1670 | serializedVersion: 4 1671 | m_ObjectHideFlags: 0 1672 | m_CorrespondingSourceObject: {fileID: 0} 1673 | m_PrefabInstance: {fileID: 0} 1674 | m_PrefabAsset: {fileID: 0} 1675 | m_GameObject: {fileID: 1664885867} 1676 | m_Enabled: 1 1677 | m_Avatar: {fileID: 0} 1678 | m_Controller: {fileID: 0} 1679 | m_CullingMode: 0 1680 | m_UpdateMode: 0 1681 | m_ApplyRootMotion: 0 1682 | m_LinearVelocityBlending: 0 1683 | m_StabilizeFeet: 0 1684 | m_WarningMessage: 1685 | m_HasTransformHierarchy: 1 1686 | m_AllowConstantClipSamplingOptimization: 1 1687 | m_KeepAnimatorControllerStateOnDisable: 0 1688 | --- !u!1 &1761283555 1689 | GameObject: 1690 | m_ObjectHideFlags: 0 1691 | m_CorrespondingSourceObject: {fileID: 0} 1692 | m_PrefabInstance: {fileID: 0} 1693 | m_PrefabAsset: {fileID: 0} 1694 | serializedVersion: 6 1695 | m_Component: 1696 | - component: {fileID: 1761283558} 1697 | - component: {fileID: 1761283557} 1698 | - component: {fileID: 1761283556} 1699 | m_Layer: 0 1700 | m_Name: EventSystem 1701 | m_TagString: Untagged 1702 | m_Icon: {fileID: 0} 1703 | m_NavMeshLayer: 0 1704 | m_StaticEditorFlags: 0 1705 | m_IsActive: 1 1706 | --- !u!114 &1761283556 1707 | MonoBehaviour: 1708 | m_ObjectHideFlags: 0 1709 | m_CorrespondingSourceObject: {fileID: 0} 1710 | m_PrefabInstance: {fileID: 0} 1711 | m_PrefabAsset: {fileID: 0} 1712 | m_GameObject: {fileID: 1761283555} 1713 | m_Enabled: 1 1714 | m_EditorHideFlags: 0 1715 | m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3} 1716 | m_Name: 1717 | m_EditorClassIdentifier: 1718 | m_SendPointerHoverToParent: 1 1719 | m_HorizontalAxis: Horizontal 1720 | m_VerticalAxis: Vertical 1721 | m_SubmitButton: Submit 1722 | m_CancelButton: Cancel 1723 | m_InputActionsPerSecond: 10 1724 | m_RepeatDelay: 0.5 1725 | m_ForceModuleActive: 0 1726 | --- !u!114 &1761283557 1727 | MonoBehaviour: 1728 | m_ObjectHideFlags: 0 1729 | m_CorrespondingSourceObject: {fileID: 0} 1730 | m_PrefabInstance: {fileID: 0} 1731 | m_PrefabAsset: {fileID: 0} 1732 | m_GameObject: {fileID: 1761283555} 1733 | m_Enabled: 1 1734 | m_EditorHideFlags: 0 1735 | m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3} 1736 | m_Name: 1737 | m_EditorClassIdentifier: 1738 | m_FirstSelected: {fileID: 0} 1739 | m_sendNavigationEvents: 1 1740 | m_DragThreshold: 10 1741 | --- !u!4 &1761283558 1742 | Transform: 1743 | m_ObjectHideFlags: 0 1744 | m_CorrespondingSourceObject: {fileID: 0} 1745 | m_PrefabInstance: {fileID: 0} 1746 | m_PrefabAsset: {fileID: 0} 1747 | m_GameObject: {fileID: 1761283555} 1748 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 1749 | m_LocalPosition: {x: 0, y: 0, z: 0} 1750 | m_LocalScale: {x: 1, y: 1, z: 1} 1751 | m_ConstrainProportionsScale: 0 1752 | m_Children: [] 1753 | m_Father: {fileID: 0} 1754 | m_RootOrder: 0 1755 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 1756 | --- !u!1 &1793382480 1757 | GameObject: 1758 | m_ObjectHideFlags: 0 1759 | m_CorrespondingSourceObject: {fileID: 0} 1760 | m_PrefabInstance: {fileID: 0} 1761 | m_PrefabAsset: {fileID: 0} 1762 | serializedVersion: 6 1763 | m_Component: 1764 | - component: {fileID: 1793382481} 1765 | - component: {fileID: 1793382482} 1766 | m_Layer: 0 1767 | m_Name: Test_Transform_Animator (2) 1768 | m_TagString: Untagged 1769 | m_Icon: {fileID: 0} 1770 | m_NavMeshLayer: 0 1771 | m_StaticEditorFlags: 0 1772 | m_IsActive: 1 1773 | --- !u!4 &1793382481 1774 | Transform: 1775 | m_ObjectHideFlags: 0 1776 | m_CorrespondingSourceObject: {fileID: 0} 1777 | m_PrefabInstance: {fileID: 0} 1778 | m_PrefabAsset: {fileID: 0} 1779 | m_GameObject: {fileID: 1793382480} 1780 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 1781 | m_LocalPosition: {x: 0, y: 0, z: 0} 1782 | m_LocalScale: {x: 1, y: 1, z: 1} 1783 | m_ConstrainProportionsScale: 0 1784 | m_Children: [] 1785 | m_Father: {fileID: 727083143} 1786 | m_RootOrder: 3 1787 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 1788 | --- !u!95 &1793382482 1789 | Animator: 1790 | serializedVersion: 4 1791 | m_ObjectHideFlags: 0 1792 | m_CorrespondingSourceObject: {fileID: 0} 1793 | m_PrefabInstance: {fileID: 0} 1794 | m_PrefabAsset: {fileID: 0} 1795 | m_GameObject: {fileID: 1793382480} 1796 | m_Enabled: 1 1797 | m_Avatar: {fileID: 0} 1798 | m_Controller: {fileID: 0} 1799 | m_CullingMode: 0 1800 | m_UpdateMode: 0 1801 | m_ApplyRootMotion: 0 1802 | m_LinearVelocityBlending: 0 1803 | m_StabilizeFeet: 0 1804 | m_WarningMessage: 1805 | m_HasTransformHierarchy: 1 1806 | m_AllowConstantClipSamplingOptimization: 1 1807 | m_KeepAnimatorControllerStateOnDisable: 0 1808 | --- !u!1 &1799480872 1809 | GameObject: 1810 | m_ObjectHideFlags: 0 1811 | m_CorrespondingSourceObject: {fileID: 0} 1812 | m_PrefabInstance: {fileID: 0} 1813 | m_PrefabAsset: {fileID: 0} 1814 | serializedVersion: 6 1815 | m_Component: 1816 | - component: {fileID: 1799480873} 1817 | - component: {fileID: 1799480874} 1818 | m_Layer: 5 1819 | m_Name: Test4_* 1820 | m_TagString: Untagged 1821 | m_Icon: {fileID: 0} 1822 | m_NavMeshLayer: 0 1823 | m_StaticEditorFlags: 0 1824 | m_IsActive: 1 1825 | --- !u!224 &1799480873 1826 | RectTransform: 1827 | m_ObjectHideFlags: 0 1828 | m_CorrespondingSourceObject: {fileID: 0} 1829 | m_PrefabInstance: {fileID: 0} 1830 | m_PrefabAsset: {fileID: 0} 1831 | m_GameObject: {fileID: 1799480872} 1832 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 1833 | m_LocalPosition: {x: 0, y: 0, z: 0} 1834 | m_LocalScale: {x: 1, y: 1, z: 1} 1835 | m_ConstrainProportionsScale: 0 1836 | m_Children: 1837 | - {fileID: 734554650} 1838 | - {fileID: 313808036} 1839 | - {fileID: 684527769} 1840 | m_Father: {fileID: 1166790939} 1841 | m_RootOrder: 1 1842 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 1843 | m_AnchorMin: {x: 0.5, y: 0.5} 1844 | m_AnchorMax: {x: 0.5, y: 0.5} 1845 | m_AnchoredPosition: {x: 0, y: 0} 1846 | m_SizeDelta: {x: 160, y: 20} 1847 | m_Pivot: {x: 0.5, y: 0.5} 1848 | --- !u!114 &1799480874 1849 | MonoBehaviour: 1850 | m_ObjectHideFlags: 0 1851 | m_CorrespondingSourceObject: {fileID: 0} 1852 | m_PrefabInstance: {fileID: 0} 1853 | m_PrefabAsset: {fileID: 0} 1854 | m_GameObject: {fileID: 1799480872} 1855 | m_Enabled: 1 1856 | m_EditorHideFlags: 0 1857 | m_Script: {fileID: 11500000, guid: 67db9e8f0e2ae9c40bc1e2b64352a6b4, type: 3} 1858 | m_Name: 1859 | m_EditorClassIdentifier: 1860 | m_Navigation: 1861 | m_Mode: 3 1862 | m_WrapAround: 0 1863 | m_SelectOnUp: {fileID: 0} 1864 | m_SelectOnDown: {fileID: 0} 1865 | m_SelectOnLeft: {fileID: 0} 1866 | m_SelectOnRight: {fileID: 0} 1867 | m_Transition: 1 1868 | m_Colors: 1869 | m_NormalColor: {r: 1, g: 1, b: 1, a: 1} 1870 | m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} 1871 | m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} 1872 | m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} 1873 | m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} 1874 | m_ColorMultiplier: 1 1875 | m_FadeDuration: 0.1 1876 | m_SpriteState: 1877 | m_HighlightedSprite: {fileID: 0} 1878 | m_PressedSprite: {fileID: 0} 1879 | m_SelectedSprite: {fileID: 0} 1880 | m_DisabledSprite: {fileID: 0} 1881 | m_AnimationTriggers: 1882 | m_NormalTrigger: Normal 1883 | m_HighlightedTrigger: Highlighted 1884 | m_PressedTrigger: Pressed 1885 | m_SelectedTrigger: Selected 1886 | m_DisabledTrigger: Disabled 1887 | m_Interactable: 1 1888 | m_TargetGraphic: {fileID: 1397575959} 1889 | m_FillRect: {fileID: 468142595} 1890 | m_HandleRect: {fileID: 1397575958} 1891 | m_Direction: 0 1892 | m_MinValue: 0 1893 | m_MaxValue: 1 1894 | m_WholeNumbers: 0 1895 | m_Value: 0 1896 | m_OnValueChanged: 1897 | m_PersistentCalls: 1898 | m_Calls: [] 1899 | --- !u!1 &1829786441 1900 | GameObject: 1901 | m_ObjectHideFlags: 0 1902 | m_CorrespondingSourceObject: {fileID: 0} 1903 | m_PrefabInstance: {fileID: 0} 1904 | m_PrefabAsset: {fileID: 0} 1905 | serializedVersion: 6 1906 | m_Component: 1907 | - component: {fileID: 1829786442} 1908 | - component: {fileID: 1829786443} 1909 | m_Layer: 0 1910 | m_Name: Test2_* (3) 1911 | m_TagString: Untagged 1912 | m_Icon: {fileID: 0} 1913 | m_NavMeshLayer: 0 1914 | m_StaticEditorFlags: 0 1915 | m_IsActive: 1 1916 | --- !u!4 &1829786442 1917 | Transform: 1918 | m_ObjectHideFlags: 0 1919 | m_CorrespondingSourceObject: {fileID: 0} 1920 | m_PrefabInstance: {fileID: 0} 1921 | m_PrefabAsset: {fileID: 0} 1922 | m_GameObject: {fileID: 1829786441} 1923 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 1924 | m_LocalPosition: {x: 0, y: 0, z: 0} 1925 | m_LocalScale: {x: 1, y: 1, z: 1} 1926 | m_ConstrainProportionsScale: 0 1927 | m_Children: [] 1928 | m_Father: {fileID: 727083143} 1929 | m_RootOrder: 10 1930 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 1931 | --- !u!95 &1829786443 1932 | Animator: 1933 | serializedVersion: 4 1934 | m_ObjectHideFlags: 0 1935 | m_CorrespondingSourceObject: {fileID: 0} 1936 | m_PrefabInstance: {fileID: 0} 1937 | m_PrefabAsset: {fileID: 0} 1938 | m_GameObject: {fileID: 1829786441} 1939 | m_Enabled: 1 1940 | m_Avatar: {fileID: 0} 1941 | m_Controller: {fileID: 0} 1942 | m_CullingMode: 0 1943 | m_UpdateMode: 0 1944 | m_ApplyRootMotion: 0 1945 | m_LinearVelocityBlending: 0 1946 | m_StabilizeFeet: 0 1947 | m_WarningMessage: 1948 | m_HasTransformHierarchy: 1 1949 | m_AllowConstantClipSamplingOptimization: 1 1950 | m_KeepAnimatorControllerStateOnDisable: 0 1951 | --- !u!1 &1998178783 1952 | GameObject: 1953 | m_ObjectHideFlags: 0 1954 | m_CorrespondingSourceObject: {fileID: 0} 1955 | m_PrefabInstance: {fileID: 0} 1956 | m_PrefabAsset: {fileID: 0} 1957 | serializedVersion: 6 1958 | m_Component: 1959 | - component: {fileID: 1998178784} 1960 | - component: {fileID: 1998178786} 1961 | - component: {fileID: 1998178785} 1962 | m_Layer: 5 1963 | m_Name: Fill 1964 | m_TagString: Untagged 1965 | m_Icon: {fileID: 0} 1966 | m_NavMeshLayer: 0 1967 | m_StaticEditorFlags: 0 1968 | m_IsActive: 1 1969 | --- !u!224 &1998178784 1970 | RectTransform: 1971 | m_ObjectHideFlags: 0 1972 | m_CorrespondingSourceObject: {fileID: 0} 1973 | m_PrefabInstance: {fileID: 0} 1974 | m_PrefabAsset: {fileID: 0} 1975 | m_GameObject: {fileID: 1998178783} 1976 | m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} 1977 | m_LocalPosition: {x: 0, y: 0, z: 0} 1978 | m_LocalScale: {x: 1, y: 1, z: 1} 1979 | m_ConstrainProportionsScale: 0 1980 | m_Children: [] 1981 | m_Father: {fileID: 1203590859} 1982 | m_RootOrder: 0 1983 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 1984 | m_AnchorMin: {x: 0, y: 0} 1985 | m_AnchorMax: {x: 0, y: 0} 1986 | m_AnchoredPosition: {x: 0, y: 0} 1987 | m_SizeDelta: {x: 10, y: 0} 1988 | m_Pivot: {x: 0.5, y: 0.5} 1989 | --- !u!114 &1998178785 1990 | MonoBehaviour: 1991 | m_ObjectHideFlags: 0 1992 | m_CorrespondingSourceObject: {fileID: 0} 1993 | m_PrefabInstance: {fileID: 0} 1994 | m_PrefabAsset: {fileID: 0} 1995 | m_GameObject: {fileID: 1998178783} 1996 | m_Enabled: 1 1997 | m_EditorHideFlags: 0 1998 | m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} 1999 | m_Name: 2000 | m_EditorClassIdentifier: 2001 | m_Material: {fileID: 0} 2002 | m_Color: {r: 1, g: 1, b: 1, a: 1} 2003 | m_RaycastTarget: 1 2004 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 2005 | m_Maskable: 1 2006 | m_OnCullStateChanged: 2007 | m_PersistentCalls: 2008 | m_Calls: [] 2009 | m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} 2010 | m_Type: 1 2011 | m_PreserveAspect: 0 2012 | m_FillCenter: 1 2013 | m_FillMethod: 4 2014 | m_FillAmount: 1 2015 | m_FillClockwise: 1 2016 | m_FillOrigin: 0 2017 | m_UseSpriteMesh: 0 2018 | m_PixelsPerUnitMultiplier: 1 2019 | --- !u!222 &1998178786 2020 | CanvasRenderer: 2021 | m_ObjectHideFlags: 0 2022 | m_CorrespondingSourceObject: {fileID: 0} 2023 | m_PrefabInstance: {fileID: 0} 2024 | m_PrefabAsset: {fileID: 0} 2025 | m_GameObject: {fileID: 1998178783} 2026 | m_CullTransparentMesh: 1 2027 | --- !u!1 &2095429736 2028 | GameObject: 2029 | m_ObjectHideFlags: 0 2030 | m_CorrespondingSourceObject: {fileID: 0} 2031 | m_PrefabInstance: {fileID: 0} 2032 | m_PrefabAsset: {fileID: 0} 2033 | serializedVersion: 6 2034 | m_Component: 2035 | - component: {fileID: 2095429737} 2036 | - component: {fileID: 2095429738} 2037 | m_Layer: 5 2038 | m_Name: Test3_Transform_Slider 2039 | m_TagString: Untagged 2040 | m_Icon: {fileID: 0} 2041 | m_NavMeshLayer: 0 2042 | m_StaticEditorFlags: 0 2043 | m_IsActive: 1 2044 | --- !u!224 &2095429737 2045 | RectTransform: 2046 | m_ObjectHideFlags: 0 2047 | m_CorrespondingSourceObject: {fileID: 0} 2048 | m_PrefabInstance: {fileID: 0} 2049 | m_PrefabAsset: {fileID: 0} 2050 | m_GameObject: {fileID: 2095429736} 2051 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 2052 | m_LocalPosition: {x: 0, y: 0, z: 0} 2053 | m_LocalScale: {x: 1, y: 1, z: 1} 2054 | m_ConstrainProportionsScale: 0 2055 | m_Children: 2056 | - {fileID: 974169899} 2057 | - {fileID: 1203590859} 2058 | - {fileID: 288023356} 2059 | m_Father: {fileID: 1166790939} 2060 | m_RootOrder: 0 2061 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 2062 | m_AnchorMin: {x: 0.5, y: 0.5} 2063 | m_AnchorMax: {x: 0.5, y: 0.5} 2064 | m_AnchoredPosition: {x: 0, y: 0} 2065 | m_SizeDelta: {x: 160, y: 20} 2066 | m_Pivot: {x: 0.5, y: 0.5} 2067 | --- !u!114 &2095429738 2068 | MonoBehaviour: 2069 | m_ObjectHideFlags: 0 2070 | m_CorrespondingSourceObject: {fileID: 0} 2071 | m_PrefabInstance: {fileID: 0} 2072 | m_PrefabAsset: {fileID: 0} 2073 | m_GameObject: {fileID: 2095429736} 2074 | m_Enabled: 1 2075 | m_EditorHideFlags: 0 2076 | m_Script: {fileID: 11500000, guid: 67db9e8f0e2ae9c40bc1e2b64352a6b4, type: 3} 2077 | m_Name: 2078 | m_EditorClassIdentifier: 2079 | m_Navigation: 2080 | m_Mode: 3 2081 | m_WrapAround: 0 2082 | m_SelectOnUp: {fileID: 0} 2083 | m_SelectOnDown: {fileID: 0} 2084 | m_SelectOnLeft: {fileID: 0} 2085 | m_SelectOnRight: {fileID: 0} 2086 | m_Transition: 1 2087 | m_Colors: 2088 | m_NormalColor: {r: 1, g: 1, b: 1, a: 1} 2089 | m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} 2090 | m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} 2091 | m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} 2092 | m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} 2093 | m_ColorMultiplier: 1 2094 | m_FadeDuration: 0.1 2095 | m_SpriteState: 2096 | m_HighlightedSprite: {fileID: 0} 2097 | m_PressedSprite: {fileID: 0} 2098 | m_SelectedSprite: {fileID: 0} 2099 | m_DisabledSprite: {fileID: 0} 2100 | m_AnimationTriggers: 2101 | m_NormalTrigger: Normal 2102 | m_HighlightedTrigger: Highlighted 2103 | m_PressedTrigger: Pressed 2104 | m_SelectedTrigger: Selected 2105 | m_DisabledTrigger: Disabled 2106 | m_Interactable: 1 2107 | m_TargetGraphic: {fileID: 932792624} 2108 | m_FillRect: {fileID: 1998178784} 2109 | m_HandleRect: {fileID: 932792623} 2110 | m_Direction: 0 2111 | m_MinValue: 0 2112 | m_MaxValue: 1 2113 | m_WholeNumbers: 0 2114 | m_Value: 0 2115 | m_OnValueChanged: 2116 | m_PersistentCalls: 2117 | m_Calls: [] 2118 | --- !u!1 &2132282596 2119 | GameObject: 2120 | m_ObjectHideFlags: 0 2121 | m_CorrespondingSourceObject: {fileID: 0} 2122 | m_PrefabInstance: {fileID: 0} 2123 | m_PrefabAsset: {fileID: 0} 2124 | serializedVersion: 6 2125 | m_Component: 2126 | - component: {fileID: 2132282597} 2127 | - component: {fileID: 2132282598} 2128 | m_Layer: 0 2129 | m_Name: Test2_* (0) 2130 | m_TagString: Untagged 2131 | m_Icon: {fileID: 0} 2132 | m_NavMeshLayer: 0 2133 | m_StaticEditorFlags: 0 2134 | m_IsActive: 1 2135 | --- !u!4 &2132282597 2136 | Transform: 2137 | m_ObjectHideFlags: 0 2138 | m_CorrespondingSourceObject: {fileID: 0} 2139 | m_PrefabInstance: {fileID: 0} 2140 | m_PrefabAsset: {fileID: 0} 2141 | m_GameObject: {fileID: 2132282596} 2142 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 2143 | m_LocalPosition: {x: 0, y: 0, z: 0} 2144 | m_LocalScale: {x: 1, y: 1, z: 1} 2145 | m_ConstrainProportionsScale: 0 2146 | m_Children: [] 2147 | m_Father: {fileID: 727083143} 2148 | m_RootOrder: 7 2149 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 2150 | --- !u!95 &2132282598 2151 | Animator: 2152 | serializedVersion: 4 2153 | m_ObjectHideFlags: 0 2154 | m_CorrespondingSourceObject: {fileID: 0} 2155 | m_PrefabInstance: {fileID: 0} 2156 | m_PrefabAsset: {fileID: 0} 2157 | m_GameObject: {fileID: 2132282596} 2158 | m_Enabled: 1 2159 | m_Avatar: {fileID: 0} 2160 | m_Controller: {fileID: 0} 2161 | m_CullingMode: 0 2162 | m_UpdateMode: 0 2163 | m_ApplyRootMotion: 0 2164 | m_LinearVelocityBlending: 0 2165 | m_StabilizeFeet: 0 2166 | m_WarningMessage: 2167 | m_HasTransformHierarchy: 1 2168 | m_AllowConstantClipSamplingOptimization: 1 2169 | m_KeepAnimatorControllerStateOnDisable: 0 2170 | --------------------------------------------------------------------------------