提交生成预制体的插件
This commit is contained in:
parent
290d18bddf
commit
7e298559f1
|
@ -189,7 +189,7 @@ Transform:
|
|||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 4
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &1223469925
|
||||
GameObject:
|
||||
|
@ -208,7 +208,7 @@ GameObject:
|
|||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 0
|
||||
m_IsActive: 1
|
||||
--- !u!81 &1223469926
|
||||
AudioListener:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -275,161 +275,6 @@ Transform:
|
|||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &1412159801
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1412159805}
|
||||
- component: {fileID: 1412159804}
|
||||
- component: {fileID: 1412159803}
|
||||
- component: {fileID: 1412159802}
|
||||
m_Layer: 0
|
||||
m_Name: Plane
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!64 &1412159802
|
||||
MeshCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1412159801}
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 4
|
||||
m_Convex: 0
|
||||
m_CookingOptions: 30
|
||||
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!23 &1412159803
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1412159801}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!33 &1412159804
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1412159801}
|
||||
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!4 &1412159805
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1412159801}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 3
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1001 &1439261909
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: 2399593117452945565, guid: 86a8666f9623b6b46b8f4b860a11546f, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: Player
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2399593117452945566, guid: 86a8666f9623b6b46b8f4b860a11546f, type: 3}
|
||||
propertyPath: m_RootOrder
|
||||
value: 2
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2399593117452945566, guid: 86a8666f9623b6b46b8f4b860a11546f, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2399593117452945566, guid: 86a8666f9623b6b46b8f4b860a11546f, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2399593117452945566, guid: 86a8666f9623b6b46b8f4b860a11546f, type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2399593117452945566, guid: 86a8666f9623b6b46b8f4b860a11546f, type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2399593117452945566, guid: 86a8666f9623b6b46b8f4b860a11546f, type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2399593117452945566, guid: 86a8666f9623b6b46b8f4b860a11546f, type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2399593117452945566, guid: 86a8666f9623b6b46b8f4b860a11546f, type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2399593117452945566, guid: 86a8666f9623b6b46b8f4b860a11546f, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2399593117452945566, guid: 86a8666f9623b6b46b8f4b860a11546f, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2399593117452945566, guid: 86a8666f9623b6b46b8f4b860a11546f, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 86a8666f9623b6b46b8f4b860a11546f, type: 3}
|
||||
--- !u!1 &2055337780
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
@ -0,0 +1,526 @@
|
|||
%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_IndirectSpecularColor: {r: 0.18028378, g: 0.22571412, b: 0.30692285, a: 1}
|
||||
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: 2
|
||||
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
|
||||
accuratePlacement: 0
|
||||
maxJobWorkers: 0
|
||||
preserveTilesOutsideBounds: 0
|
||||
debug:
|
||||
m_Flags: 0
|
||||
m_NavMeshData: {fileID: 0}
|
||||
--- !u!1 &437018757
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 437018760}
|
||||
- component: {fileID: 437018759}
|
||||
- component: {fileID: 437018758}
|
||||
m_Layer: 0
|
||||
m_Name: EventSystem
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &437018758
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 437018757}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_SendPointerHoverToParent: 1
|
||||
m_HorizontalAxis: Horizontal
|
||||
m_VerticalAxis: Vertical
|
||||
m_SubmitButton: Submit
|
||||
m_CancelButton: Cancel
|
||||
m_InputActionsPerSecond: 10
|
||||
m_RepeatDelay: 0.5
|
||||
m_ForceModuleActive: 0
|
||||
--- !u!114 &437018759
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 437018757}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_FirstSelected: {fileID: 0}
|
||||
m_sendNavigationEvents: 1
|
||||
m_DragThreshold: 10
|
||||
--- !u!4 &437018760
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 437018757}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 4
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &1223469925
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1223469928}
|
||||
- component: {fileID: 1223469927}
|
||||
- component: {fileID: 1223469926}
|
||||
m_Layer: 0
|
||||
m_Name: Main Camera
|
||||
m_TagString: MainCamera
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 0
|
||||
--- !u!81 &1223469926
|
||||
AudioListener:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1223469925}
|
||||
m_Enabled: 1
|
||||
--- !u!20 &1223469927
|
||||
Camera:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1223469925}
|
||||
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_SensorSize: {x: 36, y: 24}
|
||||
m_LensShift: {x: 0, y: 0}
|
||||
m_FocalLength: 50
|
||||
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 &1223469928
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1223469925}
|
||||
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_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &1412159801
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1412159805}
|
||||
- component: {fileID: 1412159804}
|
||||
- component: {fileID: 1412159803}
|
||||
- component: {fileID: 1412159802}
|
||||
m_Layer: 0
|
||||
m_Name: Plane
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!64 &1412159802
|
||||
MeshCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1412159801}
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 4
|
||||
m_Convex: 0
|
||||
m_CookingOptions: 30
|
||||
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!23 &1412159803
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1412159801}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!33 &1412159804
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1412159801}
|
||||
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!4 &1412159805
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1412159801}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 3
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1001 &1439261909
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: 2399593117452945565, guid: 86a8666f9623b6b46b8f4b860a11546f, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: Player
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2399593117452945566, guid: 86a8666f9623b6b46b8f4b860a11546f, type: 3}
|
||||
propertyPath: m_RootOrder
|
||||
value: 2
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2399593117452945566, guid: 86a8666f9623b6b46b8f4b860a11546f, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2399593117452945566, guid: 86a8666f9623b6b46b8f4b860a11546f, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2399593117452945566, guid: 86a8666f9623b6b46b8f4b860a11546f, type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2399593117452945566, guid: 86a8666f9623b6b46b8f4b860a11546f, type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2399593117452945566, guid: 86a8666f9623b6b46b8f4b860a11546f, type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2399593117452945566, guid: 86a8666f9623b6b46b8f4b860a11546f, type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2399593117452945566, guid: 86a8666f9623b6b46b8f4b860a11546f, type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2399593117452945566, guid: 86a8666f9623b6b46b8f4b860a11546f, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2399593117452945566, guid: 86a8666f9623b6b46b8f4b860a11546f, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2399593117452945566, guid: 86a8666f9623b6b46b8f4b860a11546f, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 86a8666f9623b6b46b8f4b860a11546f, type: 3}
|
||||
--- !u!1 &2055337780
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 2055337782}
|
||||
- component: {fileID: 2055337781}
|
||||
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 &2055337781
|
||||
Light:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2055337780}
|
||||
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 &2055337782
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2055337780}
|
||||
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_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 69f5ada918e46ea4d871220aaf43d1be
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8f1d23ea114c053428c17701b7e665dc
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,327 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using DG.Tweening;
|
||||
using UnityEditor;
|
||||
using UnityEditor.SceneManagement;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UIElements;
|
||||
using System.Reflection;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
public class AutoGenerate : EditorWindow
|
||||
{
|
||||
#region Component
|
||||
|
||||
private VisualElement root;
|
||||
private Label titleText;
|
||||
private Label hintText;
|
||||
|
||||
private Toggle testScene; //测试场景是否生成
|
||||
private Toggle dynamicSprite; //动态文件夹是否生成
|
||||
|
||||
private Button generateBtn;
|
||||
private TextField nameInput;
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Path
|
||||
|
||||
private string testScenePath;
|
||||
private string scriptPath;
|
||||
private string uiPrefabPath;
|
||||
private string uiStaticSpritePath;
|
||||
private string uidynamicSpritePath;
|
||||
|
||||
private string uiTemplatePath;
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
[MenuItem("Tools/Generate Editor Window")]
|
||||
public static void ShowExample()
|
||||
{
|
||||
AutoGenerate wnd = GetWindow<AutoGenerate>();
|
||||
wnd.titleContent = new GUIContent("Auto Generate UI Window");
|
||||
}
|
||||
|
||||
public void CreateGUI()
|
||||
{
|
||||
testScenePath = "Assets/Temp/TestUIPanelScenes";
|
||||
scriptPath = "Assets/Runtime/UIPanels";
|
||||
uiPrefabPath = "Assets/Resources/UI/UI_Panel";
|
||||
uiStaticSpritePath = "Assets/ArtRes/UIStaticSprites";
|
||||
uidynamicSpritePath = "Assets/Resources/DynamicSprites";
|
||||
uiTemplatePath = Path.Combine("Assets", "Temp",
|
||||
"OnlyUITemplate",
|
||||
"CustomPanel.prefab");
|
||||
// scenePath = "Assets/Test1";
|
||||
// scriptPath = "Assets/Test2";
|
||||
// prefabPath = "Assets/Test3";
|
||||
|
||||
// var visualTree =
|
||||
// AssetDatabase.LoadAssetAtPath<VisualTreeAsset>(
|
||||
// "Assets/ThirdPart/UIToolKitFile/UDoc/UXml/AutoGenerateUI.uxml");
|
||||
// rootElement = visualTree.CloneTree();
|
||||
root = rootVisualElement;
|
||||
titleText = new Label("自动生成ui预制体,脚本,静态sprite文件夹,动态sprite文件夹(可选),测试场景(可选),");
|
||||
hintText = new Label("");
|
||||
|
||||
testScene = new Toggle("创建测试场景?");
|
||||
dynamicSprite = new Toggle("创建动态sprite文件夹?");
|
||||
|
||||
generateBtn = new Button(OnGenerateButtonClick);
|
||||
generateBtn.text = "自动生成按钮";
|
||||
nameInput = new TextField("预制体名(也是脚本名)");
|
||||
|
||||
|
||||
root.Add(titleText);
|
||||
root.Add(hintText);
|
||||
root.Add(testScene);
|
||||
root.Add(dynamicSprite);
|
||||
root.Add(nameInput);
|
||||
root.Add(generateBtn);
|
||||
|
||||
// nameInput = rootElement.Q<TextField>("NameInput");
|
||||
}
|
||||
|
||||
private void OnGenerateButtonClick()
|
||||
{
|
||||
CheckDirectoryAndCreat(); //检查五个路径文件夹是否都在,没有则创建
|
||||
string tempName = nameInput.text;
|
||||
|
||||
|
||||
var sceneExist = DoesFileExist(testScenePath, tempName);
|
||||
var preExist = DoesFileExist(uiPrefabPath, tempName);
|
||||
var scriptExist = DoesFileExist(scriptPath, tempName);
|
||||
if (sceneExist || preExist || scriptExist)
|
||||
{
|
||||
ShowHint("三者中至少有一个同名文件已经存在,未添加任何文件");
|
||||
return;
|
||||
}
|
||||
|
||||
CreatPrefab(tempName);
|
||||
CreatCSFile(tempName);
|
||||
|
||||
DirectoryDontExistAndCreat(uiStaticSpritePath + "/" + tempName);
|
||||
if (dynamicSprite.value)
|
||||
{
|
||||
DirectoryDontExistAndCreat(uidynamicSpritePath + "/" + tempName);
|
||||
}
|
||||
|
||||
if (testScene.value)
|
||||
{
|
||||
CreateNewScene(testScenePath, tempName);
|
||||
}
|
||||
|
||||
// TODO 绑定脚本的功能没实现AttachScriptToGameObject(tempName, generatePre);
|
||||
AssetDatabase.Refresh();
|
||||
|
||||
|
||||
// EditorApplication.delayCall = () =>
|
||||
// {
|
||||
// AssetDatabase.Refresh();
|
||||
// AttachScriptToGameObject(tempName, generatePre);
|
||||
// PrefabUtility.SavePrefabAsset(generatePre);
|
||||
// AssetDatabase.Refresh();
|
||||
// // EditorUtility.DisplayDialog("成功", "UI预制体,测试场景,UI脚本已经被创建 ", "OK");
|
||||
// };
|
||||
//AssetDatabase.Refresh();
|
||||
//EditorUtility.DisplayDialog("成功创建", $" " + scenePath, "OK");
|
||||
}
|
||||
|
||||
//TODO
|
||||
private bool CheckLawfulString(string checkedString)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(checkedString))
|
||||
{
|
||||
ShowHint("输入文件名异常,未添加任何文件");
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach (var strItem in checkedString)
|
||||
{
|
||||
if (strItem == '1')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void CheckDirectoryAndCreat()
|
||||
{
|
||||
DirectoryDontExistAndCreat(uiPrefabPath);
|
||||
DirectoryDontExistAndCreat(testScenePath);
|
||||
DirectoryDontExistAndCreat(scriptPath);
|
||||
DirectoryDontExistAndCreat(uidynamicSpritePath);
|
||||
DirectoryDontExistAndCreat(uiStaticSpritePath);
|
||||
}
|
||||
|
||||
private void DirectoryDontExistAndCreat(string directoryPath)
|
||||
{
|
||||
if (!Directory.Exists(directoryPath))
|
||||
{
|
||||
Directory.CreateDirectory(directoryPath);
|
||||
}
|
||||
}
|
||||
|
||||
private void CreatCSFile(string csFileName)
|
||||
{
|
||||
string scriptContent = GetScriptTemplate(csFileName);
|
||||
File.WriteAllText(Path.Combine(scriptPath, csFileName + ".cs"), scriptContent);
|
||||
}
|
||||
|
||||
private void CreatPrefab(string preName)
|
||||
{
|
||||
//Selection.activeGameObject;
|
||||
GameObject selectedObjectRes = AssetDatabase.LoadAssetAtPath<GameObject>(uiTemplatePath);
|
||||
|
||||
if (selectedObjectRes == null)
|
||||
{
|
||||
ShowHint("面板模版预制体不存在,未添加任何文件");
|
||||
return;
|
||||
}
|
||||
|
||||
GameObject selectedObject = (GameObject)PrefabUtility.InstantiatePrefab(selectedObjectRes);
|
||||
PrefabUtility.UnpackPrefabInstance(selectedObject, PrefabUnpackMode.Completely,
|
||||
InteractionMode.AutomatedAction); //完全解包&不提示
|
||||
//解包属性会出问题?
|
||||
selectedObject.transform.localPosition = Vector3.zero;
|
||||
selectedObject.transform.localScale = Vector3.one;
|
||||
selectedObject.name = preName;
|
||||
var generatePre =
|
||||
PrefabUtility.SaveAsPrefabAsset(selectedObject, Path.Combine(uiPrefabPath, preName + ".prefab"));
|
||||
}
|
||||
|
||||
private string GetScriptTemplate(string scriptName)
|
||||
{
|
||||
return $@"
|
||||
using UnityEngine;
|
||||
using QFramework.Core;
|
||||
namespace Project.UIPanel
|
||||
{{
|
||||
|
||||
public class {scriptName} : UIPanelBase
|
||||
{{
|
||||
public void Init()
|
||||
{{
|
||||
}}
|
||||
void Start()
|
||||
{{
|
||||
|
||||
}}
|
||||
|
||||
}}
|
||||
}}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 提示文本
|
||||
/// </summary>
|
||||
/// <param name="mes"></param>
|
||||
private void ShowHint(string mes)
|
||||
{
|
||||
hintText.text = mes;
|
||||
hintText.style.opacity = 1f; // 确保提示文本完全可见
|
||||
DOVirtual.DelayedCall(2, () => { hintText.text = string.Empty; });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检查文件是否存在
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="fileName"></param>
|
||||
/// <returns></returns>
|
||||
private bool DoesFileExist(string path, string fileName)
|
||||
{
|
||||
string fullPath = path;
|
||||
string[] files = Directory.GetFiles(fullPath, "*.*", SearchOption.TopDirectoryOnly); //不递归
|
||||
foreach (var file in files)
|
||||
{
|
||||
//无拓展名
|
||||
if (Path.GetFileNameWithoutExtension(file) == fileName)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建场景
|
||||
/// </summary>
|
||||
/// <param name="scenePath"></param>
|
||||
/// <param name="sceneName"></param>
|
||||
private void CreateNewScene(string scenePath, string sceneName)
|
||||
{
|
||||
//TODO 将预制体添加到场景未实现
|
||||
var newScene = EditorSceneManager.NewScene(NewSceneSetup.DefaultGameObjects, NewSceneMode.Single);
|
||||
// GameObject lightGameObject = new GameObject("Directional Light");
|
||||
// Light lightComp = lightGameObject.AddComponent<Light>();
|
||||
// lightComp.type = LightType.Directional;
|
||||
// lightComp.transform.rotation = Quaternion.Euler(50, -30, 0);
|
||||
//
|
||||
// GameObject ground = GameObject.CreatePrimitive(PrimitiveType.Plane);
|
||||
// ground.transform.position = Vector3.zero;
|
||||
|
||||
// 加载预制体资源///
|
||||
GameObject prefab =
|
||||
AssetDatabase.LoadAssetAtPath<GameObject>(Path.Combine("Assets", "Resources", "UI", "Base",
|
||||
"Canvas.prefab"));
|
||||
//GameObject pre = AssetDatabase.LoadAssetAtPath<GameObject>(prefabPath + "/sceneName.prefab");
|
||||
if (prefab != null)
|
||||
{
|
||||
// 实例化预制体并添加到场景中
|
||||
GameObject prefabInstance = (GameObject)PrefabUtility.InstantiatePrefab(prefab);
|
||||
// GameObject preInstance = (GameObject)PrefabUtility.InstantiatePrefab(pre);
|
||||
SceneManager.MoveGameObjectToScene(prefabInstance, newScene);
|
||||
// SceneManager.MoveGameObjectToScene(preInstance, newScene);
|
||||
|
||||
// preInstance.transform.parent = prefabInstance.transform.Find("Mid");
|
||||
// ((RectTransform)preInstance.transform).localPosition = Vector3.zero;
|
||||
// ((RectTransform)preInstance.transform).transform.localScale = Vector3.one;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("预制体未找到,请检查路径是否正确!");
|
||||
}
|
||||
|
||||
EditorSceneManager.SaveScene(newScene, scenePath + "/" + sceneName + ".unity", true);
|
||||
}
|
||||
|
||||
//暂时拿不到
|
||||
private void AttachScriptToGameObject(string className, GameObject pre)
|
||||
{
|
||||
// 获取当前的Assembly
|
||||
var assembly = Assembly.Load("Assembly-CSharp");
|
||||
|
||||
// 使用反射获取新脚本的类型
|
||||
Type scriptType = assembly.GetTypes().FirstOrDefault(t => t.Name == className);
|
||||
|
||||
if (scriptType != null)
|
||||
{
|
||||
// 查找目标游戏对象(假设场景中有一个名为 "TargetObject" 的对象)
|
||||
|
||||
if (pre != null)
|
||||
{
|
||||
// 添加脚本到对象上
|
||||
pre.AddComponent(scriptType);
|
||||
ShowHint($"{className} script attached to {pre.name}");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("Target object not found in the scene.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError($"Script type {className} not found.");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 68635ba9847a7f84f962a340b18dded1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 0c34b64d65aa6f74dae3ac3a2e6b9b82
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Reference in New Issue