diff --git a/.vscode/settings.json b/.vscode/settings.json index 2e61b068e..defd0b794 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -71,6 +71,7 @@ "aspnetcore", "codeanalysis", "dependencyinjection", + "HDRP", "ivanmurzak", "Murzak", "openupm", diff --git a/Assets/Demo Setup/Scenes/NoLightmap.unity b/Assets/Demo Setup/Scenes/NoLightmap.unity new file mode 100644 index 000000000..ed733f177 --- /dev/null +++ b/Assets/Demo Setup/Scenes/NoLightmap.unity @@ -0,0 +1,316 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 12 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 512 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 256 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 1 + m_PVRDenoiserTypeDirect: 1 + m_PVRDenoiserTypeIndirect: 1 + m_PVRDenoiserTypeAO: 1 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 + m_LightingDataAsset: {fileID: 0} + m_LightingSettings: {fileID: 0} +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 3 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + buildHeightMesh: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &254330902 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 254330905} + - component: {fileID: 254330904} + - component: {fileID: 254330903} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &254330903 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 254330902} + m_Enabled: 1 +--- !u!20 &254330904 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 254330902} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_Iso: 200 + m_ShutterSpeed: 0.005 + m_Aperture: 16 + m_FocusDistance: 10 + m_FocalLength: 50 + m_BladeCount: 5 + m_Curvature: {x: 2, y: 11} + m_BarrelClipping: 0.25 + m_Anamorphism: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &254330905 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 254330902} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1929042617 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1929042619} + - component: {fileID: 1929042618} + m_Layer: 0 + m_Name: Directional Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &1929042618 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1929042617} + m_Enabled: 1 + serializedVersion: 10 + m_Type: 1 + m_Shape: 0 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 1 + m_Range: 10 + m_SpotAngle: 30 + m_InnerSpotAngle: 21.80208 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_CullingMatrixOverride: + e00: 1 + e01: 0 + e02: 0 + e03: 0 + e10: 0 + e11: 1 + e12: 0 + e13: 0 + e20: 0 + e21: 0 + e22: 1 + e23: 0 + e30: 0 + e31: 0 + e32: 0 + e33: 1 + m_UseCullingMatrixOverride: 0 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingLayerMask: 1 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} + m_UseBoundingSphereOverride: 0 + m_UseViewFrustumForShadowCasterCull: 1 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &1929042619 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1929042617} + serializedVersion: 2 + m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} + m_LocalPosition: {x: 0, y: 3, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} +--- !u!1660057539 &9223372036854775807 +SceneRoots: + m_ObjectHideFlags: 0 + m_Roots: + - {fileID: 254330905} + - {fileID: 1929042619} diff --git a/Assets/Demo Setup/Scenes/NoLightmap.unity.meta b/Assets/Demo Setup/Scenes/NoLightmap.unity.meta new file mode 100644 index 000000000..37918a438 --- /dev/null +++ b/Assets/Demo Setup/Scenes/NoLightmap.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 2b30ef47f4fdab945aefb246f19b0ba9 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/root/Editor/Scripts/API/Tool/GameObject.DestroyComponents.cs b/Assets/root/Editor/Scripts/API/Tool/GameObject.DestroyComponents.cs index 4192c26d3..f170919a5 100644 --- a/Assets/root/Editor/Scripts/API/Tool/GameObject.DestroyComponents.cs +++ b/Assets/root/Editor/Scripts/API/Tool/GameObject.DestroyComponents.cs @@ -7,6 +7,7 @@ using com.IvanMurzak.ReflectorNet.Model.Unity; using com.IvanMurzak.Unity.MCP.Utils; using com.IvanMurzak.ReflectorNet.Utils; +using com.IvanMurzak.ReflectorNet; namespace com.IvanMurzak.Unity.MCP.Editor.API { @@ -39,14 +40,14 @@ ComponentRefList destroyComponentRefs { UnityEngine.Object.DestroyImmediate(component); destroyCounter++; - stringBuilder.AppendLine($"[Success] Destroyed component instanceID='{component.GetInstanceID()}', type='{component.GetType().FullName}'."); + stringBuilder.AppendLine($"[Success] Destroyed component instanceID='{component.GetInstanceID()}', type='{component.GetType().GetTypeName(pretty: false)}'."); } } if (destroyCounter == 0) return Error.NotFoundComponents(destroyComponentRefs, allComponents); - return $"[Success] Destroyed {destroyCounter} components from GameObject.\n{stringBuilder.ToString()}"; + return $"[Success] Destroyed {destroyCounter} components from GameObject.\n{stringBuilder}"; }); } } \ No newline at end of file diff --git a/Assets/root/Editor/Scripts/API/Tool/GameObject.Modify.cs b/Assets/root/Editor/Scripts/API/Tool/GameObject.Modify.cs index 861276435..8edf6bf1f 100644 --- a/Assets/root/Editor/Scripts/API/Tool/GameObject.Modify.cs +++ b/Assets/root/Editor/Scripts/API/Tool/GameObject.Modify.cs @@ -7,6 +7,7 @@ using com.IvanMurzak.ReflectorNet.Model; using com.IvanMurzak.ReflectorNet.Utils; using com.IvanMurzak.ReflectorNet; +using UnityEngine; namespace com.IvanMurzak.Unity.MCP.Editor.API { @@ -21,13 +22,15 @@ public partial class Tool_GameObject You can modify multiple GameObjects at once. Just provide the same number of GameObject references and SerializedMember objects.")] public string Modify ( - [Description(@"Json Object with required readonly 'instanceID' and 'type' fields. -Each field and property requires to have 'type' and 'name' fields to identify the exact modification target. -Follow the object schema to specify what to change, ignore values that should not be modified. Keep the original data structure. -Any unknown or wrong located fields and properties will be ignored. -Check the result of this command to see what was changed. The ignored fields and properties will be listed.")] - SerializedMemberList gameObjectDiffs, - GameObjectRefList gameObjectRefs + GameObjectRefList gameObjectRefs, + [Description("Each item in the array represents a GameObject modification of the 'gameObjectRefs' at the same index.\n" + + "Usually a GameObject is a container for components. Each component may have fields and properties for modification.\n" + + "If you need to modify components of a gameObject, please use '" + nameof(SerializedMember.fields) + "' to wrap a component into it. " + + "Each component needs to have '" + nameof(SerializedMember.typeName) + "' and '" + nameof(SerializedMember.name) + "' or 'value." + nameof(GameObjectRef.instanceID) + "' fields to identify the exact modification target.\n" + + "Ignore values that should not be modified.\n" + + "Any unknown or wrong located fields and properties will be ignored.\n" + + "Check the result of this command to see what was changed. The ignored fields and properties will be listed.")] + SerializedMemberList gameObjectDiffs ) => MainThread.Instance.Run(() => { @@ -55,12 +58,12 @@ GameObjectRefList gameObjectRefs var component = go.GetComponent(type); if (component == null) { - stringBuilder.AppendLine($"[Error] Component '{type.FullName}' not found on GameObject '{go.name}'."); + stringBuilder.AppendLine($"[Error] Component '{type.GetTypeName(pretty: false)}' not found on GameObject '{go.name.ValueOrNull()}'."); continue; } objToModify = component; } - Reflector.Instance.Populate(ref objToModify, gameObjectDiffs[i], stringBuilder); + Reflector.Instance.Populate(ref objToModify, gameObjectDiffs[i], objToModify.GetType(), stringBuilder: stringBuilder); } return stringBuilder.ToString(); diff --git a/Assets/root/Editor/Scripts/API/Tool/GameObject.cs b/Assets/root/Editor/Scripts/API/Tool/GameObject.cs index 53cd6b657..17eeb3804 100644 --- a/Assets/root/Editor/Scripts/API/Tool/GameObject.cs +++ b/Assets/root/Editor/Scripts/API/Tool/GameObject.cs @@ -37,9 +37,9 @@ public static string NotFoundGameObjectWithInstanceID(int instanceID) public static string TypeMismatch(string typeName, string expectedTypeName) => $"[Error] Type mismatch. Expected '{expectedTypeName}', but got '{typeName}'."; public static string InvalidComponentPropertyType(SerializedMember serializedProperty, PropertyInfo propertyInfo) - => $"[Error] Invalid component property type '{serializedProperty.typeName}' for '{propertyInfo.Name}'. Expected '{propertyInfo.PropertyType.FullName}'."; + => $"[Error] Invalid component property type '{serializedProperty.typeName}' for '{propertyInfo.Name}'. Expected '{propertyInfo.PropertyType.GetTypeName(pretty: false)}'."; public static string InvalidComponentFieldType(SerializedMember serializedProperty, FieldInfo propertyInfo) - => $"[Error] Invalid component property type '{serializedProperty.typeName}' for '{propertyInfo.Name}'. Expected '{propertyInfo.FieldType.FullName}'."; + => $"[Error] Invalid component field type '{serializedProperty.typeName}' for '{propertyInfo.Name}'. Expected '{propertyInfo.FieldType.GetTypeName(pretty: false)}'."; public static string InvalidComponentType(string typeName) => $"[Error] Invalid component type '{typeName}'. It should be a valid Component Type."; public static string NotFoundComponent(int componentInstanceID, IEnumerable allComponents) @@ -84,7 +84,7 @@ public static string ComponentPropertyTypeIsEmpty() => $"[Error] Component property type is empty. It should be a valid property type."; public static string InvalidInstanceID(Type holderType, string fieldName) - => $"[Error] Invalid instanceID '{fieldName}' for '{holderType.FullName}'. It should be a valid field name."; + => $"[Error] Invalid instanceID '{fieldName}' for '{holderType.GetTypeName(pretty: false)}'. It should be a valid field name."; } } } \ No newline at end of file diff --git a/Assets/root/Editor/Scripts/API/Tool/Reflection.MethodCall.cs b/Assets/root/Editor/Scripts/API/Tool/Reflection.MethodCall.cs index a2389c95d..4e719a403 100644 --- a/Assets/root/Editor/Scripts/API/Tool/Reflection.MethodCall.cs +++ b/Assets/root/Editor/Scripts/API/Tool/Reflection.MethodCall.cs @@ -121,7 +121,7 @@ out var error { var dictInputParameters = inputParameters?.ToImmutableDictionary( keySelector: p => p.name, - elementSelector: p => Reflector.Instance.Deserialize(p, McpPlugin.Instance.Logger) + elementSelector: p => Reflector.Instance.Deserialize(p, logger: McpPlugin.Instance.Logger) ); var methodWrapper = default(MethodWrapper); @@ -134,7 +134,7 @@ out var error else { // Object instance needed. Probably instance method. - var obj = Reflector.Instance.Deserialize(targetObject, McpPlugin.Instance.Logger); + var obj = Reflector.Instance.Deserialize(targetObject, logger: McpPlugin.Instance.Logger); if (obj == null) return $"[Error] '{nameof(targetObject)}' deserialized instance is null. Please specify the '{nameof(targetObject)}' properly."; diff --git a/Assets/root/Editor/Scripts/API/Tool/Reflection.cs b/Assets/root/Editor/Scripts/API/Tool/Reflection.cs index 461041c80..f56fd7dc0 100644 --- a/Assets/root/Editor/Scripts/API/Tool/Reflection.cs +++ b/Assets/root/Editor/Scripts/API/Tool/Reflection.cs @@ -6,6 +6,7 @@ using com.IvanMurzak.Unity.MCP.Common; using com.IvanMurzak.ReflectorNet.Model; using com.IvanMurzak.ReflectorNet.Utils; +using com.IvanMurzak.ReflectorNet; namespace com.IvanMurzak.Unity.MCP.Editor.API { @@ -61,7 +62,7 @@ static int Compare(ParameterInfo[] original, List va if (parameter.Name != methodRefParameter.Name) return 1; - if (parameter.ParameterType.FullName != methodRefParameter.TypeName) + if (parameter.ParameterType.IsMatch(methodRefParameter.TypeName) == false) return 1; } diff --git a/Assets/root/Editor/Scripts/API/Tool/TestRunner/CombinedTestResultCollector.cs.meta b/Assets/root/Editor/Scripts/API/Tool/TestRunner/CombinedTestResultCollector.cs.meta index a6e4cc695..5518cca32 100644 --- a/Assets/root/Editor/Scripts/API/Tool/TestRunner/CombinedTestResultCollector.cs.meta +++ b/Assets/root/Editor/Scripts/API/Tool/TestRunner/CombinedTestResultCollector.cs.meta @@ -1,2 +1,11 @@ fileFormatVersion: 2 -guid: fff8a3c10f9baa745b65ed0ce595ef92 \ No newline at end of file +guid: fff8a3c10f9baa745b65ed0ce595ef92 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/root/Editor/Scripts/API/Tool/TestRunner/TestFilterParameters.cs.meta b/Assets/root/Editor/Scripts/API/Tool/TestRunner/TestFilterParameters.cs.meta index 66b0b2a63..1e220d2c7 100644 --- a/Assets/root/Editor/Scripts/API/Tool/TestRunner/TestFilterParameters.cs.meta +++ b/Assets/root/Editor/Scripts/API/Tool/TestRunner/TestFilterParameters.cs.meta @@ -1,2 +1,11 @@ fileFormatVersion: 2 -guid: 0e108c87a711fb44a80210bcef392630 \ No newline at end of file +guid: 0e108c87a711fb44a80210bcef392630 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/root/Editor/Scripts/API/Tool/TestRunner/TestResultCollector.cs.meta b/Assets/root/Editor/Scripts/API/Tool/TestRunner/TestResultCollector.cs.meta index 756376a4a..21ebf4e53 100644 --- a/Assets/root/Editor/Scripts/API/Tool/TestRunner/TestResultCollector.cs.meta +++ b/Assets/root/Editor/Scripts/API/Tool/TestRunner/TestResultCollector.cs.meta @@ -1,2 +1,11 @@ fileFormatVersion: 2 -guid: f8b94719feeb71649aa6912965b85137 \ No newline at end of file +guid: f8b94719feeb71649aa6912965b85137 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/root/Editor/Scripts/API/Tool/TestRunner/TestResultData.cs.meta b/Assets/root/Editor/Scripts/API/Tool/TestRunner/TestResultData.cs.meta index 6a00136e9..cf073b7d2 100644 --- a/Assets/root/Editor/Scripts/API/Tool/TestRunner/TestResultData.cs.meta +++ b/Assets/root/Editor/Scripts/API/Tool/TestRunner/TestResultData.cs.meta @@ -1,2 +1,11 @@ fileFormatVersion: 2 -guid: 62be5ad599c31f94ea40d7e39dadecce \ No newline at end of file +guid: 62be5ad599c31f94ea40d7e39dadecce +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/root/Editor/Scripts/API/Tool/TestRunner/TestRunStatus.cs.meta b/Assets/root/Editor/Scripts/API/Tool/TestRunner/TestRunStatus.cs.meta index b19979036..629bee6e9 100644 --- a/Assets/root/Editor/Scripts/API/Tool/TestRunner/TestRunStatus.cs.meta +++ b/Assets/root/Editor/Scripts/API/Tool/TestRunner/TestRunStatus.cs.meta @@ -1,2 +1,11 @@ fileFormatVersion: 2 -guid: 7384e67e5cab5d5419dbe4fb0c017d12 \ No newline at end of file +guid: 7384e67e5cab5d5419dbe4fb0c017d12 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/root/Editor/Scripts/API/Tool/TestRunner/TestSummaryData.cs.meta b/Assets/root/Editor/Scripts/API/Tool/TestRunner/TestSummaryData.cs.meta index f83e9899a..caf39d079 100644 --- a/Assets/root/Editor/Scripts/API/Tool/TestRunner/TestSummaryData.cs.meta +++ b/Assets/root/Editor/Scripts/API/Tool/TestRunner/TestSummaryData.cs.meta @@ -1,2 +1,11 @@ fileFormatVersion: 2 -guid: 30029f5049b65f040ad510bfebf25597 \ No newline at end of file +guid: 30029f5049b65f040ad510bfebf25597 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/root/Plugins/com.IvanMurzak.ReflectorNet/ReflectorNet.dll b/Assets/root/Plugins/com.IvanMurzak.ReflectorNet/ReflectorNet.dll index 620d61786..ca79dfd15 100644 Binary files a/Assets/root/Plugins/com.IvanMurzak.ReflectorNet/ReflectorNet.dll and b/Assets/root/Plugins/com.IvanMurzak.ReflectorNet/ReflectorNet.dll differ diff --git a/Assets/root/Runtime/Config/McpPluginUnity.Startup.cs b/Assets/root/Runtime/Config/McpPluginUnity.Startup.cs index 74559e6b2..3fe532f8f 100644 --- a/Assets/root/Runtime/Config/McpPluginUnity.Startup.cs +++ b/Assets/root/Runtime/Config/McpPluginUnity.Startup.cs @@ -86,6 +86,10 @@ static Reflector CreateDefaultReflector() reflector.Convertors.Add(new RS_UnityEngineVector3()); reflector.Convertors.Add(new RS_UnityEngineVector3Int()); reflector.Convertors.Add(new RS_UnityEngineVector4()); + reflector.Convertors.Add(new RS_UnityEngineBounds()); + reflector.Convertors.Add(new RS_UnityEngineBoundsInt()); + reflector.Convertors.Add(new RS_UnityEngineRect()); + reflector.Convertors.Add(new RS_UnityEngineRectInt()); // Components reflector.Convertors.Add(new RS_UnityEngineObject()); diff --git a/Assets/root/Runtime/Extensions/ExtensionsComponentRef.cs b/Assets/root/Runtime/Extensions/ExtensionsComponentRef.cs index e858720db..fdb7e802b 100644 --- a/Assets/root/Runtime/Extensions/ExtensionsComponentRef.cs +++ b/Assets/root/Runtime/Extensions/ExtensionsComponentRef.cs @@ -1,5 +1,7 @@ #pragma warning disable CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. +using com.IvanMurzak.ReflectorNet; using com.IvanMurzak.ReflectorNet.Model.Unity; +using com.IvanMurzak.ReflectorNet.Utils; namespace com.IvanMurzak.Unity.MCP.Utils { @@ -15,9 +17,9 @@ public static bool Matches(this ComponentRef componentRef, UnityEngine.Component { return componentRef.Index == index.Value; } - if (!string.IsNullOrEmpty(componentRef.TypeName)) + if (!StringUtils.IsNullOrEmpty(componentRef.TypeName)) { - return component.GetType().FullName == componentRef.TypeName; + return component.GetType().IsMatch(componentRef.TypeName); } return false; } diff --git a/Assets/root/Runtime/JsonConverters/Color32Converter.cs b/Assets/root/Runtime/JsonConverters/Color32Converter.cs index 521c0e14d..47c2b76ec 100644 --- a/Assets/root/Runtime/JsonConverters/Color32Converter.cs +++ b/Assets/root/Runtime/JsonConverters/Color32Converter.cs @@ -2,50 +2,52 @@ using System.Text.Json; using System.Text.Json.Nodes; using System.Text.Json.Serialization; +using com.IvanMurzak.ReflectorNet; using com.IvanMurzak.ReflectorNet.Json; +using com.IvanMurzak.ReflectorNet.Utils; using UnityEngine; namespace com.IvanMurzak.Unity.MCP.Common.Json.Converters { public class Color32Converter : JsonConverter, IJsonSchemaConverter { - public string Id => typeof(Color32).FullName; + public string Id => typeof(Color32).GetTypeId(); public JsonNode GetScheme() => new JsonObject { - ["id"] = Id, - ["type"] = "object", - ["properties"] = new JsonObject + [JsonUtils.Schema.Id] = Id, + [JsonUtils.Schema.Type] = JsonUtils.Schema.Object, + [JsonUtils.Schema.Properties] = new JsonObject { ["r"] = new JsonObject { - ["type"] = "integer", - ["minimum"] = 0, - ["maximum"] = 255 + [JsonUtils.Schema.Type] = JsonUtils.Schema.Integer, + [JsonUtils.Schema.Minimum] = 0, + [JsonUtils.Schema.Maximum] = 255 }, ["g"] = new JsonObject { - ["type"] = "integer", - ["minimum"] = 0, - ["maximum"] = 255 + [JsonUtils.Schema.Type] = JsonUtils.Schema.Integer, + [JsonUtils.Schema.Minimum] = 0, + [JsonUtils.Schema.Maximum] = 255 }, ["b"] = new JsonObject { - ["type"] = "integer", - ["minimum"] = 0, - ["maximum"] = 255 + [JsonUtils.Schema.Type] = JsonUtils.Schema.Integer, + [JsonUtils.Schema.Minimum] = 0, + [JsonUtils.Schema.Maximum] = 255 }, ["a"] = new JsonObject { - ["type"] = "integer", - ["minimum"] = 0, - ["maximum"] = 255 + [JsonUtils.Schema.Type] = JsonUtils.Schema.Integer, + [JsonUtils.Schema.Minimum] = 0, + [JsonUtils.Schema.Maximum] = 255 } }, - ["required"] = new JsonArray { "r", "g", "b", "a" } + [JsonUtils.Schema.Required] = new JsonArray { "r", "g", "b", "a" } }; public JsonNode GetSchemeRef() => new JsonObject { - ["$ref"] = Id + [JsonUtils.Schema.Ref] = Id }; public override Color32 Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) diff --git a/Assets/root/Runtime/JsonConverters/ColorConverter.cs b/Assets/root/Runtime/JsonConverters/ColorConverter.cs index bcea05f3a..215876224 100644 --- a/Assets/root/Runtime/JsonConverters/ColorConverter.cs +++ b/Assets/root/Runtime/JsonConverters/ColorConverter.cs @@ -2,50 +2,52 @@ using System.Text.Json; using System.Text.Json.Nodes; using System.Text.Json.Serialization; +using com.IvanMurzak.ReflectorNet; using com.IvanMurzak.ReflectorNet.Json; +using com.IvanMurzak.ReflectorNet.Utils; using UnityEngine; namespace com.IvanMurzak.Unity.MCP.Common.Json.Converters { public class ColorConverter : JsonConverter, IJsonSchemaConverter { - public string Id => typeof(Color).FullName; + public string Id => typeof(Color).GetTypeId(); public JsonNode GetScheme() => new JsonObject { - ["id"] = Id, - ["type"] = "object", - ["properties"] = new JsonObject + [JsonUtils.Schema.Id] = Id, + [JsonUtils.Schema.Type] = JsonUtils.Schema.Object, + [JsonUtils.Schema.Properties] = new JsonObject { ["r"] = new JsonObject { - ["type"] = "number", - ["minimum"] = 0, - ["maximum"] = 1 + [JsonUtils.Schema.Type] = JsonUtils.Schema.Number, + [JsonUtils.Schema.Minimum] = 0, + [JsonUtils.Schema.Maximum] = 1 }, ["g"] = new JsonObject { - ["type"] = "number", - ["minimum"] = 0, - ["maximum"] = 1 + [JsonUtils.Schema.Type] = JsonUtils.Schema.Number, + [JsonUtils.Schema.Minimum] = 0, + [JsonUtils.Schema.Maximum] = 1 }, ["b"] = new JsonObject { - ["type"] = "number", - ["minimum"] = 0, - ["maximum"] = 1 + [JsonUtils.Schema.Type] = JsonUtils.Schema.Number, + [JsonUtils.Schema.Minimum] = 0, + [JsonUtils.Schema.Maximum] = 1 }, ["a"] = new JsonObject { - ["type"] = "number", - ["minimum"] = 0, - ["maximum"] = 1 + [JsonUtils.Schema.Type] = JsonUtils.Schema.Number, + [JsonUtils.Schema.Minimum] = 0, + [JsonUtils.Schema.Maximum] = 1 } }, - ["required"] = new JsonArray { "r", "g", "b", "a" } + [JsonUtils.Schema.Required] = new JsonArray { "r", "g", "b", "a" } }; public JsonNode GetSchemeRef() => new JsonObject { - ["$ref"] = Id + [JsonUtils.Schema.Ref] = Id }; public override Color Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) diff --git a/Assets/root/Runtime/JsonConverters/Matrix4x4Converter.cs b/Assets/root/Runtime/JsonConverters/Matrix4x4Converter.cs index 4497730c2..142dc7463 100644 --- a/Assets/root/Runtime/JsonConverters/Matrix4x4Converter.cs +++ b/Assets/root/Runtime/JsonConverters/Matrix4x4Converter.cs @@ -2,38 +2,40 @@ using System.Text.Json; using System.Text.Json.Nodes; using System.Text.Json.Serialization; +using com.IvanMurzak.ReflectorNet; using com.IvanMurzak.ReflectorNet.Json; +using com.IvanMurzak.ReflectorNet.Utils; using UnityEngine; namespace com.IvanMurzak.Unity.MCP.Common.Json.Converters { public class Matrix4x4Converter : JsonConverter, IJsonSchemaConverter { - public string Id => typeof(Matrix4x4).FullName; + public string Id => typeof(Matrix4x4).GetTypeId(); public JsonNode GetScheme() => new JsonObject { - ["id"] = Id, - ["type"] = "object", - ["properties"] = new JsonObject + [JsonUtils.Schema.Id] = Id, + [JsonUtils.Schema.Type] = JsonUtils.Schema.Object, + [JsonUtils.Schema.Properties] = new JsonObject { - ["m00"] = new JsonObject { ["type"] = "number" }, - ["m01"] = new JsonObject { ["type"] = "number" }, - ["m02"] = new JsonObject { ["type"] = "number" }, - ["m03"] = new JsonObject { ["type"] = "number" }, - ["m10"] = new JsonObject { ["type"] = "number" }, - ["m11"] = new JsonObject { ["type"] = "number" }, - ["m12"] = new JsonObject { ["type"] = "number" }, - ["m13"] = new JsonObject { ["type"] = "number" }, - ["m20"] = new JsonObject { ["type"] = "number" }, - ["m21"] = new JsonObject { ["type"] = "number" }, - ["m22"] = new JsonObject { ["type"] = "number" }, - ["m23"] = new JsonObject { ["type"] = "number" }, - ["m30"] = new JsonObject { ["type"] = "number" }, - ["m31"] = new JsonObject { ["type"] = "number" }, - ["m32"] = new JsonObject { ["type"] = "number" }, - ["m33"] = new JsonObject { ["type"] = "number" } + ["m00"] = new JsonObject { [JsonUtils.Schema.Type] = JsonUtils.Schema.Number }, + ["m01"] = new JsonObject { [JsonUtils.Schema.Type] = JsonUtils.Schema.Number }, + ["m02"] = new JsonObject { [JsonUtils.Schema.Type] = JsonUtils.Schema.Number }, + ["m03"] = new JsonObject { [JsonUtils.Schema.Type] = JsonUtils.Schema.Number }, + ["m10"] = new JsonObject { [JsonUtils.Schema.Type] = JsonUtils.Schema.Number }, + ["m11"] = new JsonObject { [JsonUtils.Schema.Type] = JsonUtils.Schema.Number }, + ["m12"] = new JsonObject { [JsonUtils.Schema.Type] = JsonUtils.Schema.Number }, + ["m13"] = new JsonObject { [JsonUtils.Schema.Type] = JsonUtils.Schema.Number }, + ["m20"] = new JsonObject { [JsonUtils.Schema.Type] = JsonUtils.Schema.Number }, + ["m21"] = new JsonObject { [JsonUtils.Schema.Type] = JsonUtils.Schema.Number }, + ["m22"] = new JsonObject { [JsonUtils.Schema.Type] = JsonUtils.Schema.Number }, + ["m23"] = new JsonObject { [JsonUtils.Schema.Type] = JsonUtils.Schema.Number }, + ["m30"] = new JsonObject { [JsonUtils.Schema.Type] = JsonUtils.Schema.Number }, + ["m31"] = new JsonObject { [JsonUtils.Schema.Type] = JsonUtils.Schema.Number }, + ["m32"] = new JsonObject { [JsonUtils.Schema.Type] = JsonUtils.Schema.Number }, + ["m33"] = new JsonObject { [JsonUtils.Schema.Type] = JsonUtils.Schema.Number } }, - ["required"] = new JsonArray + [JsonUtils.Schema.Required] = new JsonArray { "m00", "m01", "m02", "m03", "m10", "m11", "m12", "m13", @@ -43,7 +45,7 @@ public class Matrix4x4Converter : JsonConverter, IJsonSchemaConverter }; public JsonNode GetSchemeRef() => new JsonObject { - ["$ref"] = Id + [JsonUtils.Schema.Ref] = Id }; public override Matrix4x4 Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) diff --git a/Assets/root/Runtime/JsonConverters/QuaternionConverter.cs b/Assets/root/Runtime/JsonConverters/QuaternionConverter.cs index b761beb53..9847ceba6 100644 --- a/Assets/root/Runtime/JsonConverters/QuaternionConverter.cs +++ b/Assets/root/Runtime/JsonConverters/QuaternionConverter.cs @@ -2,30 +2,32 @@ using System.Text.Json; using System.Text.Json.Nodes; using System.Text.Json.Serialization; +using com.IvanMurzak.ReflectorNet; using com.IvanMurzak.ReflectorNet.Json; +using com.IvanMurzak.ReflectorNet.Utils; using UnityEngine; namespace com.IvanMurzak.Unity.MCP.Common.Json.Converters { public class QuaternionConverter : JsonConverter, IJsonSchemaConverter { - public string Id => typeof(Quaternion).FullName; + public string Id => typeof(Quaternion).GetTypeId(); public JsonNode GetScheme() => new JsonObject { - ["id"] = Id, - ["type"] = "object", - ["properties"] = new JsonObject + [JsonUtils.Schema.Id] = Id, + [JsonUtils.Schema.Type] = JsonUtils.Schema.Object, + [JsonUtils.Schema.Properties] = new JsonObject { - ["x"] = new JsonObject { ["type"] = "number" }, - ["y"] = new JsonObject { ["type"] = "number" }, - ["z"] = new JsonObject { ["type"] = "number" }, - ["w"] = new JsonObject { ["type"] = "number" } + ["x"] = new JsonObject { [JsonUtils.Schema.Type] = JsonUtils.Schema.Number }, + ["y"] = new JsonObject { [JsonUtils.Schema.Type] = JsonUtils.Schema.Number }, + ["z"] = new JsonObject { [JsonUtils.Schema.Type] = JsonUtils.Schema.Number }, + ["w"] = new JsonObject { [JsonUtils.Schema.Type] = JsonUtils.Schema.Number } }, - ["required"] = new JsonArray { "x", "y", "z", "w" } + [JsonUtils.Schema.Required] = new JsonArray { "x", "y", "z", "w" } }; public JsonNode GetSchemeRef() => new JsonObject { - ["$ref"] = Id + [JsonUtils.Schema.Ref] = Id }; public override Quaternion Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) diff --git a/Assets/root/Runtime/JsonConverters/Vector2Converter.cs b/Assets/root/Runtime/JsonConverters/Vector2Converter.cs index 3925fd733..9fbfa848c 100644 --- a/Assets/root/Runtime/JsonConverters/Vector2Converter.cs +++ b/Assets/root/Runtime/JsonConverters/Vector2Converter.cs @@ -2,28 +2,30 @@ using System.Text.Json; using System.Text.Json.Nodes; using System.Text.Json.Serialization; +using com.IvanMurzak.ReflectorNet; using com.IvanMurzak.ReflectorNet.Json; +using com.IvanMurzak.ReflectorNet.Utils; using UnityEngine; namespace com.IvanMurzak.Unity.MCP.Common.Json.Converters { public class Vector2Converter : JsonConverter, IJsonSchemaConverter { - public string Id => typeof(Vector2).FullName; + public string Id => typeof(Vector2).GetTypeId(); public JsonNode GetScheme() => new JsonObject { - ["id"] = Id, - ["type"] = "object", - ["properties"] = new JsonObject + [JsonUtils.Schema.Id] = Id, + [JsonUtils.Schema.Type] = JsonUtils.Schema.Object, + [JsonUtils.Schema.Properties] = new JsonObject { - ["x"] = new JsonObject { ["type"] = "number" }, - ["y"] = new JsonObject { ["type"] = "number" } + ["x"] = new JsonObject { [JsonUtils.Schema.Type] = JsonUtils.Schema.Number }, + ["y"] = new JsonObject { [JsonUtils.Schema.Type] = JsonUtils.Schema.Number } }, - ["required"] = new JsonArray { "x", "y" } + [JsonUtils.Schema.Required] = new JsonArray { "x", "y" } }; public JsonNode GetSchemeRef() => new JsonObject { - ["$ref"] = Id + [JsonUtils.Schema.Ref] = Id }; public override Vector2 Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) diff --git a/Assets/root/Runtime/JsonConverters/Vector2IntConverter.cs b/Assets/root/Runtime/JsonConverters/Vector2IntConverter.cs index 0115c899d..e911f9058 100644 --- a/Assets/root/Runtime/JsonConverters/Vector2IntConverter.cs +++ b/Assets/root/Runtime/JsonConverters/Vector2IntConverter.cs @@ -2,28 +2,30 @@ using System.Text.Json; using System.Text.Json.Nodes; using System.Text.Json.Serialization; +using com.IvanMurzak.ReflectorNet; using com.IvanMurzak.ReflectorNet.Json; +using com.IvanMurzak.ReflectorNet.Utils; using UnityEngine; namespace com.IvanMurzak.Unity.MCP.Common.Json.Converters { public class Vector2IntConverter : JsonConverter, IJsonSchemaConverter { - public string Id => typeof(Vector2Int).FullName; + public string Id => typeof(Vector2Int).GetTypeId(); public JsonNode GetScheme() => new JsonObject { - ["id"] = Id, - ["type"] = "object", - ["properties"] = new JsonObject + [JsonUtils.Schema.Id] = Id, + [JsonUtils.Schema.Type] = JsonUtils.Schema.Object, + [JsonUtils.Schema.Properties] = new JsonObject { - ["x"] = new JsonObject { ["type"] = "number" }, - ["y"] = new JsonObject { ["type"] = "number" } + ["x"] = new JsonObject { [JsonUtils.Schema.Type] = JsonUtils.Schema.Number }, + ["y"] = new JsonObject { [JsonUtils.Schema.Type] = JsonUtils.Schema.Number } }, - ["required"] = new JsonArray { "x", "y" } + [JsonUtils.Schema.Required] = new JsonArray { "x", "y" } }; public JsonNode GetSchemeRef() => new JsonObject { - ["$ref"] = Id + [JsonUtils.Schema.Ref] = Id }; public override Vector2Int Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) diff --git a/Assets/root/Runtime/JsonConverters/Vector3Converter.cs b/Assets/root/Runtime/JsonConverters/Vector3Converter.cs index 247626f60..881165a11 100644 --- a/Assets/root/Runtime/JsonConverters/Vector3Converter.cs +++ b/Assets/root/Runtime/JsonConverters/Vector3Converter.cs @@ -2,29 +2,31 @@ using System.Text.Json; using System.Text.Json.Nodes; using System.Text.Json.Serialization; +using com.IvanMurzak.ReflectorNet; using com.IvanMurzak.ReflectorNet.Json; +using com.IvanMurzak.ReflectorNet.Utils; using UnityEngine; namespace com.IvanMurzak.Unity.MCP.Common.Json.Converters { public class Vector3Converter : JsonConverter, IJsonSchemaConverter { - public string Id => typeof(Vector3).FullName; + public string Id => typeof(Vector3).GetTypeId(); public JsonNode GetScheme() => new JsonObject { - ["id"] = Id, - ["type"] = "object", - ["properties"] = new JsonObject + [JsonUtils.Schema.Id] = Id, + [JsonUtils.Schema.Type] = JsonUtils.Schema.Object, + [JsonUtils.Schema.Properties] = new JsonObject { - ["x"] = new JsonObject { ["type"] = "number" }, - ["y"] = new JsonObject { ["type"] = "number" }, - ["z"] = new JsonObject { ["type"] = "number" } + ["x"] = new JsonObject { [JsonUtils.Schema.Type] = JsonUtils.Schema.Number }, + ["y"] = new JsonObject { [JsonUtils.Schema.Type] = JsonUtils.Schema.Number }, + ["z"] = new JsonObject { [JsonUtils.Schema.Type] = JsonUtils.Schema.Number } }, - ["required"] = new JsonArray { "x", "y", "z" } + [JsonUtils.Schema.Required] = new JsonArray { "x", "y", "z" } }; public JsonNode GetSchemeRef() => new JsonObject { - ["$ref"] = Id + [JsonUtils.Schema.Ref] = Id }; public override Vector3 Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) diff --git a/Assets/root/Runtime/JsonConverters/Vector3IntConverter.cs b/Assets/root/Runtime/JsonConverters/Vector3IntConverter.cs index afa22786e..9872c9600 100644 --- a/Assets/root/Runtime/JsonConverters/Vector3IntConverter.cs +++ b/Assets/root/Runtime/JsonConverters/Vector3IntConverter.cs @@ -2,29 +2,31 @@ using System.Text.Json; using System.Text.Json.Nodes; using System.Text.Json.Serialization; +using com.IvanMurzak.ReflectorNet; using com.IvanMurzak.ReflectorNet.Json; +using com.IvanMurzak.ReflectorNet.Utils; using UnityEngine; namespace com.IvanMurzak.Unity.MCP.Common.Json.Converters { public class Vector3IntConverter : JsonConverter, IJsonSchemaConverter { - public string Id => typeof(Vector3Int).FullName; + public string Id => typeof(Vector3Int).GetTypeId(); public JsonNode GetScheme() => new JsonObject { - ["id"] = Id, - ["type"] = "object", - ["properties"] = new JsonObject + [JsonUtils.Schema.Id] = Id, + [JsonUtils.Schema.Type] = JsonUtils.Schema.Object, + [JsonUtils.Schema.Properties] = new JsonObject { - ["x"] = new JsonObject { ["type"] = "number" }, - ["y"] = new JsonObject { ["type"] = "number" }, - ["z"] = new JsonObject { ["type"] = "number" } + ["x"] = new JsonObject { [JsonUtils.Schema.Type] = JsonUtils.Schema.Number }, + ["y"] = new JsonObject { [JsonUtils.Schema.Type] = JsonUtils.Schema.Number }, + ["z"] = new JsonObject { [JsonUtils.Schema.Type] = JsonUtils.Schema.Number } }, - ["required"] = new JsonArray { "x", "y", "z" } + [JsonUtils.Schema.Required] = new JsonArray { "x", "y", "z" } }; public JsonNode GetSchemeRef() => new JsonObject { - ["$ref"] = Id + [JsonUtils.Schema.Ref] = Id }; public override Vector3Int Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) diff --git a/Assets/root/Runtime/JsonConverters/Vector4Converter.cs b/Assets/root/Runtime/JsonConverters/Vector4Converter.cs index 6a85de85b..b80b02f71 100644 --- a/Assets/root/Runtime/JsonConverters/Vector4Converter.cs +++ b/Assets/root/Runtime/JsonConverters/Vector4Converter.cs @@ -2,30 +2,32 @@ using System.Text.Json; using System.Text.Json.Nodes; using System.Text.Json.Serialization; +using com.IvanMurzak.ReflectorNet; using com.IvanMurzak.ReflectorNet.Json; +using com.IvanMurzak.ReflectorNet.Utils; using UnityEngine; namespace com.IvanMurzak.Unity.MCP.Common.Json.Converters { public class Vector4Converter : JsonConverter, IJsonSchemaConverter { - public string Id => typeof(Vector4).FullName; + public string Id => typeof(Vector4).GetTypeId(); public JsonNode GetScheme() => new JsonObject { - ["id"] = Id, - ["type"] = "object", - ["properties"] = new JsonObject + [JsonUtils.Schema.Id] = Id, + [JsonUtils.Schema.Type] = JsonUtils.Schema.Object, + [JsonUtils.Schema.Properties] = new JsonObject { - ["x"] = new JsonObject { ["type"] = "number" }, - ["y"] = new JsonObject { ["type"] = "number" }, - ["z"] = new JsonObject { ["type"] = "number" }, - ["w"] = new JsonObject { ["type"] = "number" } + ["x"] = new JsonObject { [JsonUtils.Schema.Type] = JsonUtils.Schema.Number }, + ["y"] = new JsonObject { [JsonUtils.Schema.Type] = JsonUtils.Schema.Number }, + ["z"] = new JsonObject { [JsonUtils.Schema.Type] = JsonUtils.Schema.Number }, + ["w"] = new JsonObject { [JsonUtils.Schema.Type] = JsonUtils.Schema.Number } }, - ["required"] = new JsonArray { "x", "y", "z", "w" } + [JsonUtils.Schema.Required] = new JsonArray { "x", "y", "z", "w" } }; public JsonNode GetSchemeRef() => new JsonObject { - ["$ref"] = Id + [JsonUtils.Schema.Ref] = Id }; public override Vector4 Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) diff --git a/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineComponent.cs b/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineComponent.cs index 05396f873..ded094f7c 100644 --- a/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineComponent.cs +++ b/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineComponent.cs @@ -1,17 +1,18 @@ #pragma warning disable CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. using System.Collections.Generic; -using System.Linq; namespace com.IvanMurzak.Unity.MCP.Reflection.Convertor { public partial class RS_UnityEngineComponent : RS_UnityEngineObject { - protected override IEnumerable ignoredProperties => base.ignoredProperties - .Concat(new[] - { - nameof(UnityEngine.Component.gameObject), - nameof(UnityEngine.Component.transform) - }); + protected override IEnumerable GetIgnoredProperties() + { + foreach (var property in base.GetIgnoredProperties()) + yield return property; + + yield return nameof(UnityEngine.Component.gameObject); + yield return nameof(UnityEngine.Component.transform); + } } } \ No newline at end of file diff --git a/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineGameObject.Editor.cs b/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineGameObject.Editor.cs index 0c21afd80..b25e9d141 100644 --- a/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineGameObject.Editor.cs +++ b/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineGameObject.Editor.cs @@ -5,6 +5,7 @@ using System.Text; using com.IvanMurzak.ReflectorNet; using com.IvanMurzak.ReflectorNet.Model; +using com.IvanMurzak.ReflectorNet.Utils; using com.IvanMurzak.Unity.MCP.Common.Reflection.Convertor; using com.IvanMurzak.Unity.MCP.Utils; using ILogger = Microsoft.Extensions.Logging.ILogger; @@ -13,24 +14,42 @@ namespace com.IvanMurzak.Unity.MCP.Reflection.Convertor { public partial class RS_UnityEngineGameObject : RS_GenericUnity { - public override bool SetAsField(Reflector reflector, ref object obj, Type type, FieldInfo fieldInfo, SerializedMember? value, StringBuilder? stringBuilder = null, + public override bool SetAsField(Reflector reflector, ref object obj, Type type, FieldInfo fieldInfo, SerializedMember? value, int depth = 0, StringBuilder? stringBuilder = null, BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, ILogger? logger = null) { + var padding = StringUtils.GetPadding(depth); var refObj = value.valueJsonElement.ToObjectRef().FindObject(); - stringBuilder?.AppendLine($"[Success] Field '{value.name}' modified to '{refObj?.GetInstanceID()}'."); + + // Validate if refObj is castable to the fieldInfo type + var castable = fieldInfo.FieldType.IsAssignableFrom(refObj?.GetType() ?? typeof(UnityEngine.Object)); + if (!castable) + { + stringBuilder?.AppendLine($"{padding}[Error] Cannot set field '{value.name.ValueOrNull()}' for object with type '{type.GetTypeName(pretty: false)}'. Because the provided value with type '{refObj?.GetType().GetTypeName(pretty: false)}' is not assignable to field type '{fieldInfo.FieldType.GetTypeName(pretty: false)}'. Convertor: {GetType().Name}"); + return false; + } fieldInfo.SetValue(obj, refObj); + stringBuilder?.AppendLine($"{padding}[Success] Field '{value.name.ValueOrNull()}' modified to '{refObj?.GetInstanceID()}'. Convertor: {GetType().Name}"); return true; } - public override bool SetAsProperty(Reflector reflector, ref object obj, Type type, PropertyInfo propertyInfo, SerializedMember? value, StringBuilder? stringBuilder = null, + public override bool SetAsProperty(Reflector reflector, ref object obj, Type type, PropertyInfo propertyInfo, SerializedMember? value, int depth = 0, StringBuilder? stringBuilder = null, BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, ILogger? logger = null) { + var padding = StringUtils.GetPadding(depth); var refObj = value.valueJsonElement.ToObjectRef().FindObject(); - stringBuilder?.AppendLine($"[Success] Property '{value.name}' modified to '{refObj?.GetInstanceID()}'."); + // Validate if refObj is castable to the propertyInfo type + var castable = propertyInfo.PropertyType.IsAssignableFrom(refObj?.GetType() ?? typeof(UnityEngine.Object)); + if (!castable) + { + stringBuilder?.AppendLine($"{padding}[Error] Cannot set property '{value.name.ValueOrNull()}' for object with type '{type.GetTypeName(pretty: false)}'. Because the provided value with type '{refObj?.GetType().GetTypeName(pretty: false)}' is not assignable to property type '{propertyInfo.PropertyType.GetTypeName(pretty: false)}'. Convertor: {GetType().Name}"); + return false; + } + + stringBuilder?.AppendLine($"{padding}[Success] Property '{value.name.ValueOrNull()}' modified to '{refObj?.GetInstanceID()}'. Convertor: {GetType().Name}"); propertyInfo.SetValue(obj, refObj); return true; } diff --git a/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineGameObject.Runtime.cs b/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineGameObject.Runtime.cs index e3cc2e971..a2ea32d6d 100644 --- a/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineGameObject.Runtime.cs +++ b/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineGameObject.Runtime.cs @@ -5,6 +5,7 @@ using System.Text; using com.IvanMurzak.ReflectorNet; using com.IvanMurzak.ReflectorNet.Model; +using com.IvanMurzak.ReflectorNet.Utils; using com.IvanMurzak.Unity.MCP.Common.Reflection.Convertor; using ILogger = Microsoft.Extensions.Logging.ILogger; @@ -12,17 +13,21 @@ namespace com.IvanMurzak.Unity.MCP.Reflection.Convertor { public partial class RS_UnityEngineGameObject : RS_GenericUnity { - public override bool SetAsField(Reflector reflector, ref object obj, Type type, FieldInfo fieldInfo, SerializedMember? value, StringBuilder? stringBuilder = null, + public override bool SetAsField(Reflector reflector, ref object obj, Type type, FieldInfo fieldInfo, SerializedMember? value, int depth = 0, StringBuilder? stringBuilder = null, BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, ILogger? logger = null) { + var padding = StringUtils.GetPadding(depth); + stringBuilder?.AppendLine($"{padding}[Warning] Cannot set field '{value.name.ValueOrNull()}' for {type.FullName}. This type is not supported for setting values. Convertor: {GetType().Name}"); return false; } - public override bool SetAsProperty(Reflector reflector, ref object obj, Type type, PropertyInfo propertyInfo, SerializedMember? value, StringBuilder? stringBuilder = null, + public override bool SetAsProperty(Reflector reflector, ref object obj, Type type, PropertyInfo propertyInfo, SerializedMember? value, int depth = 0, StringBuilder? stringBuilder = null, BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, ILogger? logger = null) { + var padding = StringUtils.GetPadding(depth); + stringBuilder?.AppendLine($"{padding}[Warning] Cannot set property '{value.name.ValueOrNull()}' for {type.FullName}. This type is not supported for setting values. Convertor: {GetType().Name}"); return false; } } diff --git a/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineGameObject.cs b/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineGameObject.cs index c4a1f30e1..28bec8704 100644 --- a/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineGameObject.cs +++ b/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineGameObject.cs @@ -17,13 +17,27 @@ namespace com.IvanMurzak.Unity.MCP.Reflection.Convertor { public partial class RS_UnityEngineGameObject : RS_GenericUnity { - protected override IEnumerable ignoredProperties => base.ignoredProperties - .Concat(new[] - { - nameof(UnityEngine.GameObject.gameObject), - nameof(UnityEngine.GameObject.transform), - nameof(UnityEngine.GameObject.scene) - }); + const string ComponentNamePrefix = "component_"; + static string GetComponentName(int index) => $"{ComponentNamePrefix}{index}"; + static bool TryParseComponentIndex(string name, out int index) + { + index = -1; + if (string.IsNullOrEmpty(name) || !name.StartsWith(ComponentNamePrefix)) + return false; + + var indexStr = name.Substring(ComponentNamePrefix.Length).Trim('[', ']'); + return int.TryParse(indexStr, out index); + } + + protected override IEnumerable GetIgnoredProperties() + { + foreach (var property in base.GetIgnoredProperties()) + yield return property; + + yield return nameof(UnityEngine.GameObject.gameObject); + yield return nameof(UnityEngine.GameObject.transform); + yield return nameof(UnityEngine.GameObject.scene); + } protected override SerializedMember InternalSerialize(Reflector reflector, object obj, Type type, string name = null, bool recursive = true, BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, ILogger? logger = null) @@ -62,7 +76,7 @@ protected override List SerializeFields(Reflector reflector, o var componentSerialized = reflector.Serialize( obj: component, type: componentType, - name: $"component_{i}", + name: GetComponentName(i), recursive: true, flags: flags, logger: logger @@ -72,35 +86,33 @@ protected override List SerializeFields(Reflector reflector, o return serializedFields; } - protected override bool SetValue(Reflector reflector, ref object obj, Type type, JsonElement? value, ILogger? logger = null) + protected override bool SetValue(Reflector reflector, ref object obj, Type type, JsonElement? value, int depth = 0, StringBuilder? stringBuilder = null, ILogger? logger = null) { - return true; + var padding = StringUtils.GetPadding(depth); + stringBuilder?.AppendLine($"{padding}[Warning] Cannot set value for '{type.GetTypeName(pretty: false)}'. This type is not supported for setting values. Maybe did you want to set a field or a property? If so, set the value in the '{nameof(SerializedMember.fields)}' or '{nameof(SerializedMember.props)}' property instead."); + return false; } - protected override StringBuilder? ModifyField(Reflector reflector, ref object obj, SerializedMember fieldValue, StringBuilder? stringBuilder = null, int depth = 0, + protected override StringBuilder? ModifyField(Reflector reflector, ref object obj, SerializedMember fieldValue, int depth = 0, StringBuilder? stringBuilder = null, BindingFlags flags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance, ILogger? logger = null) { + var padding = StringUtils.GetPadding(depth); var go = obj as UnityEngine.GameObject; var type = TypeUtils.GetType(fieldValue.typeName); if (type == null) - return stringBuilder?.AppendLine($"[Error] Type not found: {fieldValue.typeName}"); + return stringBuilder?.AppendLine($"{padding}[Error] Type not found: '{fieldValue.typeName}'"); // If not a component, use base method if (!typeof(UnityEngine.Component).IsAssignableFrom(type)) - return base.ModifyField(reflector, ref obj, fieldValue, stringBuilder, depth, flags); + return base.ModifyField(reflector, ref obj, fieldValue, depth: depth, stringBuilder: stringBuilder, flags: flags); - var index = -1; - if (fieldValue.name.StartsWith("component_")) - int.TryParse(fieldValue.name - .Replace("component_", "") - .Replace("[", "") - .Replace("]", ""), out index); + TryParseComponentIndex(fieldValue.name, out var index); var componentInstanceID = fieldValue.GetInstanceID(); if (componentInstanceID == 0 && index == -1) - return stringBuilder?.AppendLine($"[Error] Component 'instanceID' is not provided. Use 'instanceID' or name '[index]' to specify the component. '{fieldValue.name}' is not valid."); + return stringBuilder?.AppendLine($"{padding}[Error] Component 'instanceID' is not provided. Use 'instanceID' or name '[index]' to specify the component. '{fieldValue.name}' is not valid."); var allComponents = go.GetComponents(); var component = componentInstanceID == 0 @@ -110,10 +122,10 @@ protected override bool SetValue(Reflector reflector, ref object obj, Type type, : allComponents.FirstOrDefault(c => c.GetInstanceID() == componentInstanceID); if (component == null) - return stringBuilder?.AppendLine($"[Error] Component not found. Use 'instanceID' or name 'component_[index]' to specify the component."); + return stringBuilder?.AppendLine($"{padding}[Error] Component not found. Use 'instanceID' or name 'component_[index]' to specify the component."); var componentObject = (object)component; - return reflector.Populate(ref componentObject, fieldValue, logger: logger); + return reflector.Populate(ref componentObject, fieldValue, depth: depth, stringBuilder: stringBuilder, logger: logger); } } } \ No newline at end of file diff --git a/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineMaterial.Editor.cs b/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineMaterial.Editor.cs index 06ae0d7b4..3d103747a 100644 --- a/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineMaterial.Editor.cs +++ b/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineMaterial.Editor.cs @@ -17,14 +17,15 @@ namespace com.IvanMurzak.Unity.MCP.Reflection.Convertor public partial class RS_UnityEngineMaterial : RS_GenericUnity { - protected override StringBuilder? ModifyProperty(Reflector reflector, ref object obj, SerializedMember property, StringBuilder? stringBuilder = null, int depth = 0, + protected override StringBuilder? ModifyProperty(Reflector reflector, ref object obj, SerializedMember property, int depth = 0, StringBuilder? stringBuilder = null, BindingFlags flags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance, ILogger? logger = null) { + var padding = StringUtils.GetPadding(depth); var material = obj as Material; var propType = TypeUtils.GetType(property.typeName); if (propType == null) - return stringBuilder.AppendLine(new string(' ', depth) + $"[Error] Property type '{property.typeName}' not found."); + return stringBuilder.AppendLine($"{padding}[Error] Property type '{property.typeName}' not found. Convertor: {GetType().Name}"); switch (propType) { @@ -32,61 +33,63 @@ public partial class RS_UnityEngineMaterial : RS_GenericUnity if (material.HasInt(property.name)) { material.SetInt(property.name, property.GetValue()); - return stringBuilder.AppendLine(new string(' ', depth) + $"[Success] Property '{property.name}' modified to '{property.GetValue()}'."); + return stringBuilder.AppendLine($"{padding}[Success] Property '{property.name}' modified to '{property.GetValue()}'. Convertor: {GetType().Name}"); } - return stringBuilder.AppendLine(new string(' ', depth) + $"[Error] Property '{property.name}' not found."); + return stringBuilder.AppendLine($"{padding}[Error] Property '{property.name}' not found. Convertor: {GetType().Name}"); case Type t when t == typeof(float): if (material.HasFloat(property.name)) { material.SetFloat(property.name, property.GetValue()); - return stringBuilder.AppendLine(new string(' ', depth) + $"[Success] Property '{property.name}' modified to '{property.GetValue()}'."); + return stringBuilder.AppendLine($"{padding}[Success] Property '{property.name}' modified to '{property.GetValue()}'. Convertor: {GetType().Name}"); } - return stringBuilder.AppendLine(new string(' ', depth) + $"[Error] Property '{property.name}' not found."); + return stringBuilder.AppendLine($"{padding}[Error] Property '{property.name}' not found. Convertor: {GetType().Name}"); case Type t when t == typeof(Color): if (material.HasColor(property.name)) { material.SetColor(property.name, property.GetValue()); - return stringBuilder.AppendLine(new string(' ', depth) + $"[Success] Property '{property.name}' modified to '{property.GetValue()}'."); + return stringBuilder.AppendLine($"{padding}[Success] Property '{property.name}' modified to '{property.GetValue()}'. Convertor: {GetType().Name}"); } - return stringBuilder.AppendLine(new string(' ', depth) + $"[Error] Property '{property.name}' not found."); + return stringBuilder.AppendLine($"{padding}[Error] Property '{property.name}' not found. Convertor: {GetType().Name}"); case Type t when t == typeof(Vector4): if (material.HasVector(property.name)) { material.SetVector(property.name, property.GetValue()); - return stringBuilder.AppendLine(new string(' ', depth) + $"[Success] Property '{property.name}' modified to '{property.GetValue()}'."); + return stringBuilder.AppendLine($"{padding}[Success] Property '{property.name}' modified to '{property.GetValue()}'. Convertor: {GetType().Name}"); } - return stringBuilder.AppendLine(new string(' ', depth) + $"[Error] Property '{property.name}' not found."); + return stringBuilder.AppendLine($"{padding}[Error] Property '{property.name}' not found. Convertor: {GetType().Name}"); case Type t when t == typeof(Texture): if (material.HasTexture(property.name)) { var objTexture = property.GetValue().FindObject(); var texture = objTexture as Texture; material.SetTexture(property.name, texture); - return stringBuilder.AppendLine(new string(' ', depth) + $"[Success] Property '{property.name}' modified to '{texture?.name ?? "null"}'."); + return stringBuilder.AppendLine($"{padding}[Success] Property '{property.name}' modified to '{texture?.name ?? "null"}'. Convertor: {GetType().Name}"); } - return stringBuilder.AppendLine(new string(' ', depth) + $"[Error] Property '{property.name}' not found."); + return stringBuilder.AppendLine($"{padding}[Error] Property '{property.name}' not found. Convertor: {GetType().Name}"); default: - return stringBuilder.AppendLine(new string(' ', depth) + $"[Error] Property type '{property.typeName}' is not supported."); + return stringBuilder.AppendLine($"{padding}[Error] Property type '{property.typeName}' is not supported. Convertor: {GetType().Name}"); } } - public override bool SetAsField(Reflector reflector, ref object obj, Type type, FieldInfo fieldInfo, SerializedMember? value, StringBuilder? stringBuilder = null, + public override bool SetAsField(Reflector reflector, ref object obj, Type type, FieldInfo fieldInfo, SerializedMember? value, int depth = 0, StringBuilder? stringBuilder = null, BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, ILogger? logger = null) { + var padding = StringUtils.GetPadding(depth); var refObj = value.valueJsonElement.ToObjectRef().FindObject(); - stringBuilder?.AppendLine($"[Success] Field '{value.name}' modified to '{refObj?.GetInstanceID()}'."); + stringBuilder?.AppendLine($"{padding}[Success] Field '{value.name.ValueOrNull()}' modified to '{refObj?.GetInstanceID()}'. Convertor: {GetType().Name}"); fieldInfo.SetValue(obj, refObj); return true; } - public override bool SetAsProperty(Reflector reflector, ref object obj, Type type, PropertyInfo propertyInfo, SerializedMember? value, StringBuilder? stringBuilder = null, + public override bool SetAsProperty(Reflector reflector, ref object obj, Type type, PropertyInfo propertyInfo, SerializedMember? value, int depth = 0, StringBuilder? stringBuilder = null, BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, ILogger? logger = null) { + var padding = StringUtils.GetPadding(depth); var refObj = value.valueJsonElement.ToObjectRef().FindObject(); - stringBuilder?.AppendLine($"[Success] Property '{value.name}' modified to '{refObj?.GetInstanceID()}'."); + stringBuilder?.AppendLine($"{padding}[Success] Property '{value.name.ValueOrNull()}' modified to '{refObj?.GetInstanceID()}'. Convertor: {GetType().Name}"); propertyInfo.SetValue(obj, refObj); return true; diff --git a/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineMaterial.Runtime.cs b/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineMaterial.Runtime.cs index e42326d2c..d1f5b2dd0 100644 --- a/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineMaterial.Runtime.cs +++ b/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineMaterial.Runtime.cs @@ -14,14 +14,15 @@ namespace com.IvanMurzak.Unity.MCP.Reflection.Convertor { public partial class RS_UnityEngineMaterial : RS_GenericUnity { - protected override StringBuilder? ModifyProperty(Reflector reflector, ref object obj, SerializedMember property, StringBuilder? stringBuilder = null, int depth = 0, + protected override StringBuilder? ModifyProperty(Reflector reflector, ref object obj, SerializedMember property, int depth = 0, StringBuilder? stringBuilder = null, BindingFlags flags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance, ILogger? logger = null) { + var padding = StringUtils.GetPadding(depth); var material = obj as Material; var propType = TypeUtils.GetType(property.typeName); if (propType == null) - return stringBuilder.AppendLine(new string(' ', depth) + $"[Error] Property type '{property.typeName}' not found."); + return stringBuilder.AppendLine($"{padding}[Error] Property type '{property.typeName}' not found. Convertor: {GetType().Name}"); switch (propType) { @@ -29,30 +30,30 @@ public partial class RS_UnityEngineMaterial : RS_GenericUnity if (material.HasInt(property.name)) { material.SetInt(property.name, property.GetValue()); - return stringBuilder.AppendLine(new string(' ', depth) + $"[Success] Property '{property.name}' modified to '{property.GetValue()}'."); + return stringBuilder.AppendLine($"{padding}[Success] Property '{property.name}' modified to '{property.GetValue()}'. Convertor: {GetType().Name}"); } - return stringBuilder.AppendLine(new string(' ', depth) + $"[Error] Property '{property.name}' not found."); + return stringBuilder.AppendLine($"{padding}[Error] Property '{property.name}' not found. Convertor: {GetType().Name}"); case Type t when t == typeof(float): if (material.HasFloat(property.name)) { material.SetFloat(property.name, property.GetValue()); - return stringBuilder.AppendLine(new string(' ', depth) + $"[Success] Property '{property.name}' modified to '{property.GetValue()}'."); + return stringBuilder.AppendLine($"{padding}[Success] Property '{property.name}' modified to '{property.GetValue()}'. Convertor: {GetType().Name}"); } - return stringBuilder.AppendLine(new string(' ', depth) + $"[Error] Property '{property.name}' not found."); + return stringBuilder.AppendLine($"{padding}[Error] Property '{property.name}' not found. Convertor: {GetType().Name}"); case Type t when t == typeof(Color): if (material.HasColor(property.name)) { material.SetColor(property.name, property.GetValue()); - return stringBuilder.AppendLine(new string(' ', depth) + $"[Success] Property '{property.name}' modified to '{property.GetValue()}'."); + return stringBuilder.AppendLine($"{padding}[Success] Property '{property.name}' modified to '{property.GetValue()}'. Convertor: {GetType().Name}"); } - return stringBuilder.AppendLine(new string(' ', depth) + $"[Error] Property '{property.name}' not found."); + return stringBuilder.AppendLine($"{padding}[Error] Property '{property.name}' not found. Convertor: {GetType().Name}"); case Type t when t == typeof(Vector4): if (material.HasVector(property.name)) { material.SetVector(property.name, property.GetValue()); - return stringBuilder.AppendLine(new string(' ', depth) + $"[Success] Property '{property.name}' modified to '{property.GetValue()}'."); + return stringBuilder.AppendLine($"{padding}[Success] Property '{property.name}' modified to '{property.GetValue()}'. Convertor: {GetType().Name}"); } - return stringBuilder.AppendLine(new string(' ', depth) + $"[Error] Property '{property.name}' not found."); + return stringBuilder.AppendLine($"{padding}[Error] Property '{property.name}' not found. Convertor: {GetType().Name}"); // case Type t when t == typeof(Texture): // if (material.HasTexture(property.name)) // { @@ -61,25 +62,29 @@ public partial class RS_UnityEngineMaterial : RS_GenericUnity // ? null // : UnityEditor.EditorUtility.InstanceIDToObject(instanceID) as Texture; // material.SetTexture(property.name, texture); - // return stringBuilder.AppendLine(new string(' ', depth) + $"[Success] Property '{property.name}' modified to '{texture?.name ?? "null"}'."); + // return stringBuilder.AppendLine($"{padding}[Success] Property '{property.name}' modified to '{texture?.name ?? "null"}'."); // } - // return stringBuilder.AppendLine(new string(' ', depth) + $"[Error] Property '{property.name}' not found."); + // return stringBuilder.AppendLine($"{padding}[Error] Property '{property.name}' not found."); default: - return stringBuilder.AppendLine(new string(' ', depth) + $"[Error] Property type '{property.typeName}' is not supported."); + return stringBuilder.AppendLine($"{padding}[Error] Property type '{property.typeName}' is not supported. Convertor: {GetType().Name}"); } } - public override bool SetAsField(Reflector reflector, ref object obj, Type type, FieldInfo fieldInfo, SerializedMember? value, StringBuilder? stringBuilder = null, + public override bool SetAsField(Reflector reflector, ref object obj, Type type, FieldInfo fieldInfo, SerializedMember? value, int depth = 0, StringBuilder? stringBuilder = null, BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, ILogger? logger = null) { + var padding = StringUtils.GetPadding(depth); + stringBuilder?.AppendLine($"{padding}[Warning] Cannot set field '{value.name.ValueOrNull()}' for {type.FullName}. This type is not supported for setting values. Convertor: {GetType().Name}"); return false; } - public override bool SetAsProperty(Reflector reflector, ref object obj, Type type, PropertyInfo propertyInfo, SerializedMember? value, StringBuilder? stringBuilder = null, + public override bool SetAsProperty(Reflector reflector, ref object obj, Type type, PropertyInfo propertyInfo, SerializedMember? value, int depth = 0, StringBuilder? stringBuilder = null, BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, ILogger? logger = null) { + var padding = StringUtils.GetPadding(depth); + stringBuilder?.AppendLine($"{padding}[Warning] Cannot set property '{value.name.ValueOrNull()}' for {type.FullName}. This type is not supported for setting values. Convertor: {GetType().Name}"); return false; } } diff --git a/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineMaterial.cs b/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineMaterial.cs index cf0360a9b..97e01d46b 100644 --- a/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineMaterial.cs +++ b/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineMaterial.cs @@ -76,23 +76,43 @@ protected override SerializedMember InternalSerialize(Reflector reflector, objec }.SetValue(new ObjectRef(material.GetInstanceID())); } - protected override bool SetValue(Reflector reflector, ref object obj, Type type, JsonElement? value, ILogger? logger = null) + protected override bool SetValue(Reflector reflector, ref object obj, Type type, JsonElement? value, int depth = 0, StringBuilder? stringBuilder = null, ILogger? logger = null) { + var padding = StringUtils.GetPadding(depth); var serialized = JsonUtils.Deserialize(value.Value); var material = obj as Material; // Set shader var shaderName = serialized.GetField(FieldShader)?.GetValue(); - if (!string.IsNullOrEmpty(shaderName) && material.shader.name != shaderName) - material.shader = Shader.Find(shaderName) ?? throw new ArgumentException($"Shader '{shaderName}' not found."); + if (string.IsNullOrEmpty(shaderName)) + { + stringBuilder?.AppendLine($"{padding}[Error] Shader name is null or empty."); + return false; + } + + if (material.shader.name == shaderName) + { + stringBuilder?.AppendLine($"{padding}[Info] Material '{material.name}' shader is already set to '{shaderName}'."); + return true; + } + + var parsedValue = Shader.Find(shaderName); + if (parsedValue == null) + { + stringBuilder?.AppendLine($"{padding}[Error] Shader with name '{shaderName}' not found."); + return false; + } + Print.SetNewValue(ref obj, ref parsedValue, type, depth, stringBuilder); + material.shader = parsedValue; return true; } - protected override StringBuilder? ModifyField(Reflector reflector, ref object obj, SerializedMember fieldValue, StringBuilder? stringBuilder = null, int depth = 0, + protected override StringBuilder? ModifyField(Reflector reflector, ref object obj, SerializedMember fieldValue, int depth = 0, StringBuilder? stringBuilder = null, BindingFlags flags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance, ILogger? logger = null) { + var padding = StringUtils.GetPadding(depth); var material = obj as Material; // Set shader @@ -103,10 +123,10 @@ protected override bool SetValue(Reflector reflector, ref object obj, Type type, { var shader = Shader.Find(shaderName); if (shader == null) - return stringBuilder?.AppendLine(new string(' ', depth) + $"[Error] Shader '{shaderName}' not found."); + return stringBuilder?.AppendLine($"{padding}[Error] Shader '{shaderName}' not found."); material.shader = shader; - return stringBuilder?.AppendLine(new string(' ', depth) + $"[Success] Material '{material.name}' shader set to '{shaderName}'."); + return stringBuilder?.AppendLine($"{padding}[Success] Material '{material.name}' shader set to '{shaderName}'."); } } diff --git a/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineMeshFilter.cs b/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineMeshFilter.cs index 40549718e..3b9494c3a 100644 --- a/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineMeshFilter.cs +++ b/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineMeshFilter.cs @@ -1,15 +1,16 @@ #pragma warning disable CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. using System.Collections.Generic; -using System.Linq; namespace com.IvanMurzak.Unity.MCP.Reflection.Convertor { public partial class RS_UnityEngineMeshFilter : RS_UnityEngineObject { - protected override IEnumerable ignoredProperties => base.ignoredProperties - .Concat(new[] - { - nameof(UnityEngine.MeshFilter.mesh) - }); + protected override IEnumerable GetIgnoredProperties() + { + foreach (var property in base.GetIgnoredProperties()) + yield return property; + + yield return nameof(UnityEngine.MeshFilter.mesh); + } } } \ No newline at end of file diff --git a/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineObject.Editor.cs b/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineObject.Editor.cs index b6e640b8d..3dd5bd86a 100644 --- a/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineObject.Editor.cs +++ b/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineObject.Editor.cs @@ -5,6 +5,7 @@ using System.Text; using com.IvanMurzak.ReflectorNet; using com.IvanMurzak.ReflectorNet.Model; +using com.IvanMurzak.ReflectorNet.Utils; using com.IvanMurzak.Unity.MCP.Common.Reflection.Convertor; using com.IvanMurzak.Unity.MCP.Utils; using ILogger = Microsoft.Extensions.Logging.ILogger; @@ -16,23 +17,25 @@ public partial class RS_UnityEngineObject : RS_GenericUnity where T : Unit public override object? Deserialize(Reflector reflector, SerializedMember data, ILogger? logger = null) => data.valueJsonElement.ToObjectRef().FindObject(); - public override bool SetAsField(Reflector reflector, ref object obj, Type type, FieldInfo fieldInfo, SerializedMember? value, StringBuilder? stringBuilder = null, + public override bool SetAsField(Reflector reflector, ref object obj, Type type, FieldInfo fieldInfo, SerializedMember? value, int depth = 0, StringBuilder? stringBuilder = null, BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, ILogger? logger = null) { + var padding = StringUtils.GetPadding(depth); var refObj = value.valueJsonElement.ToObjectRef().FindObject(); - stringBuilder?.AppendLine($"[Success] Field '{value.name}' modified to '{refObj?.GetInstanceID()}'."); + stringBuilder?.AppendLine($"{padding}[Success] Field '{value.name.ValueOrNull()}' modified to '{refObj?.GetInstanceID()}'. Convertor: {GetType().Name}"); fieldInfo.SetValue(obj, refObj); return true; } - public override bool SetAsProperty(Reflector reflector, ref object obj, Type type, PropertyInfo propertyInfo, SerializedMember? value, StringBuilder? stringBuilder = null, + public override bool SetAsProperty(Reflector reflector, ref object obj, Type type, PropertyInfo propertyInfo, SerializedMember? value, int depth = 0, StringBuilder? stringBuilder = null, BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, ILogger? logger = null) { + var padding = StringUtils.GetPadding(depth); var refObj = value.valueJsonElement.ToObjectRef().FindObject(); - stringBuilder?.AppendLine($"[Success] Property '{value.name}' modified to '{refObj?.GetInstanceID()}'."); + stringBuilder?.AppendLine($"{padding}[Success] Property '{value.name.ValueOrNull()}' modified to '{refObj?.GetInstanceID()}'. Convertor: {GetType().Name}"); propertyInfo.SetValue(obj, refObj); return true; diff --git a/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineObject.Runtime.cs b/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineObject.Runtime.cs index 6d1cee4aa..0b20dee52 100644 --- a/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineObject.Runtime.cs +++ b/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineObject.Runtime.cs @@ -5,6 +5,7 @@ using System.Text; using com.IvanMurzak.ReflectorNet; using com.IvanMurzak.ReflectorNet.Model; +using com.IvanMurzak.ReflectorNet.Utils; using com.IvanMurzak.Unity.MCP.Common.Reflection.Convertor; using ILogger = Microsoft.Extensions.Logging.ILogger; @@ -15,17 +16,21 @@ public partial class RS_UnityEngineObject : RS_GenericUnity where T : Unit public override object? Deserialize(Reflector reflector, SerializedMember data, ILogger? logger = null) => null; - public override bool SetAsField(Reflector reflector, ref object obj, Type type, FieldInfo fieldInfo, SerializedMember? value, StringBuilder? stringBuilder = null, + public override bool SetAsField(Reflector reflector, ref object obj, Type type, FieldInfo fieldInfo, SerializedMember? value, int depth = 0, StringBuilder? stringBuilder = null, BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, ILogger? logger = null) { + var padding = StringUtils.GetPadding(depth); + stringBuilder?.AppendLine($"{padding}[Warning] Cannot set field '{value.name.ValueOrNull()}' for {type.FullName}. This type is not supported for setting values. Convertor: {GetType().Name}"); return false; } - public override bool SetAsProperty(Reflector reflector, ref object obj, Type type, PropertyInfo propertyInfo, SerializedMember? value, StringBuilder? stringBuilder = null, + public override bool SetAsProperty(Reflector reflector, ref object obj, Type type, PropertyInfo propertyInfo, SerializedMember? value, int depth = 0, StringBuilder? stringBuilder = null, BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, ILogger? logger = null) { + var padding = StringUtils.GetPadding(depth); + stringBuilder?.AppendLine($"{padding}[Warning] Cannot set property '{value.name.ValueOrNull()}' for {type.FullName}. This type is not supported for setting values. Convertor: {GetType().Name}"); return false; } } diff --git a/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineObject.cs b/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineObject.cs index ebec28640..b9c4b5b86 100644 --- a/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineObject.cs +++ b/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineObject.cs @@ -1,10 +1,12 @@ #pragma warning disable CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. using System; using System.Reflection; +using System.Text; using System.Text.Json; using com.IvanMurzak.ReflectorNet; using com.IvanMurzak.ReflectorNet.Model; using com.IvanMurzak.ReflectorNet.Model.Unity; +using com.IvanMurzak.ReflectorNet.Utils; using com.IvanMurzak.Unity.MCP.Common.Reflection.Convertor; using ILogger = Microsoft.Extensions.Logging.ILogger; @@ -37,12 +39,14 @@ protected override SerializedMember InternalSerialize(Reflector reflector, objec } } - throw new ArgumentException($"Unsupported type: {type.FullName}"); + throw new ArgumentException($"Unsupported type: '{type.GetTypeName(pretty: false)}'. Convertor: {GetType().Name}"); } - protected override bool SetValue(Reflector reflector, ref object obj, Type type, JsonElement? value, ILogger? logger = null) + protected override bool SetValue(Reflector reflector, ref object obj, Type type, JsonElement? value, int depth = 0, StringBuilder? stringBuilder = null, ILogger? logger = null) { - return true; + var padding = StringUtils.GetPadding(depth); + stringBuilder?.AppendLine($"{padding}[Warning] Cannot set value for type '{type.GetTypeName(pretty: false)}'. This type is not supported for setting values. Maybe did you want to set a field or a property? If so, set the value in the '{nameof(SerializedMember.fields)}' or '{nameof(SerializedMember.props)}' property instead. Convertor: {GetType().Name}"); + return false; } } } \ No newline at end of file diff --git a/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineRenderer.cs b/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineRenderer.cs index c3868155a..93bc74362 100644 --- a/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineRenderer.cs +++ b/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineRenderer.cs @@ -1,17 +1,18 @@ #pragma warning disable CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. using System.Collections.Generic; -using System.Linq; namespace com.IvanMurzak.Unity.MCP.Reflection.Convertor { public partial class RS_UnityEngineRenderer : RS_UnityEngineObject { - protected override IEnumerable ignoredProperties => base.ignoredProperties - .Concat(new[] - { - nameof(UnityEngine.Renderer.material), - nameof(UnityEngine.Renderer.materials) - }); + protected override IEnumerable GetIgnoredProperties() + { + foreach (var property in base.GetIgnoredProperties()) + yield return property; + + yield return nameof(UnityEngine.Renderer.material); + yield return nameof(UnityEngine.Renderer.materials); + } } } \ No newline at end of file diff --git a/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineSprite.Editor.cs b/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineSprite.Editor.cs index 70ef14f83..56eaeeae8 100644 --- a/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineSprite.Editor.cs +++ b/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineSprite.Editor.cs @@ -1,5 +1,6 @@ #pragma warning disable CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. #if UNITY_EDITOR +using System; using System.Linq; using System.Reflection; using System.Text; @@ -13,7 +14,7 @@ namespace com.IvanMurzak.Unity.MCP.Reflection.Convertor { public partial class RS_UnityEngineSprite : RS_UnityEngineObject { - public override StringBuilder Populate(Reflector reflector, ref object obj, SerializedMember data, int depth = 0, StringBuilder stringBuilder = null, + public override StringBuilder Populate(Reflector reflector, ref object obj, SerializedMember data, Type? dataType = null, int depth = 0, StringBuilder stringBuilder = null, BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, ILogger? logger = null) { @@ -21,11 +22,11 @@ public override StringBuilder Populate(Reflector reflector, ref object obj, Seri if (instanceID == 0) { obj = null; - return stringBuilder?.AppendLine($"[Success] InstanceID is 0. Cleared the reference."); + return stringBuilder?.AppendLine($"[Success] InstanceID is 0. Cleared the reference. Convertor: {GetType().Name}"); } var textureOrSprite = EditorUtility.InstanceIDToObject(instanceID); if (textureOrSprite == null) - return stringBuilder?.AppendLine($"[Error] InstanceID {instanceID} not found."); + return stringBuilder?.AppendLine($"[Error] InstanceID {instanceID} not found. Convertor: {GetType().Name}"); if (textureOrSprite is UnityEngine.Texture2D texture) { @@ -34,17 +35,17 @@ public override StringBuilder Populate(Reflector reflector, ref object obj, Seri .OfType() .ToArray(); if (sprites.Length == 0) - return stringBuilder?.AppendLine($"[Error] No sprites found for texture at path: {path}."); + return stringBuilder?.AppendLine($"[Error] No sprites found for texture at path: {path}. Convertor: {GetType().Name}"); obj = sprites[0]; // Assign the first sprite found - return stringBuilder?.AppendLine($"[Success] Assigned sprite from texture: {path}."); + return stringBuilder?.AppendLine($"[Success] Assigned sprite from texture: {path}. Convertor: {GetType().Name}"); } if (textureOrSprite is UnityEngine.Sprite sprite) { obj = sprite; - return stringBuilder?.AppendLine($"[Success] Assigned sprite: {sprite.name}."); + return stringBuilder?.AppendLine($"[Success] Assigned sprite: {sprite.name}. Convertor: {GetType().Name}"); } - return stringBuilder?.AppendLine($"[Error] InstanceID {instanceID} is not a Texture2D or Sprite."); + return stringBuilder?.AppendLine($"[Error] InstanceID {instanceID} is not a Texture2D or Sprite. Convertor: {GetType().Name}"); } } } diff --git a/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineSprite.Runtime.cs b/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineSprite.Runtime.cs index a0a3f6166..4800710af 100644 --- a/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineSprite.Runtime.cs +++ b/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineSprite.Runtime.cs @@ -1,20 +1,23 @@ #pragma warning disable CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. #if !UNITY_EDITOR +using System; using System.Reflection; using System.Text; using com.IvanMurzak.ReflectorNet; using com.IvanMurzak.ReflectorNet.Model; +using com.IvanMurzak.ReflectorNet.Utils; using ILogger = Microsoft.Extensions.Logging.ILogger; namespace com.IvanMurzak.Unity.MCP.Reflection.Convertor { public partial class RS_UnityEngineSprite : RS_UnityEngineObject { - public override StringBuilder Populate(Reflector reflector, ref object obj, SerializedMember data, int depth = 0, StringBuilder stringBuilder = null, + public override StringBuilder Populate(Reflector reflector, ref object obj, SerializedMember data, Type? dataType = null, int depth = 0, StringBuilder stringBuilder = null, BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, ILogger? logger = null) { - return stringBuilder?.AppendLine($"[Error] Operation is not supported in runtime."); + var padding = StringUtils.GetPadding(depth); + return stringBuilder?.AppendLine($"{padding}[Error] Operation is not supported in runtime. Convertor: {GetType().Name}"); } } } diff --git a/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineSprite.cs b/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineSprite.cs index 6d60ff715..5f17fbe49 100644 --- a/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineSprite.cs +++ b/Assets/root/Runtime/ReflectionConverters/RS_UnityEngineSprite.cs @@ -5,6 +5,7 @@ using com.IvanMurzak.ReflectorNet; using com.IvanMurzak.ReflectorNet.Model; using com.IvanMurzak.ReflectorNet.Model.Unity; +using com.IvanMurzak.ReflectorNet.Utils; using ILogger = Microsoft.Extensions.Logging.ILogger; namespace com.IvanMurzak.Unity.MCP.Reflection.Convertor @@ -23,24 +24,26 @@ protected override SerializedMember InternalSerialize(Reflector reflector, objec return base.InternalSerialize(reflector, obj, type, name, recursive, flags); } - public override bool SetAsField(Reflector reflector, ref object obj, Type type, FieldInfo fieldInfo, SerializedMember? value, StringBuilder? stringBuilder = null, + public override bool SetAsField(Reflector reflector, ref object obj, Type type, FieldInfo fieldInfo, SerializedMember? value, int depth = 0, StringBuilder? stringBuilder = null, BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, ILogger? logger = null) { + var padding = StringUtils.GetPadding(depth); var currentValue = fieldInfo.GetValue(obj); - Populate(reflector, ref currentValue, value, 0, null, flags, logger); + Populate(reflector, ref currentValue, value, type, depth: depth, stringBuilder: stringBuilder, flags, logger); fieldInfo.SetValue(obj, currentValue); - stringBuilder?.AppendLine($"[Success] Field '{value.name}' modified to '{currentValue}'."); + stringBuilder?.AppendLine($"{padding}[Success] Field '{value.name.ValueOrNull()}' modified to '{currentValue}'. Convertor: {GetType().Name}"); return true; } - public override bool SetAsProperty(Reflector reflector, ref object obj, Type type, PropertyInfo propertyInfo, SerializedMember? value, StringBuilder? stringBuilder = null, + public override bool SetAsProperty(Reflector reflector, ref object obj, Type type, PropertyInfo propertyInfo, SerializedMember? value, int depth = 0, StringBuilder? stringBuilder = null, BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, ILogger? logger = null) { + var padding = StringUtils.GetPadding(depth); var currentValue = propertyInfo.GetValue(obj); - Populate(reflector, ref currentValue, value, 0, null, flags, logger); + Populate(reflector, ref currentValue, value, type, depth: depth, stringBuilder: stringBuilder, flags, logger); propertyInfo.SetValue(obj, currentValue); - stringBuilder?.AppendLine($"[Success] Property '{value.name}' modified to '{currentValue}'."); + stringBuilder?.AppendLine($"{padding}[Success] Property '{value.name.ValueOrNull()}' modified to '{currentValue}'. Convertor: {GetType().Name}"); return true; } } diff --git a/Assets/root/Runtime/ReflectionConverters/Struct/RS_UnityEngineDataStructs.cs b/Assets/root/Runtime/ReflectionConverters/Struct/RS_UnityEngineDataStructs.cs index ff0ae1e2d..1b2691aa7 100644 --- a/Assets/root/Runtime/ReflectionConverters/Struct/RS_UnityEngineDataStructs.cs +++ b/Assets/root/Runtime/ReflectionConverters/Struct/RS_UnityEngineDataStructs.cs @@ -4,11 +4,20 @@ namespace com.IvanMurzak.Unity.MCP.Reflection.Convertor { public partial class RS_UnityEngineColor32 : RS_GenericUnityNoProperties { } public partial class RS_UnityEngineColor : RS_GenericUnityNoProperties { } + public partial class RS_UnityEngineMatrix4x4 : RS_GenericUnityNoProperties { } + public partial class RS_UnityEngineQuaternion : RS_GenericUnityNoProperties { } + public partial class RS_UnityEngineVector2 : RS_GenericUnityNoProperties { } public partial class RS_UnityEngineVector2Int : RS_GenericUnityNoProperties { } public partial class RS_UnityEngineVector3 : RS_GenericUnityNoProperties { } public partial class RS_UnityEngineVector3Int : RS_GenericUnityNoProperties { } public partial class RS_UnityEngineVector4 : RS_GenericUnityNoProperties { } + + public partial class RS_UnityEngineBounds : RS_GenericUnityNoProperties { } + public partial class RS_UnityEngineBoundsInt : RS_GenericUnityNoProperties { } + + public partial class RS_UnityEngineRect : RS_GenericUnityNoProperties { } + public partial class RS_UnityEngineRectInt : RS_GenericUnityNoProperties { } } \ No newline at end of file diff --git a/Assets/root/Runtime/Unity/GameObjectMetadata.cs b/Assets/root/Runtime/Unity/GameObjectMetadata.cs index 4ff082558..5cc0c5da8 100644 --- a/Assets/root/Runtime/Unity/GameObjectMetadata.cs +++ b/Assets/root/Runtime/Unity/GameObjectMetadata.cs @@ -1,7 +1,7 @@ #pragma warning disable CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. using System.Collections.Generic; using System.Text; -using com.IvanMurzak.Unity.MCP.Common; +using com.IvanMurzak.ReflectorNet.Utils; using com.IvanMurzak.Unity.MCP.Utils; using UnityEngine; @@ -18,7 +18,7 @@ public class GameObjectMetadata public bool activeInHierarchy; public List children = new(); - public string Print(int limit = Consts.MCP.LinesLimit) + public string Print(int limit = Common.Consts.MCP.LinesLimit) { var sb = new StringBuilder(); @@ -37,24 +37,26 @@ public string Print(int limit = Consts.MCP.LinesLimit) public static void AppendMetadata(StringBuilder sb, GameObjectMetadata metadata, int depth, ref int limit) { + var padding = StringUtils.GetPadding(depth); if (limit <= 0) { - sb.AppendLine(new string(' ', depth * 2) + "... [Limit reached] ..."); + sb.AppendLine($"{padding}... [Limit reached] ..."); return; } limit--; // Indent the path based on depth for better readability - var indentedPath = new string(' ', depth * 2) + metadata.name; + var indentedPath = $"{padding}{metadata.name}"; // Add the current GameObject's data sb.AppendLine($"{metadata.instanceID,-10} | {metadata.activeInHierarchy,-17} | {metadata.activeSelf,-10} | {metadata.tag,-9} | {indentedPath}"); // Recursively add children + var paddingForChildren = StringUtils.GetPadding(depth + 1); foreach (var child in metadata.children) { if (limit <= 0) { - sb.AppendLine(new string(' ', (depth + 1) * 2) + "... [Limit reached] ..."); + sb.AppendLine($"{paddingForChildren}... [Limit reached] ..."); return; } limit--; diff --git a/Assets/root/Server/.gitignore b/Assets/root/Server/.gitignore index 083d81aa7..c86065865 100644 --- a/Assets/root/Server/.gitignore +++ b/Assets/root/Server/.gitignore @@ -38,4 +38,7 @@ packages/ !*.csproj *.sln -*.sln.meta \ No newline at end of file +*.sln.meta + +# Whitelist specific DLLs +!ReflectorNet.dll \ No newline at end of file diff --git a/Assets/root/Server/Common/Data/Unity/ComponentData.cs b/Assets/root/Server/Common/Data/Unity/ComponentData.cs index aa2fdb5ec..a46abe4a7 100644 --- a/Assets/root/Server/Common/Data/Unity/ComponentData.cs +++ b/Assets/root/Server/Common/Data/Unity/ComponentData.cs @@ -6,8 +6,8 @@ namespace com.IvanMurzak.ReflectorNet.Model.Unity [System.Serializable] public class ComponentData : ComponentDataLight { - public List fields { get; set; } = new(); - public List properties { get; set; } = new(); + public List? fields { get; set; } + public List? properties { get; set; } public ComponentData() { } } diff --git a/Assets/root/Server/Common/Data/Unity/GameObjectComponentsRef.cs b/Assets/root/Server/Common/Data/Unity/GameObjectComponentsRef.cs new file mode 100644 index 000000000..42bc182a6 --- /dev/null +++ b/Assets/root/Server/Common/Data/Unity/GameObjectComponentsRef.cs @@ -0,0 +1,36 @@ +#pragma warning disable CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. +using System.ComponentModel; + +namespace com.IvanMurzak.ReflectorNet.Model.Unity +{ + [System.Serializable] + [Description(@"GameObject reference. Used to find GameObject in opened Prefab or in a Scene. +Use one of the following properties: +1. 'instanceID' (int) - recommended. It finds the exact GameObject. +2. 'path' (string) - finds GameObject by path. It may find a wrong GameObject. +3. 'name' (string) - finds GameObject by name. It may find a wrong GameObject.")] + public class GameObjectComponentsRef : GameObjectRef + { + [Description("GameObject 'components'.")] + public SerializedMemberList? components { get; set; } + + public GameObjectComponentsRef() { } + + public override string ToString() + { + var stringBuilder = new System.Text.StringBuilder(); + stringBuilder.AppendLine($"{base.ToString()}"); + if (components != null && components.Count > 0) + { + stringBuilder.AppendLine($"Components total amount: {components.Count}"); + for (int i = 0; i < components.Count; i++) + stringBuilder.AppendLine($"Component[{i}] {components[i]}"); + } + else + { + stringBuilder.AppendLine("No Components"); + } + return stringBuilder.ToString(); + } + } +} \ No newline at end of file diff --git a/Assets/root/Server/Common/Data/Unity/GameObjectData.cs.meta b/Assets/root/Server/Common/Data/Unity/GameObjectComponentsRef.cs.meta similarity index 100% rename from Assets/root/Server/Common/Data/Unity/GameObjectData.cs.meta rename to Assets/root/Server/Common/Data/Unity/GameObjectComponentsRef.cs.meta diff --git a/Assets/root/Server/Common/Data/Unity/GameObjectComponentsRefList.cs b/Assets/root/Server/Common/Data/Unity/GameObjectComponentsRefList.cs new file mode 100644 index 000000000..67e39fb60 --- /dev/null +++ b/Assets/root/Server/Common/Data/Unity/GameObjectComponentsRefList.cs @@ -0,0 +1,36 @@ +#pragma warning disable CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. +using System.Collections.Generic; +using System.ComponentModel; + +namespace com.IvanMurzak.ReflectorNet.Model.Unity +{ + [System.Serializable] + [Description(@"GameObject references. Used to specify GameObjects in opened Prefab or in a Scene. +Use one of the following properties: +1. 'instanceID' (int) - recommended. It finds the exact GameObject. +2. 'path' (string) - finds GameObject by path. It may find a wrong GameObject. +3. 'name' (string) - finds GameObject by name. It may find a wrong GameObject.")] + public class GameObjectComponentsRefList : List + { + public GameObjectComponentsRefList() { } + + public GameObjectComponentsRefList(int capacity) : base(capacity) { } + + public GameObjectComponentsRefList(IEnumerable collection) : base(collection) { } + + public override string ToString() + { + if (Count == 0) + return "No GameObjects"; + + var stringBuilder = new System.Text.StringBuilder(); + + stringBuilder.AppendLine($"GameObjects total amount: {Count}"); + + for (int i = 0; i < Count; i++) + stringBuilder.AppendLine($"GameObject[{i}] {this[i]}"); + + return stringBuilder.ToString(); + } + } +} \ No newline at end of file diff --git a/Assets/root/Server/Common/Data/Unity/GameObjectComponentsRefList.cs.meta b/Assets/root/Server/Common/Data/Unity/GameObjectComponentsRefList.cs.meta new file mode 100644 index 000000000..ffcf885cb --- /dev/null +++ b/Assets/root/Server/Common/Data/Unity/GameObjectComponentsRefList.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 305adfd236f5bf74d842967e3f44e679 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/root/Server/Common/Data/Unity/GameObjectData.cs b/Assets/root/Server/Common/Data/Unity/GameObjectData.cs deleted file mode 100644 index 2657391a0..000000000 --- a/Assets/root/Server/Common/Data/Unity/GameObjectData.cs +++ /dev/null @@ -1,14 +0,0 @@ -#pragma warning disable CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. -using System.Collections.Generic; -using com.IvanMurzak.ReflectorNet.Model.Unity; - -namespace com.IvanMurzak.ReflectorNet.Model.Unity -{ - [System.Serializable] - public class GameObjectData : GameObjectDataLight - { - public List components { get; set; } = new(); - - public GameObjectData() { } - } -} \ No newline at end of file diff --git a/Assets/root/Server/Common/Data/Unity/GameObjectDataLight.cs b/Assets/root/Server/Common/Data/Unity/GameObjectDataLight.cs index bd304f279..e1633e014 100644 --- a/Assets/root/Server/Common/Data/Unity/GameObjectDataLight.cs +++ b/Assets/root/Server/Common/Data/Unity/GameObjectDataLight.cs @@ -4,9 +4,6 @@ namespace com.IvanMurzak.ReflectorNet.Model.Unity [System.Serializable] public class GameObjectDataLight { - public string name { get; set; } = string.Empty; - public string tag { get; set; } = "Untagged"; - public int layer { get; set; } public int instanceID { get; set; } public GameObjectDataLight() { } diff --git a/Assets/root/Server/Common/Data/Unity/GameObjectRef.cs b/Assets/root/Server/Common/Data/Unity/GameObjectRef.cs index db86e84f7..635b1677a 100644 --- a/Assets/root/Server/Common/Data/Unity/GameObjectRef.cs +++ b/Assets/root/Server/Common/Data/Unity/GameObjectRef.cs @@ -4,7 +4,7 @@ namespace com.IvanMurzak.ReflectorNet.Model.Unity { - [Description(@"GameObject reference. Used to find GameObject in opened Prefab or in a Scene. + [Description(@"Find GameObject in opened Prefab or in a Scene. Use one of the following properties: 1. 'instanceID' (int) - recommended. It finds the exact GameObject. 2. 'path' (string) - finds GameObject by path. It may find a wrong GameObject. diff --git a/Assets/root/Server/Common/Data/Unity/GameObjectRefList.cs b/Assets/root/Server/Common/Data/Unity/GameObjectRefList.cs index ddfcaf475..a31e656f1 100644 --- a/Assets/root/Server/Common/Data/Unity/GameObjectRefList.cs +++ b/Assets/root/Server/Common/Data/Unity/GameObjectRefList.cs @@ -4,7 +4,7 @@ namespace com.IvanMurzak.ReflectorNet.Model.Unity { - [Description(@"GameObject references. Used to specify GameObjects in opened Prefab or in a Scene. + [Description(@"Array of GameObjects in opened Prefab or in a Scene. Used for finding GameObjects. Use one of the following properties: 1. 'instanceID' (int) - recommended. It finds the exact GameObject. 2. 'path' (string) - finds GameObject by path. It may find a wrong GameObject. diff --git a/Assets/root/Server/Common/Utils/Json/Converter/ObjectRefConverter.cs b/Assets/root/Server/Common/Utils/Json/Converter/ObjectRefConverter.cs index a3495754d..c42f9a632 100644 --- a/Assets/root/Server/Common/Utils/Json/Converter/ObjectRefConverter.cs +++ b/Assets/root/Server/Common/Utils/Json/Converter/ObjectRefConverter.cs @@ -3,29 +3,31 @@ using System.Text.Json; using System.Text.Json.Nodes; using System.Text.Json.Serialization; +using com.IvanMurzak.ReflectorNet; using com.IvanMurzak.ReflectorNet.Json; using com.IvanMurzak.ReflectorNet.Model.Unity; +using com.IvanMurzak.ReflectorNet.Utils; namespace com.IvanMurzak.Unity.MCP.Common.Json { public class ObjectRefConverter : JsonConverter, IJsonSchemaConverter { - public string Id => typeof(ObjectRef).FullName; + public string Id => typeof(ObjectRef).GetTypeId(); public JsonNode GetScheme() => new JsonObject { - ["id"] = Id, - ["type"] = "object", - ["properties"] = new JsonObject + [JsonUtils.Schema.Id] = Id, + [JsonUtils.Schema.Type] = JsonUtils.Schema.Object, + [JsonUtils.Schema.Properties] = new JsonObject { - [nameof(ObjectRef.instanceID)] = new JsonObject { ["type"] = "integer" }, - [nameof(ObjectRef.assetPath)] = new JsonObject { ["type"] = "string" }, - [nameof(ObjectRef.assetGuid)] = new JsonObject { ["type"] = "string" } + [nameof(ObjectRef.instanceID)] = new JsonObject { [JsonUtils.Schema.Type] = JsonUtils.Schema.Integer }, + [nameof(ObjectRef.assetPath)] = new JsonObject { [JsonUtils.Schema.Type] = JsonUtils.Schema.String }, + [nameof(ObjectRef.assetGuid)] = new JsonObject { [JsonUtils.Schema.Type] = JsonUtils.Schema.String } }, - ["required"] = new JsonArray { "instanceID" } + [JsonUtils.Schema.Required] = new JsonArray { "instanceID" } }; public JsonNode GetSchemeRef() => new JsonObject { - ["$ref"] = Id + [JsonUtils.Schema.Ref] = Id }; public override ObjectRef? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) diff --git a/Assets/root/Server/ReflectorNet.dll b/Assets/root/Server/ReflectorNet.dll new file mode 100644 index 000000000..ca79dfd15 Binary files /dev/null and b/Assets/root/Server/ReflectorNet.dll differ diff --git a/Assets/root/Server/ReflectorNet.dll.meta b/Assets/root/Server/ReflectorNet.dll.meta new file mode 100644 index 000000000..65bfdb891 --- /dev/null +++ b/Assets/root/Server/ReflectorNet.dll.meta @@ -0,0 +1,33 @@ +fileFormatVersion: 2 +guid: 0d05b553b8ad9ae4984353049a86bbc1 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/root/Server/Server/Utils/DataArguments.cs.meta b/Assets/root/Server/Server/Utils/DataArguments.cs.meta index e179fc0f8..781eeefd7 100644 --- a/Assets/root/Server/Server/Utils/DataArguments.cs.meta +++ b/Assets/root/Server/Server/Utils/DataArguments.cs.meta @@ -1,2 +1,11 @@ fileFormatVersion: 2 -guid: 66089ad30af6e0b418a43f5ea78c7cef \ No newline at end of file +guid: 66089ad30af6e0b418a43f5ea78c7cef +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/root/Server/com.IvanMurzak.Unity.MCP.Server.csproj b/Assets/root/Server/com.IvanMurzak.Unity.MCP.Server.csproj index e0489a95f..e481f6019 100644 --- a/Assets/root/Server/com.IvanMurzak.Unity.MCP.Server.csproj +++ b/Assets/root/Server/com.IvanMurzak.Unity.MCP.Server.csproj @@ -17,7 +17,7 @@ - + @@ -25,4 +25,11 @@ + + + ReflectorNet.dll + true + + + diff --git a/Assets/root/Server/version b/Assets/root/Server/version index f514a2f0b..f76f91317 100644 --- a/Assets/root/Server/version +++ b/Assets/root/Server/version @@ -1 +1 @@ -0.9.1 \ No newline at end of file +0.9.2 \ No newline at end of file diff --git a/Assets/root/Tests/Editor/Tool/GameObject/TestJsonSchema.cs b/Assets/root/Tests/Editor/Tool/GameObject/TestJsonSchema.cs index 3b05609c1..976fc4582 100644 --- a/Assets/root/Tests/Editor/Tool/GameObject/TestJsonSchema.cs +++ b/Assets/root/Tests/Editor/Tool/GameObject/TestJsonSchema.cs @@ -7,6 +7,7 @@ using UnityEngine.TestTools; using com.IvanMurzak.ReflectorNet.Utils; using com.IvanMurzak.ReflectorNet.Model; +using com.IvanMurzak.ReflectorNet; namespace com.IvanMurzak.Unity.MCP.Editor.Tests { @@ -15,20 +16,20 @@ public class TestJsonSchema : BaseTest static void ValidateType() => ValidateType(typeof(T)); static void ValidateType(Type type) { - var schema = JsonUtils.GetSchema(type); - UnityEngine.Debug.Log($"Schema for '{type.FullName}': {schema}"); + var schema = JsonUtils.Schema.GetSchema(type); + UnityEngine.Debug.Log($"Schema for '{type.GetTypeName(pretty: true)}': {schema}"); - Assert.IsNotNull(schema, $"Schema for '{type.FullName}' is null"); + Assert.IsNotNull(schema, $"Schema for '{type.GetTypeName(pretty: true)}' is null"); - var typeNodes = JsonUtils.FindAllProperties(schema, "type"); + var typeNodes = JsonUtils.Schema.FindAllProperties(schema, "type"); foreach (var typeNode in typeNodes) { switch (typeNode) { case JsonValue value: var typeValue = value.ToString(); - Assert.IsFalse(string.IsNullOrEmpty(typeValue), $"Type node for '{type.FullName}' is empty"); - Assert.IsFalse(typeValue == "null", $"Type node for '{type.FullName}' is \"null\" string"); + Assert.IsFalse(string.IsNullOrEmpty(typeValue), $"Type node for '{type.GetTypeName(pretty: true)}' is empty"); + Assert.IsFalse(typeValue == "null", $"Type node for '{type.GetTypeName(pretty: true)}' is \"null\" string"); break; default: if (typeNode is JsonObject typeObject) @@ -36,7 +37,7 @@ static void ValidateType(Type type) if (typeObject.TryGetPropertyValue("enum", out var enumValue)) continue; // Skip enum types } - Assert.Fail($"Unexpected type node for '{type.FullName}'.\nThe 'type' node has the type '{typeNode.GetType().Name}':\n{typeNode}"); + Assert.Fail($"Unexpected type node for '{type.GetTypeName(pretty: true)}'.\nThe 'type' node has the type '{typeNode.GetType().Name}':\n{typeNode}"); break; } } @@ -60,9 +61,10 @@ public IEnumerator Classes() // ValidateType(); ValidateType(); - ValidateType(); ValidateType(); ValidateType(); + ValidateType(); + ValidateType(); ValidateType(); ValidateType(); diff --git a/Assets/root/Tests/Editor/Tool/GameObject/TestJsonSerialize.cs b/Assets/root/Tests/Editor/Tool/GameObject/TestJsonSerialize.cs index fdb7df486..0e370b620 100644 --- a/Assets/root/Tests/Editor/Tool/GameObject/TestJsonSerialize.cs +++ b/Assets/root/Tests/Editor/Tool/GameObject/TestJsonSerialize.cs @@ -17,7 +17,7 @@ static void ValidateType(T sourceValue) var deserializedValue = JsonUtils.Deserialize(serializedValue); var areEqual = Reflector.Instance.AreEqual(sourceValue, deserializedValue); - Assert.IsTrue(areEqual, $"Serialized and deserialized values do not match for type '{typeof(T).FullName}'"); + Assert.IsTrue(areEqual, $"Serialized and deserialized values do not match for type '{typeof(T).GetTypeName(pretty: true)}'"); } [UnityTest] diff --git a/Assets/root/Tests/Editor/Tool/GameObject/TestSerializer.cs b/Assets/root/Tests/Editor/Tool/GameObject/TestSerializer.cs index 99c991ffd..4612a3355 100644 --- a/Assets/root/Tests/Editor/Tool/GameObject/TestSerializer.cs +++ b/Assets/root/Tests/Editor/Tool/GameObject/TestSerializer.cs @@ -150,7 +150,7 @@ void Test_Serialize_Deserialize(T sourceObj) { var type = typeof(T); var serializedObj = Reflector.Instance.Serialize(sourceObj, logger: McpPlugin.Instance.Logger); - var deserializedObj = Reflector.Instance.Deserialize(serializedObj, McpPlugin.Instance.Logger); + var deserializedObj = Reflector.Instance.Deserialize(serializedObj, logger: McpPlugin.Instance.Logger); Debug.Log($"[{type.Name}] Source:\n```json\n{JsonUtils.Serialize(sourceObj)}\n```"); Debug.Log($"[{type.Name}] Serialized:\n```json\n{JsonUtils.Serialize(serializedObj)}\n```"); diff --git a/Assets/root/Tests/Editor/Tool/GameObject/TestToolGameObject.ModifyComponent.cs b/Assets/root/Tests/Editor/Tool/GameObject/TestToolGameObject.ModifyComponent.cs index 2d4e6a751..965b747d7 100644 --- a/Assets/root/Tests/Editor/Tool/GameObject/TestToolGameObject.ModifyComponent.cs +++ b/Assets/root/Tests/Editor/Tool/GameObject/TestToolGameObject.ModifyComponent.cs @@ -49,6 +49,8 @@ public IEnumerator ModifyComponent_Vector3() [UnityTest] public IEnumerator ModifyComponent_Material() { + // "Standard" shader is always available in a Unity project. + // Doesn't matter whether it's built-in or URP/HDRP. var sharedMaterial = new Material(Shader.Find("Standard")); var go = new GameObject(GO_ParentName); @@ -58,7 +60,7 @@ public IEnumerator ModifyComponent_Material() name: go.name, type: typeof(GameObject), value: new ObjectRef(go.GetInstanceID())) - .AddField(SerializedMember.FromValue(name: "", + .AddField(SerializedMember.FromValue(name: string.Empty, type: typeof(MeshRenderer), value: new ObjectRef(component.GetInstanceID()) ) diff --git a/Assets/root/package.json b/Assets/root/package.json index f8711e39b..a25d6fa93 100644 --- a/Assets/root/package.json +++ b/Assets/root/package.json @@ -11,23 +11,23 @@ "MCP", "Unity MCP" ], - "version": "0.9.1", + "version": "0.10.0", "unity": "2022.3", "description": "Bridge between LLM and Unity. It expose Unity API to LLM and allows LLM to control Unity. It is based on Model Context Protocol (MCP) and uses SignalR for communication.", "dependencies": { "com.unity.test-framework": "1.1.33", "com.unity.modules.uielements": "1.0.0", - "org.nuget.microsoft.bcl.memory": "9.0.4", - "org.nuget.microsoft.aspnetcore.signalr.client": "9.0.4", - "org.nuget.microsoft.aspnetcore.signalr.protocols.json": "9.0.4", + "org.nuget.microsoft.bcl.memory": "9.0.7", + "org.nuget.microsoft.aspnetcore.signalr.client": "9.0.7", + "org.nuget.microsoft.aspnetcore.signalr.protocols.json": "9.0.7", "org.nuget.microsoft.codeanalysis.csharp": "4.13.0", - "org.nuget.microsoft.extensions.caching.abstractions": "9.0.4", - "org.nuget.microsoft.extensions.dependencyinjection.abstractions": "9.0.4", - "org.nuget.microsoft.extensions.hosting": "9.0.4", - "org.nuget.microsoft.extensions.hosting.abstractions": "9.0.4", - "org.nuget.microsoft.extensions.logging.abstractions": "9.0.4", + "org.nuget.microsoft.extensions.caching.abstractions": "9.0.7", + "org.nuget.microsoft.extensions.dependencyinjection.abstractions": "9.0.7", + "org.nuget.microsoft.extensions.hosting": "9.0.7", + "org.nuget.microsoft.extensions.hosting.abstractions": "9.0.7", + "org.nuget.microsoft.extensions.logging.abstractions": "9.0.7", "org.nuget.r3": "1.3.0", - "org.nuget.system.text.json": "9.0.4" + "org.nuget.system.text.json": "9.0.7" }, "scopedRegistries": [ { diff --git a/Packages/manifest.json b/Packages/manifest.json index 74985fc10..a87bcea6f 100644 --- a/Packages/manifest.json +++ b/Packages/manifest.json @@ -5,17 +5,17 @@ "com.unity.render-pipelines.universal": "14.0.12", "com.unity.test-framework": "1.1.33", "com.unity.toolchain.win-x86_64-linux-x86_64": "2.0.10", - "org.nuget.microsoft.aspnetcore.signalr.client": "9.0.4", - "org.nuget.microsoft.aspnetcore.signalr.protocols.json": "9.0.4", - "org.nuget.microsoft.bcl.memory": "9.0.4", + "org.nuget.microsoft.aspnetcore.signalr.client": "9.0.7", + "org.nuget.microsoft.aspnetcore.signalr.protocols.json": "9.0.7", + "org.nuget.microsoft.bcl.memory": "9.0.7", "org.nuget.microsoft.codeanalysis.csharp": "4.13.0", - "org.nuget.microsoft.extensions.caching.abstractions": "9.0.4", - "org.nuget.microsoft.extensions.dependencyinjection.abstractions": "9.0.3", - "org.nuget.microsoft.extensions.hosting": "9.0.4", - "org.nuget.microsoft.extensions.hosting.abstractions": "9.0.3", - "org.nuget.microsoft.extensions.logging.abstractions": "9.0.3", + "org.nuget.microsoft.extensions.caching.abstractions": "9.0.7", + "org.nuget.microsoft.extensions.dependencyinjection.abstractions": "9.0.7", + "org.nuget.microsoft.extensions.hosting": "9.0.7", + "org.nuget.microsoft.extensions.hosting.abstractions": "9.0.7", + "org.nuget.microsoft.extensions.logging.abstractions": "9.0.7", "org.nuget.r3": "1.3.0", - "org.nuget.system.text.json": "9.0.3", + "org.nuget.system.text.json": "9.0.7", "com.unity.modules.animation": "1.0.0", "com.unity.modules.particlesystem": "1.0.0", "com.unity.modules.physics": "1.0.0", @@ -91,4 +91,4 @@ ] } ] -} +} \ No newline at end of file diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index a38f4ab9e..4890a458f 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -136,84 +136,84 @@ } }, "org.nuget.microsoft.aspnetcore.connections.abstractions": { - "version": "9.0.4", + "version": "9.0.7", "depth": 2, "source": "registry", "dependencies": { - "org.nuget.microsoft.extensions.features": "9.0.4", - "org.nuget.microsoft.bcl.asyncinterfaces": "9.0.4", - "org.nuget.system.io.pipelines": "9.0.4" + "org.nuget.microsoft.extensions.features": "9.0.7", + "org.nuget.microsoft.bcl.asyncinterfaces": "9.0.7", + "org.nuget.system.io.pipelines": "9.0.7" }, "url": "https://package.openupm.com" }, "org.nuget.microsoft.aspnetcore.http.connections.client": { - "version": "9.0.4", + "version": "9.0.7", "depth": 1, "source": "registry", "dependencies": { - "org.nuget.microsoft.aspnetcore.http.connections.common": "9.0.4", - "org.nuget.microsoft.extensions.logging.abstractions": "9.0.4", - "org.nuget.microsoft.extensions.options": "9.0.4", - "org.nuget.system.net.serversentevents": "9.0.4" + "org.nuget.microsoft.aspnetcore.http.connections.common": "9.0.7", + "org.nuget.microsoft.extensions.logging.abstractions": "9.0.7", + "org.nuget.microsoft.extensions.options": "9.0.7", + "org.nuget.system.net.serversentevents": "9.0.7" }, "url": "https://package.openupm.com" }, "org.nuget.microsoft.aspnetcore.http.connections.common": { - "version": "9.0.4", + "version": "9.0.7", "depth": 2, "source": "registry", "dependencies": { - "org.nuget.microsoft.aspnetcore.connections.abstractions": "9.0.4", - "org.nuget.system.text.json": "9.0.4" + "org.nuget.microsoft.aspnetcore.connections.abstractions": "9.0.7", + "org.nuget.system.text.json": "9.0.7" }, "url": "https://package.openupm.com" }, "org.nuget.microsoft.aspnetcore.signalr.client": { - "version": "9.0.4", + "version": "9.0.7", "depth": 0, "source": "registry", "dependencies": { - "org.nuget.microsoft.aspnetcore.signalr.client.core": "9.0.4", - "org.nuget.microsoft.aspnetcore.http.connections.client": "9.0.4" + "org.nuget.microsoft.aspnetcore.signalr.client.core": "9.0.7", + "org.nuget.microsoft.aspnetcore.http.connections.client": "9.0.7" }, "url": "https://package.openupm.com" }, "org.nuget.microsoft.aspnetcore.signalr.client.core": { - "version": "9.0.4", + "version": "9.0.7", "depth": 1, "source": "registry", "dependencies": { - "org.nuget.microsoft.aspnetcore.signalr.protocols.json": "9.0.4", - "org.nuget.microsoft.aspnetcore.signalr.common": "9.0.4", - "org.nuget.microsoft.bcl.timeprovider": "9.0.4", - "org.nuget.microsoft.extensions.dependencyinjection": "9.0.4", - "org.nuget.microsoft.extensions.logging": "9.0.4", - "org.nuget.system.threading.channels": "9.0.4" + "org.nuget.microsoft.aspnetcore.signalr.protocols.json": "9.0.7", + "org.nuget.microsoft.aspnetcore.signalr.common": "9.0.7", + "org.nuget.microsoft.bcl.timeprovider": "9.0.7", + "org.nuget.microsoft.extensions.dependencyinjection": "9.0.7", + "org.nuget.microsoft.extensions.logging": "9.0.7", + "org.nuget.system.threading.channels": "9.0.7" }, "url": "https://package.openupm.com" }, "org.nuget.microsoft.aspnetcore.signalr.common": { - "version": "9.0.4", + "version": "9.0.7", "depth": 1, "source": "registry", "dependencies": { - "org.nuget.microsoft.aspnetcore.connections.abstractions": "9.0.4", - "org.nuget.microsoft.extensions.options": "9.0.4", - "org.nuget.system.text.json": "9.0.4" + "org.nuget.microsoft.aspnetcore.connections.abstractions": "9.0.7", + "org.nuget.microsoft.extensions.options": "9.0.7", + "org.nuget.system.text.json": "9.0.7" }, "url": "https://package.openupm.com" }, "org.nuget.microsoft.aspnetcore.signalr.protocols.json": { - "version": "9.0.4", + "version": "9.0.7", "depth": 0, "source": "registry", "dependencies": { - "org.nuget.microsoft.aspnetcore.signalr.common": "9.0.4" + "org.nuget.microsoft.aspnetcore.signalr.common": "9.0.7" }, "url": "https://package.openupm.com" }, "org.nuget.microsoft.bcl.asyncinterfaces": { - "version": "9.0.4", + "version": "9.0.7", "depth": 1, "source": "registry", "dependencies": { @@ -222,7 +222,7 @@ "url": "https://package.openupm.com" }, "org.nuget.microsoft.bcl.memory": { - "version": "9.0.4", + "version": "9.0.7", "depth": 0, "source": "registry", "dependencies": { @@ -232,11 +232,11 @@ "url": "https://package.openupm.com" }, "org.nuget.microsoft.bcl.timeprovider": { - "version": "9.0.4", + "version": "9.0.7", "depth": 2, "source": "registry", "dependencies": { - "org.nuget.microsoft.bcl.asyncinterfaces": "9.0.4" + "org.nuget.microsoft.bcl.asyncinterfaces": "9.0.7" }, "url": "https://package.openupm.com" }, @@ -283,351 +283,351 @@ "url": "https://package.openupm.com" }, "org.nuget.microsoft.extensions.caching.abstractions": { - "version": "9.0.4", + "version": "9.0.7", "depth": 0, "source": "registry", "dependencies": { - "org.nuget.microsoft.extensions.primitives": "9.0.4", + "org.nuget.microsoft.extensions.primitives": "9.0.7", "org.nuget.system.threading.tasks.extensions": "4.5.4" }, "url": "https://package.openupm.com" }, "org.nuget.microsoft.extensions.configuration": { - "version": "9.0.4", + "version": "9.0.7", "depth": 1, "source": "registry", "dependencies": { - "org.nuget.microsoft.extensions.configuration.abstractions": "9.0.4", - "org.nuget.microsoft.extensions.primitives": "9.0.4" + "org.nuget.microsoft.extensions.configuration.abstractions": "9.0.7", + "org.nuget.microsoft.extensions.primitives": "9.0.7" }, "url": "https://package.openupm.com" }, "org.nuget.microsoft.extensions.configuration.abstractions": { - "version": "9.0.4", + "version": "9.0.7", "depth": 1, "source": "registry", "dependencies": { - "org.nuget.microsoft.extensions.primitives": "9.0.4" + "org.nuget.microsoft.extensions.primitives": "9.0.7" }, "url": "https://package.openupm.com" }, "org.nuget.microsoft.extensions.configuration.binder": { - "version": "9.0.4", + "version": "9.0.7", "depth": 1, "source": "registry", "dependencies": { - "org.nuget.microsoft.extensions.configuration.abstractions": "9.0.4" + "org.nuget.microsoft.extensions.configuration.abstractions": "9.0.7" }, "url": "https://package.openupm.com" }, "org.nuget.microsoft.extensions.configuration.commandline": { - "version": "9.0.4", + "version": "9.0.7", "depth": 1, "source": "registry", "dependencies": { - "org.nuget.microsoft.extensions.configuration.abstractions": "9.0.4", - "org.nuget.microsoft.extensions.configuration": "9.0.4" + "org.nuget.microsoft.extensions.configuration.abstractions": "9.0.7", + "org.nuget.microsoft.extensions.configuration": "9.0.7" }, "url": "https://package.openupm.com" }, "org.nuget.microsoft.extensions.configuration.environmentvariables": { - "version": "9.0.4", + "version": "9.0.7", "depth": 1, "source": "registry", "dependencies": { - "org.nuget.microsoft.extensions.configuration.abstractions": "9.0.4", - "org.nuget.microsoft.extensions.configuration": "9.0.4" + "org.nuget.microsoft.extensions.configuration.abstractions": "9.0.7", + "org.nuget.microsoft.extensions.configuration": "9.0.7" }, "url": "https://package.openupm.com" }, "org.nuget.microsoft.extensions.configuration.fileextensions": { - "version": "9.0.4", + "version": "9.0.7", "depth": 1, "source": "registry", "dependencies": { - "org.nuget.microsoft.extensions.configuration.abstractions": "9.0.4", - "org.nuget.microsoft.extensions.configuration": "9.0.4", - "org.nuget.microsoft.extensions.fileproviders.abstractions": "9.0.4", - "org.nuget.microsoft.extensions.fileproviders.physical": "9.0.4", - "org.nuget.microsoft.extensions.primitives": "9.0.4" + "org.nuget.microsoft.extensions.configuration.abstractions": "9.0.7", + "org.nuget.microsoft.extensions.configuration": "9.0.7", + "org.nuget.microsoft.extensions.fileproviders.abstractions": "9.0.7", + "org.nuget.microsoft.extensions.fileproviders.physical": "9.0.7", + "org.nuget.microsoft.extensions.primitives": "9.0.7" }, "url": "https://package.openupm.com" }, "org.nuget.microsoft.extensions.configuration.json": { - "version": "9.0.4", + "version": "9.0.7", "depth": 1, "source": "registry", "dependencies": { - "org.nuget.microsoft.extensions.configuration.abstractions": "9.0.4", - "org.nuget.microsoft.extensions.configuration.fileextensions": "9.0.4", - "org.nuget.microsoft.extensions.configuration": "9.0.4", - "org.nuget.microsoft.extensions.fileproviders.abstractions": "9.0.4", - "org.nuget.system.text.json": "9.0.4" + "org.nuget.microsoft.extensions.configuration.abstractions": "9.0.7", + "org.nuget.microsoft.extensions.configuration.fileextensions": "9.0.7", + "org.nuget.microsoft.extensions.configuration": "9.0.7", + "org.nuget.microsoft.extensions.fileproviders.abstractions": "9.0.7", + "org.nuget.system.text.json": "9.0.7" }, "url": "https://package.openupm.com" }, "org.nuget.microsoft.extensions.configuration.usersecrets": { - "version": "9.0.4", + "version": "9.0.7", "depth": 1, "source": "registry", "dependencies": { - "org.nuget.microsoft.extensions.configuration.abstractions": "9.0.4", - "org.nuget.microsoft.extensions.configuration.json": "9.0.4", - "org.nuget.microsoft.extensions.fileproviders.abstractions": "9.0.4", - "org.nuget.microsoft.extensions.fileproviders.physical": "9.0.4" + "org.nuget.microsoft.extensions.configuration.abstractions": "9.0.7", + "org.nuget.microsoft.extensions.configuration.json": "9.0.7", + "org.nuget.microsoft.extensions.fileproviders.abstractions": "9.0.7", + "org.nuget.microsoft.extensions.fileproviders.physical": "9.0.7" }, "url": "https://package.openupm.com" }, "org.nuget.microsoft.extensions.dependencyinjection": { - "version": "9.0.4", + "version": "9.0.7", "depth": 1, "source": "registry", "dependencies": { - "org.nuget.microsoft.bcl.asyncinterfaces": "9.0.4", - "org.nuget.microsoft.extensions.dependencyinjection.abstractions": "9.0.4", + "org.nuget.microsoft.bcl.asyncinterfaces": "9.0.7", + "org.nuget.microsoft.extensions.dependencyinjection.abstractions": "9.0.7", "org.nuget.system.threading.tasks.extensions": "4.5.4" }, "url": "https://package.openupm.com" }, "org.nuget.microsoft.extensions.dependencyinjection.abstractions": { - "version": "9.0.4", - "depth": 1, + "version": "9.0.7", + "depth": 0, "source": "registry", "dependencies": { - "org.nuget.microsoft.bcl.asyncinterfaces": "9.0.4", + "org.nuget.microsoft.bcl.asyncinterfaces": "9.0.7", "org.nuget.system.threading.tasks.extensions": "4.5.4" }, "url": "https://package.openupm.com" }, "org.nuget.microsoft.extensions.diagnostics": { - "version": "9.0.4", + "version": "9.0.7", "depth": 1, "source": "registry", "dependencies": { - "org.nuget.microsoft.extensions.configuration": "9.0.4", - "org.nuget.microsoft.extensions.diagnostics.abstractions": "9.0.4", - "org.nuget.microsoft.extensions.options.configurationextensions": "9.0.4" + "org.nuget.microsoft.extensions.configuration": "9.0.7", + "org.nuget.microsoft.extensions.diagnostics.abstractions": "9.0.7", + "org.nuget.microsoft.extensions.options.configurationextensions": "9.0.7" }, "url": "https://package.openupm.com" }, "org.nuget.microsoft.extensions.diagnostics.abstractions": { - "version": "9.0.4", - "depth": 2, + "version": "9.0.7", + "depth": 1, "source": "registry", "dependencies": { - "org.nuget.microsoft.extensions.dependencyinjection.abstractions": "9.0.4", - "org.nuget.microsoft.extensions.options": "9.0.4", - "org.nuget.system.diagnostics.diagnosticsource": "9.0.4", + "org.nuget.microsoft.extensions.dependencyinjection.abstractions": "9.0.7", + "org.nuget.microsoft.extensions.options": "9.0.7", + "org.nuget.system.diagnostics.diagnosticsource": "9.0.7", "org.nuget.system.buffers": "4.5.1", "org.nuget.system.memory": "4.5.5" }, "url": "https://package.openupm.com" }, "org.nuget.microsoft.extensions.features": { - "version": "9.0.4", + "version": "9.0.7", "depth": 3, "source": "registry", "dependencies": {}, "url": "https://package.openupm.com" }, "org.nuget.microsoft.extensions.fileproviders.abstractions": { - "version": "9.0.4", + "version": "9.0.7", "depth": 1, "source": "registry", "dependencies": { - "org.nuget.microsoft.extensions.primitives": "9.0.4" + "org.nuget.microsoft.extensions.primitives": "9.0.7" }, "url": "https://package.openupm.com" }, "org.nuget.microsoft.extensions.fileproviders.physical": { - "version": "9.0.4", + "version": "9.0.7", "depth": 1, "source": "registry", "dependencies": { - "org.nuget.microsoft.extensions.fileproviders.abstractions": "9.0.4", - "org.nuget.microsoft.extensions.filesystemglobbing": "9.0.4", - "org.nuget.microsoft.extensions.primitives": "9.0.4" + "org.nuget.microsoft.extensions.fileproviders.abstractions": "9.0.7", + "org.nuget.microsoft.extensions.filesystemglobbing": "9.0.7", + "org.nuget.microsoft.extensions.primitives": "9.0.7" }, "url": "https://package.openupm.com" }, "org.nuget.microsoft.extensions.filesystemglobbing": { - "version": "9.0.4", + "version": "9.0.7", "depth": 2, "source": "registry", "dependencies": {}, "url": "https://package.openupm.com" }, "org.nuget.microsoft.extensions.hosting": { - "version": "9.0.4", + "version": "9.0.7", "depth": 0, "source": "registry", "dependencies": { - "org.nuget.microsoft.bcl.asyncinterfaces": "9.0.4", - "org.nuget.microsoft.extensions.configuration.abstractions": "9.0.4", - "org.nuget.microsoft.extensions.configuration.binder": "9.0.4", - "org.nuget.microsoft.extensions.configuration.commandline": "9.0.4", - "org.nuget.microsoft.extensions.configuration.environmentvariables": "9.0.4", - "org.nuget.microsoft.extensions.configuration.fileextensions": "9.0.4", - "org.nuget.microsoft.extensions.configuration.json": "9.0.4", - "org.nuget.microsoft.extensions.configuration.usersecrets": "9.0.4", - "org.nuget.microsoft.extensions.configuration": "9.0.4", - "org.nuget.microsoft.extensions.dependencyinjection.abstractions": "9.0.4", - "org.nuget.microsoft.extensions.dependencyinjection": "9.0.4", - "org.nuget.microsoft.extensions.diagnostics": "9.0.4", - "org.nuget.microsoft.extensions.fileproviders.abstractions": "9.0.4", - "org.nuget.microsoft.extensions.fileproviders.physical": "9.0.4", - "org.nuget.microsoft.extensions.hosting.abstractions": "9.0.4", - "org.nuget.microsoft.extensions.logging.abstractions": "9.0.4", - "org.nuget.microsoft.extensions.logging.configuration": "9.0.4", - "org.nuget.microsoft.extensions.logging.console": "9.0.4", - "org.nuget.microsoft.extensions.logging.debug": "9.0.4", - "org.nuget.microsoft.extensions.logging.eventlog": "9.0.4", - "org.nuget.microsoft.extensions.logging.eventsource": "9.0.4", - "org.nuget.microsoft.extensions.logging": "9.0.4", - "org.nuget.microsoft.extensions.options": "9.0.4", + "org.nuget.microsoft.bcl.asyncinterfaces": "9.0.7", + "org.nuget.microsoft.extensions.configuration.abstractions": "9.0.7", + "org.nuget.microsoft.extensions.configuration.binder": "9.0.7", + "org.nuget.microsoft.extensions.configuration.commandline": "9.0.7", + "org.nuget.microsoft.extensions.configuration.environmentvariables": "9.0.7", + "org.nuget.microsoft.extensions.configuration.fileextensions": "9.0.7", + "org.nuget.microsoft.extensions.configuration.json": "9.0.7", + "org.nuget.microsoft.extensions.configuration.usersecrets": "9.0.7", + "org.nuget.microsoft.extensions.configuration": "9.0.7", + "org.nuget.microsoft.extensions.dependencyinjection.abstractions": "9.0.7", + "org.nuget.microsoft.extensions.dependencyinjection": "9.0.7", + "org.nuget.microsoft.extensions.diagnostics": "9.0.7", + "org.nuget.microsoft.extensions.fileproviders.abstractions": "9.0.7", + "org.nuget.microsoft.extensions.fileproviders.physical": "9.0.7", + "org.nuget.microsoft.extensions.hosting.abstractions": "9.0.7", + "org.nuget.microsoft.extensions.logging.abstractions": "9.0.7", + "org.nuget.microsoft.extensions.logging.configuration": "9.0.7", + "org.nuget.microsoft.extensions.logging.console": "9.0.7", + "org.nuget.microsoft.extensions.logging.debug": "9.0.7", + "org.nuget.microsoft.extensions.logging.eventlog": "9.0.7", + "org.nuget.microsoft.extensions.logging.eventsource": "9.0.7", + "org.nuget.microsoft.extensions.logging": "9.0.7", + "org.nuget.microsoft.extensions.options": "9.0.7", "org.nuget.system.threading.tasks.extensions": "4.5.4" }, "url": "https://package.openupm.com" }, "org.nuget.microsoft.extensions.hosting.abstractions": { - "version": "9.0.4", - "depth": 1, + "version": "9.0.7", + "depth": 0, "source": "registry", "dependencies": { - "org.nuget.microsoft.bcl.asyncinterfaces": "9.0.4", - "org.nuget.microsoft.extensions.configuration.abstractions": "9.0.4", - "org.nuget.microsoft.extensions.dependencyinjection.abstractions": "9.0.4", - "org.nuget.microsoft.extensions.diagnostics.abstractions": "9.0.4", - "org.nuget.microsoft.extensions.fileproviders.abstractions": "9.0.4", - "org.nuget.microsoft.extensions.logging.abstractions": "9.0.4", + "org.nuget.microsoft.bcl.asyncinterfaces": "9.0.7", + "org.nuget.microsoft.extensions.configuration.abstractions": "9.0.7", + "org.nuget.microsoft.extensions.dependencyinjection.abstractions": "9.0.7", + "org.nuget.microsoft.extensions.diagnostics.abstractions": "9.0.7", + "org.nuget.microsoft.extensions.fileproviders.abstractions": "9.0.7", + "org.nuget.microsoft.extensions.logging.abstractions": "9.0.7", "org.nuget.system.threading.tasks.extensions": "4.5.4" }, "url": "https://package.openupm.com" }, "org.nuget.microsoft.extensions.logging": { - "version": "9.0.4", + "version": "9.0.7", "depth": 1, "source": "registry", "dependencies": { - "org.nuget.microsoft.bcl.asyncinterfaces": "9.0.4", - "org.nuget.microsoft.extensions.dependencyinjection": "9.0.4", - "org.nuget.microsoft.extensions.logging.abstractions": "9.0.4", - "org.nuget.microsoft.extensions.options": "9.0.4", - "org.nuget.system.diagnostics.diagnosticsource": "9.0.4" + "org.nuget.microsoft.bcl.asyncinterfaces": "9.0.7", + "org.nuget.microsoft.extensions.dependencyinjection": "9.0.7", + "org.nuget.microsoft.extensions.logging.abstractions": "9.0.7", + "org.nuget.microsoft.extensions.options": "9.0.7", + "org.nuget.system.diagnostics.diagnosticsource": "9.0.7" }, "url": "https://package.openupm.com" }, "org.nuget.microsoft.extensions.logging.abstractions": { - "version": "9.0.4", - "depth": 1, + "version": "9.0.7", + "depth": 0, "source": "registry", "dependencies": { - "org.nuget.microsoft.extensions.dependencyinjection.abstractions": "9.0.4", - "org.nuget.system.diagnostics.diagnosticsource": "9.0.4", + "org.nuget.microsoft.extensions.dependencyinjection.abstractions": "9.0.7", + "org.nuget.system.diagnostics.diagnosticsource": "9.0.7", "org.nuget.system.buffers": "4.5.1", "org.nuget.system.memory": "4.5.5" }, "url": "https://package.openupm.com" }, "org.nuget.microsoft.extensions.logging.configuration": { - "version": "9.0.4", + "version": "9.0.7", "depth": 1, "source": "registry", "dependencies": { - "org.nuget.microsoft.extensions.configuration.abstractions": "9.0.4", - "org.nuget.microsoft.extensions.configuration.binder": "9.0.4", - "org.nuget.microsoft.extensions.configuration": "9.0.4", - "org.nuget.microsoft.extensions.dependencyinjection.abstractions": "9.0.4", - "org.nuget.microsoft.extensions.logging.abstractions": "9.0.4", - "org.nuget.microsoft.extensions.logging": "9.0.4", - "org.nuget.microsoft.extensions.options.configurationextensions": "9.0.4", - "org.nuget.microsoft.extensions.options": "9.0.4" + "org.nuget.microsoft.extensions.configuration.abstractions": "9.0.7", + "org.nuget.microsoft.extensions.configuration.binder": "9.0.7", + "org.nuget.microsoft.extensions.configuration": "9.0.7", + "org.nuget.microsoft.extensions.dependencyinjection.abstractions": "9.0.7", + "org.nuget.microsoft.extensions.logging.abstractions": "9.0.7", + "org.nuget.microsoft.extensions.logging": "9.0.7", + "org.nuget.microsoft.extensions.options.configurationextensions": "9.0.7", + "org.nuget.microsoft.extensions.options": "9.0.7" }, "url": "https://package.openupm.com" }, "org.nuget.microsoft.extensions.logging.console": { - "version": "9.0.4", + "version": "9.0.7", "depth": 1, "source": "registry", "dependencies": { - "org.nuget.microsoft.bcl.asyncinterfaces": "9.0.4", - "org.nuget.microsoft.extensions.dependencyinjection.abstractions": "9.0.4", - "org.nuget.microsoft.extensions.logging.abstractions": "9.0.4", - "org.nuget.microsoft.extensions.logging.configuration": "9.0.4", - "org.nuget.microsoft.extensions.logging": "9.0.4", - "org.nuget.microsoft.extensions.options": "9.0.4", - "org.nuget.system.text.json": "9.0.4", + "org.nuget.microsoft.bcl.asyncinterfaces": "9.0.7", + "org.nuget.microsoft.extensions.dependencyinjection.abstractions": "9.0.7", + "org.nuget.microsoft.extensions.logging.abstractions": "9.0.7", + "org.nuget.microsoft.extensions.logging.configuration": "9.0.7", + "org.nuget.microsoft.extensions.logging": "9.0.7", + "org.nuget.microsoft.extensions.options": "9.0.7", + "org.nuget.system.text.json": "9.0.7", "org.nuget.system.buffers": "4.5.1" }, "url": "https://package.openupm.com" }, "org.nuget.microsoft.extensions.logging.debug": { - "version": "9.0.4", + "version": "9.0.7", "depth": 1, "source": "registry", "dependencies": { - "org.nuget.microsoft.extensions.dependencyinjection.abstractions": "9.0.4", - "org.nuget.microsoft.extensions.logging.abstractions": "9.0.4", - "org.nuget.microsoft.extensions.logging": "9.0.4" + "org.nuget.microsoft.extensions.dependencyinjection.abstractions": "9.0.7", + "org.nuget.microsoft.extensions.logging.abstractions": "9.0.7", + "org.nuget.microsoft.extensions.logging": "9.0.7" }, "url": "https://package.openupm.com" }, "org.nuget.microsoft.extensions.logging.eventlog": { - "version": "9.0.4", + "version": "9.0.7", "depth": 1, "source": "registry", "dependencies": { - "org.nuget.microsoft.extensions.dependencyinjection.abstractions": "9.0.4", - "org.nuget.microsoft.extensions.logging.abstractions": "9.0.4", - "org.nuget.microsoft.extensions.logging": "9.0.4", - "org.nuget.microsoft.extensions.options": "9.0.4", - "org.nuget.system.diagnostics.eventlog": "9.0.4" + "org.nuget.microsoft.extensions.dependencyinjection.abstractions": "9.0.7", + "org.nuget.microsoft.extensions.logging.abstractions": "9.0.7", + "org.nuget.microsoft.extensions.logging": "9.0.7", + "org.nuget.microsoft.extensions.options": "9.0.7", + "org.nuget.system.diagnostics.eventlog": "9.0.7" }, "url": "https://package.openupm.com" }, "org.nuget.microsoft.extensions.logging.eventsource": { - "version": "9.0.4", + "version": "9.0.7", "depth": 1, "source": "registry", "dependencies": { - "org.nuget.microsoft.bcl.asyncinterfaces": "9.0.4", - "org.nuget.microsoft.extensions.dependencyinjection.abstractions": "9.0.4", - "org.nuget.microsoft.extensions.logging.abstractions": "9.0.4", - "org.nuget.microsoft.extensions.logging": "9.0.4", - "org.nuget.microsoft.extensions.options": "9.0.4", - "org.nuget.microsoft.extensions.primitives": "9.0.4", - "org.nuget.system.text.json": "9.0.4", + "org.nuget.microsoft.bcl.asyncinterfaces": "9.0.7", + "org.nuget.microsoft.extensions.dependencyinjection.abstractions": "9.0.7", + "org.nuget.microsoft.extensions.logging.abstractions": "9.0.7", + "org.nuget.microsoft.extensions.logging": "9.0.7", + "org.nuget.microsoft.extensions.options": "9.0.7", + "org.nuget.microsoft.extensions.primitives": "9.0.7", + "org.nuget.system.text.json": "9.0.7", "org.nuget.system.memory": "4.5.5", "org.nuget.system.runtime.compilerservices.unsafe": "6.0.0" }, "url": "https://package.openupm.com" }, "org.nuget.microsoft.extensions.options": { - "version": "9.0.4", + "version": "9.0.7", "depth": 1, "source": "registry", "dependencies": { - "org.nuget.microsoft.extensions.dependencyinjection.abstractions": "9.0.4", - "org.nuget.microsoft.extensions.primitives": "9.0.4", + "org.nuget.microsoft.extensions.dependencyinjection.abstractions": "9.0.7", + "org.nuget.microsoft.extensions.primitives": "9.0.7", "org.nuget.system.componentmodel.annotations": "5.0.0" }, "url": "https://package.openupm.com" }, "org.nuget.microsoft.extensions.options.configurationextensions": { - "version": "9.0.4", + "version": "9.0.7", "depth": 2, "source": "registry", "dependencies": { - "org.nuget.microsoft.extensions.configuration.abstractions": "9.0.4", - "org.nuget.microsoft.extensions.configuration.binder": "9.0.4", - "org.nuget.microsoft.extensions.dependencyinjection.abstractions": "9.0.4", - "org.nuget.microsoft.extensions.options": "9.0.4", - "org.nuget.microsoft.extensions.primitives": "9.0.4" + "org.nuget.microsoft.extensions.configuration.abstractions": "9.0.7", + "org.nuget.microsoft.extensions.configuration.binder": "9.0.7", + "org.nuget.microsoft.extensions.dependencyinjection.abstractions": "9.0.7", + "org.nuget.microsoft.extensions.options": "9.0.7", + "org.nuget.microsoft.extensions.primitives": "9.0.7" }, "url": "https://package.openupm.com" }, "org.nuget.microsoft.extensions.primitives": { - "version": "9.0.4", + "version": "9.0.7", "depth": 1, "source": "registry", "dependencies": { @@ -675,8 +675,8 @@ "url": "https://package.openupm.com" }, "org.nuget.system.diagnostics.diagnosticsource": { - "version": "9.0.4", - "depth": 2, + "version": "9.0.7", + "depth": 1, "source": "registry", "dependencies": { "org.nuget.system.memory": "4.5.5", @@ -685,7 +685,7 @@ "url": "https://package.openupm.com" }, "org.nuget.system.diagnostics.eventlog": { - "version": "9.0.4", + "version": "9.0.7", "depth": 2, "source": "registry", "dependencies": { @@ -694,8 +694,8 @@ "url": "https://package.openupm.com" }, "org.nuget.system.io.pipelines": { - "version": "9.0.4", - "depth": 3, + "version": "9.0.7", + "depth": 1, "source": "registry", "dependencies": { "org.nuget.system.buffers": "4.5.1", @@ -716,11 +716,11 @@ "url": "https://package.openupm.com" }, "org.nuget.system.net.serversentevents": { - "version": "9.0.4", + "version": "9.0.7", "depth": 2, "source": "registry", "dependencies": { - "org.nuget.microsoft.bcl.asyncinterfaces": "9.0.4", + "org.nuget.microsoft.bcl.asyncinterfaces": "9.0.7", "org.nuget.system.memory": "4.5.5", "org.nuget.system.threading.tasks.extensions": "4.5.4" }, @@ -768,8 +768,8 @@ "url": "https://package.openupm.com" }, "org.nuget.system.text.encodings.web": { - "version": "9.0.4", - "depth": 3, + "version": "9.0.7", + "depth": 1, "source": "registry", "dependencies": { "org.nuget.system.buffers": "4.5.1", @@ -779,13 +779,13 @@ "url": "https://package.openupm.com" }, "org.nuget.system.text.json": { - "version": "9.0.4", - "depth": 2, + "version": "9.0.7", + "depth": 0, "source": "registry", "dependencies": { - "org.nuget.microsoft.bcl.asyncinterfaces": "9.0.4", - "org.nuget.system.io.pipelines": "9.0.4", - "org.nuget.system.text.encodings.web": "9.0.4", + "org.nuget.microsoft.bcl.asyncinterfaces": "9.0.7", + "org.nuget.system.io.pipelines": "9.0.7", + "org.nuget.system.text.encodings.web": "9.0.7", "org.nuget.system.buffers": "4.5.1", "org.nuget.system.memory": "4.5.5", "org.nuget.system.runtime.compilerservices.unsafe": "6.0.0", @@ -794,11 +794,11 @@ "url": "https://package.openupm.com" }, "org.nuget.system.threading.channels": { - "version": "9.0.4", + "version": "9.0.7", "depth": 2, "source": "registry", "dependencies": { - "org.nuget.microsoft.bcl.asyncinterfaces": "9.0.4", + "org.nuget.microsoft.bcl.asyncinterfaces": "9.0.7", "org.nuget.system.threading.tasks.extensions": "4.5.4" }, "url": "https://package.openupm.com" diff --git a/ProjectSettings/EditorBuildSettings.asset b/ProjectSettings/EditorBuildSettings.asset index 38f6f9855..1b6bb1ed8 100644 --- a/ProjectSettings/EditorBuildSettings.asset +++ b/ProjectSettings/EditorBuildSettings.asset @@ -6,6 +6,6 @@ EditorBuildSettings: serializedVersion: 2 m_Scenes: - enabled: 1 - path: Assets/Demo Setup/Scenes/Blank.unity - guid: ea020da71567ac6428a54e6fa5e09035 + path: Assets/Demo Setup/Scenes/NoLightmap.unity + guid: 2b30ef47f4fdab945aefb246f19b0ba9 m_configObjects: {} diff --git a/UserSettings/EditorUserSettings.asset b/UserSettings/EditorUserSettings.asset index 26423e1d1..371b275bf 100644 --- a/UserSettings/EditorUserSettings.asset +++ b/UserSettings/EditorUserSettings.asset @@ -6,34 +6,34 @@ EditorUserSettings: serializedVersion: 4 m_ConfigSettings: RecentlyUsedSceneGuid-0: - value: 0004575354005c59085c5b2113705e4410151d2b79787063797a4e30e3b7656f + value: 5b55005103075c5a5f5b5d7246275b4410154c2c757a74667c2f4e65bbb8626b flags: 0 RecentlyUsedSceneGuid-1: - value: 5b55005103075c5a5f5b5d7246275b4410154c2c757a74667c2f4e65bbb8626b + value: 0252575251510b0b5d0d0a7147730c44414e1c2c7c7c233174791f32e6b26269 flags: 0 RecentlyUsedSceneGuid-2: - value: 0252575251510b0b5d0d0a7147730c44414e1c2c7c7c233174791f32e6b26269 + value: 5007500500040a0f080d0a7a43250844454e4a29747b70612b7d4f36bab7316f flags: 0 RecentlyUsedSceneGuid-3: - value: 5007500500040a0f080d0a7a43250844454e4a29747b70612b7d4f36bab7316f + value: 5402015252545e0f55580a204470594443154e722a2d22657d2c4b6bb2e5626c flags: 0 RecentlyUsedSceneGuid-4: - value: 5402015252545e0f55580a204470594443154e722a2d22657d2c4b6bb2e5626c + value: 055402045c54580c5b590f24127b0f44444f1b29742c70627a794f37b1b8316e flags: 0 RecentlyUsedSceneGuid-5: - value: 055402045c54580c5b590f24127b0f44444f1b29742c70627a794f37b1b8316e + value: 5706010003000d5f0f5c0a231673594447154b292f7a76677e7c4e61e6e56c3e flags: 0 RecentlyUsedSceneGuid-6: - value: 5706010003000d5f0f5c0a231673594447154b292f7a76677e7c4e61e6e56c3e + value: 0702505550075e0d590d0f7312710c44404e4a7f7e2a74317c704a61e1e56d3b flags: 0 RecentlyUsedSceneGuid-7: - value: 0702505550075e0d590d0f7312710c44404e4a7f7e2a74317c704a61e1e56d3b + value: 5a06565600560c59085a0e724927084413151c2e7e787133287b4b6be1e13568 flags: 0 RecentlyUsedSceneGuid-8: - value: 5a06565600560c59085a0e724927084413151c2e7e787133287b4b6be1e13568 + value: 065004545551080c5c5b5a7511200944444f197f782d70362c7c1863bbb0676d flags: 0 RecentlyUsedSceneGuid-9: - value: 065004545551080c5c5b5a7511200944444f197f782d70362c7c1863bbb0676d + value: 5153075600535d0c0b5a0a261121064443161d2c2e7a72662b784431b2e23561 flags: 0 vcSharedLogLevel: value: 0d5e400f0650