@nice2dev/game-engine 1.3.14 → 1.3.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (434) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/accessibility/Accessibility.js +152 -165
  3. package/dist/cjs/ai/AI.js +292 -294
  4. package/dist/cjs/ai/BehaviorTree.js +1029 -1113
  5. package/dist/cjs/ai/StateMachine.js +694 -756
  6. package/dist/cjs/animation/Animation.js +232 -241
  7. package/dist/cjs/audio/AudioAdvanced.js +221 -236
  8. package/dist/cjs/audio/AudioBridge.js +441 -435
  9. package/dist/cjs/audio/AudioManager.js +242 -259
  10. package/dist/cjs/build-cloud/BuildOrchestration.js +1059 -1098
  11. package/dist/cjs/build-cloud/GodotBuildCloud.js +641 -670
  12. package/dist/cjs/build-cloud/UnityBuildCloud.js +563 -610
  13. package/dist/cjs/build-cloud/UnrealBuildCloud.js +610 -635
  14. package/dist/cjs/core/EventBus.js +51 -56
  15. package/dist/cjs/core/GameClock.js +62 -66
  16. package/dist/cjs/core/GameConfig.js +72 -79
  17. package/dist/cjs/core/GameLoop.js +80 -89
  18. package/dist/cjs/core/ServiceLocator.js +61 -65
  19. package/dist/cjs/core/Validation.js +72 -82
  20. package/dist/cjs/core/math.js +108 -112
  21. package/dist/cjs/devtools/DevTools.js +542 -563
  22. package/dist/cjs/devtools/DeveloperExperience.js +521 -559
  23. package/dist/cjs/devtools/GameplayAnalytics.js +636 -646
  24. package/dist/cjs/dialogue/DialogueSystem.js +984 -986
  25. package/dist/cjs/docs/DocGenerator.js +339 -364
  26. package/dist/cjs/ecs/World.js +355 -371
  27. package/dist/cjs/editor/AchievementEditor.js +580 -636
  28. package/dist/cjs/editor/AdvancedEditor.js +184 -191
  29. package/dist/cjs/editor/AnimationRetargeting.js +696 -741
  30. package/dist/cjs/editor/AssetBrowser.js +1072 -1160
  31. package/dist/cjs/editor/AssetManager.js +187 -192
  32. package/dist/cjs/editor/ConsolePro.js +971 -1061
  33. package/dist/cjs/editor/CraftingEditor.js +680 -730
  34. package/dist/cjs/editor/DebugTools.js +187 -185
  35. package/dist/cjs/editor/DialogueSystem.js +844 -901
  36. package/dist/cjs/editor/LeaderboardSystem.js +429 -483
  37. package/dist/cjs/editor/NiceGameEditor.js +1903 -1201
  38. package/dist/cjs/editor/PrefabSystem.js +772 -838
  39. package/dist/cjs/editor/ProfilerPanel.js +649 -700
  40. package/dist/cjs/editor/QuestEditor.js +792 -839
  41. package/dist/cjs/editor/ReplaySystem.js +585 -634
  42. package/dist/cjs/editor/SceneEditor.js +176 -200
  43. package/dist/cjs/editor/ScreenshotMode.js +621 -688
  44. package/dist/cjs/editor/ShaderGraph.js +1556 -1582
  45. package/dist/cjs/editor/TimelineEditor.js +715 -778
  46. package/dist/cjs/editor/UndoRedoPro.js +830 -904
  47. package/dist/cjs/editor/VRARMode.js +582 -645
  48. package/dist/cjs/engine/NiceGameEngine.js +141 -164
  49. package/dist/cjs/engine/SaveSystem.js +441 -495
  50. package/dist/cjs/enterprise/Enterprise.js +254 -261
  51. package/dist/cjs/export/BevyExporter.js +927 -967
  52. package/dist/cjs/export/CocosExporter.js +644 -673
  53. package/dist/cjs/export/Construct3Exporter.js +783 -794
  54. package/dist/cjs/export/DefoldExporter.js +1028 -1069
  55. package/dist/cjs/export/GDevelopExporter.js +674 -708
  56. package/dist/cjs/export/GameMakerExporter.js +791 -805
  57. package/dist/cjs/export/GodotExporter.js +1003 -1045
  58. package/dist/cjs/export/MinecraftBedrockExporter.js +573 -578
  59. package/dist/cjs/export/MonoGameExporter.js +1265 -1293
  60. package/dist/cjs/export/Pico8Exporter.js +766 -812
  61. package/dist/cjs/export/PlatformExporter.js +188 -206
  62. package/dist/cjs/export/RPGMakerExporter.js +860 -879
  63. package/dist/cjs/export/RobloxExporter.js +883 -919
  64. package/dist/cjs/export/Solar2DExporter.js +1218 -1256
  65. package/dist/cjs/export/ThreeJSExporter.js +1006 -1073
  66. package/dist/cjs/export/Tic80Exporter.js +1210 -1267
  67. package/dist/cjs/export/UnityExporter.js +1116 -1131
  68. package/dist/cjs/export/UnrealExporter.js +889 -919
  69. package/dist/cjs/export/WebExporter.js +931 -970
  70. package/dist/cjs/export/index.js +42 -65
  71. package/dist/cjs/godot-integration/GodotAssetLibrary.js +659 -692
  72. package/dist/cjs/godot-integration/GodotImport.js +929 -1027
  73. package/dist/cjs/godot-integration/GodotLiveLink.js +915 -945
  74. package/dist/cjs/godot-integration/components/GodotProjectBrowser.js +911 -611
  75. package/dist/cjs/i18n/I18n.js +860 -900
  76. package/dist/cjs/i18n/useTranslation.js +84 -89
  77. package/dist/cjs/import/AsepriteImporter.js +658 -716
  78. package/dist/cjs/import/DragonBonesImporter.js +437 -461
  79. package/dist/cjs/import/GameMakerImporter.js +511 -521
  80. package/dist/cjs/import/GodotSceneImporter.js +788 -822
  81. package/dist/cjs/import/LDtkImporter.js +436 -454
  82. package/dist/cjs/import/Live2DImporter.js +497 -518
  83. package/dist/cjs/import/NdgFormat.js +424 -457
  84. package/dist/cjs/import/OgmoImporter.js +466 -493
  85. package/dist/cjs/import/RPGMakerImporter.js +451 -477
  86. package/dist/cjs/import/SceneImporter.js +378 -423
  87. package/dist/cjs/import/SpineImporter.js +511 -546
  88. package/dist/cjs/import/SpriterImporter.js +590 -613
  89. package/dist/cjs/import/TiledMapImporter.js +811 -846
  90. package/dist/cjs/import/UnitySceneImporter.js +687 -703
  91. package/dist/cjs/import/index.js +206 -251
  92. package/dist/cjs/index.js +275 -278
  93. package/dist/cjs/input/GamepadNavigation.js +185 -205
  94. package/dist/cjs/input/InputManager.js +397 -421
  95. package/dist/cjs/input/useGamepads.js +70 -81
  96. package/dist/cjs/integration/IconSprite.js +129 -256
  97. package/dist/cjs/inventory/InventorySystem.js +920 -995
  98. package/dist/cjs/kids/KidMode.js +997 -1022
  99. package/dist/cjs/kids/KidTools.js +570 -594
  100. package/dist/cjs/monetization/Monetization.js +170 -177
  101. package/dist/cjs/multiplayer/LocalMultiplayer.js +287 -287
  102. package/dist/cjs/multiplayer/MiniGameTypes.js +49 -59
  103. package/dist/cjs/native-engine/AnimationSystem.js +731 -806
  104. package/dist/cjs/native-engine/AssetPipeline.js +454 -515
  105. package/dist/cjs/native-engine/AudioEngine.js +763 -804
  106. package/dist/cjs/native-engine/InputSystem.js +1075 -1145
  107. package/dist/cjs/native-engine/NetworkingSystem.js +733 -793
  108. package/dist/cjs/native-engine/PhysicsEngine.js +583 -607
  109. package/dist/cjs/native-engine/RenderingEngine.js +302 -350
  110. package/dist/cjs/native-engine/SceneGraph.js +769 -808
  111. package/dist/cjs/network/MultiplayerTransport.js +97 -132
  112. package/dist/cjs/network/Networking.js +549 -564
  113. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/AbortController.js +21 -29
  114. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/AccessTokenHttpClient.js +40 -48
  115. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/DefaultHttpClient.js +35 -43
  116. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/DefaultReconnectPolicy.js +10 -15
  117. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/Errors.js +103 -135
  118. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/FetchHttpClient.js +131 -158
  119. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HandshakeProtocol.js +39 -53
  120. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HeaderNames.js +5 -8
  121. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HttpClient.js +40 -48
  122. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HttpConnection.js +494 -572
  123. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HubConnection.js +826 -953
  124. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HubConnectionBuilder.js +125 -146
  125. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/IHubProtocol.js +13 -23
  126. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/ILogger.js +11 -25
  127. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/ITransport.js +13 -24
  128. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/JsonHubProtocol.js +108 -121
  129. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/Loggers.js +10 -14
  130. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/LongPollingTransport.js +150 -185
  131. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/MessageBuffer.js +158 -196
  132. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/ServerSentEventsTransport.js +90 -105
  133. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/Subject.js +30 -35
  134. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/TextMessageFormat.js +16 -21
  135. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/Utils.js +215 -248
  136. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/WebSocketTransport.js +135 -157
  137. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/XhrHttpClient.js +76 -85
  138. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/index.js +24 -27
  139. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/pkg-version.js +3 -4
  140. package/dist/cjs/pathfinding/Pathfinding.js +245 -263
  141. package/dist/cjs/performance/AssetStreaming.js +561 -635
  142. package/dist/cjs/performance/BenchmarkSuite.js +283 -311
  143. package/dist/cjs/performance/DeltaCompression.js +467 -526
  144. package/dist/cjs/performance/DeterministicPhysics.js +450 -498
  145. package/dist/cjs/performance/ECSOptimization.js +644 -695
  146. package/dist/cjs/performance/GameSaveSystem.js +509 -556
  147. package/dist/cjs/performance/HotReload.js +447 -500
  148. package/dist/cjs/performance/InputRecording.js +511 -561
  149. package/dist/cjs/performance/InterestManagement.js +453 -500
  150. package/dist/cjs/performance/LocalizationRuntime.js +376 -423
  151. package/dist/cjs/performance/MemoryManagement.js +410 -470
  152. package/dist/cjs/performance/ModSupport.js +445 -496
  153. package/dist/cjs/performance/MultiThreadedPhysics.js +400 -443
  154. package/dist/cjs/performance/NetworkPrediction.js +424 -482
  155. package/dist/cjs/performance/ObjectPooling.js +569 -617
  156. package/dist/cjs/performance/Performance.js +174 -190
  157. package/dist/cjs/performance/PerformanceAdvanced.js +614 -637
  158. package/dist/cjs/performance/WebGPURenderer.js +656 -683
  159. package/dist/cjs/physics/PhysicsAdvanced.js +345 -379
  160. package/dist/cjs/physics/PhysicsEngine2D.js +391 -427
  161. package/dist/cjs/plugins/PluginSDK.js +432 -466
  162. package/dist/cjs/plugins/PluginTestKit.js +307 -330
  163. package/dist/cjs/procedural/Procedural.js +243 -254
  164. package/dist/cjs/procedural/WorldBuilding.js +297 -314
  165. package/dist/cjs/quest/QuestSystem.js +975 -932
  166. package/dist/cjs/release/MobileExport.js +157 -163
  167. package/dist/cjs/release/Release.js +225 -238
  168. package/dist/cjs/rendering/Camera2D.js +121 -124
  169. package/dist/cjs/rendering/Renderer2D.js +321 -335
  170. package/dist/cjs/rendering/WebGPURenderPipeline.js +632 -651
  171. package/dist/cjs/runtime3d/Runtime3D.js +359 -378
  172. package/dist/cjs/runtime3d/SceneEditor3D.js +252 -263
  173. package/dist/cjs/scene/SceneManager.js +177 -193
  174. package/dist/cjs/scripting/GraphToAST.js +574 -547
  175. package/dist/cjs/scripting/LanguageExporter.js +254 -279
  176. package/dist/cjs/scripting/NodeGraph.js +546 -570
  177. package/dist/cjs/scripting/ScriptAST.js +31 -39
  178. package/dist/cjs/scripting/VisualScripting2.js +1016 -1065
  179. package/dist/cjs/scripting/exporters/CSharpExporter.js +464 -496
  180. package/dist/cjs/scripting/exporters/GDScriptExporter.js +390 -442
  181. package/dist/cjs/scripting/exporters/LuaExporter.js +406 -447
  182. package/dist/cjs/scripting/exporters/PythonExporter.js +484 -549
  183. package/dist/cjs/scripting/exporters/RustExporter.js +459 -512
  184. package/dist/cjs/scripting/exporters/TypeScriptExporter.js +505 -556
  185. package/dist/cjs/social/Social.js +72 -80
  186. package/dist/cjs/systems/LightingSystem.js +844 -931
  187. package/dist/cjs/systems/ParticleSystem2.js +1447 -1451
  188. package/dist/cjs/systems/PhysicsDebugSystem.js +1070 -1141
  189. package/dist/cjs/systems/TerrainSystem.js +985 -1098
  190. package/dist/cjs/templates/ActionTemplates.js +296 -309
  191. package/dist/cjs/templates/FightingTemplate.js +417 -463
  192. package/dist/cjs/templates/MetroidvaniaTemplate.js +353 -405
  193. package/dist/cjs/templates/PartyTemplates.js +190 -202
  194. package/dist/cjs/templates/PuzzleTemplates.js +245 -261
  195. package/dist/cjs/templates/RPGTemplates.js +160 -178
  196. package/dist/cjs/templates/SportsTemplates.js +237 -250
  197. package/dist/cjs/templates/StrategyTemplates.js +143 -153
  198. package/dist/cjs/templates/SurvivalTemplate.js +336 -380
  199. package/dist/cjs/templates/WaveDefense.js +499 -526
  200. package/dist/cjs/tilemap/Tilemap.js +207 -214
  201. package/dist/cjs/tutorials/TutorialBranching.js +396 -417
  202. package/dist/cjs/tutorials/TutorialEngine.js +888 -931
  203. package/dist/cjs/tutorials/TutorialOverlay.js +602 -640
  204. package/dist/cjs/tutorials/content/Tutorials_T05_T08.js +787 -809
  205. package/dist/cjs/tutorials/content/Tutorials_T09_T11.js +736 -756
  206. package/dist/cjs/tutorials/content/Tutorials_T12_T15.js +754 -778
  207. package/dist/cjs/ui/GameUI.js +295 -312
  208. package/dist/cjs/unity-integration/UnityAssetStore.js +700 -741
  209. package/dist/cjs/unity-integration/UnityImport.js +1066 -1176
  210. package/dist/cjs/unity-integration/UnityLiveLink.js +934 -981
  211. package/dist/cjs/unity-integration/components/UnityAssetStoreBrowser.js +1233 -757
  212. package/dist/cjs/unity-integration/components/UnityProjectBrowser.js +1240 -768
  213. package/dist/cjs/unreal-integration/UnrealImport.js +391 -412
  214. package/dist/cjs/unreal-integration/UnrealLiveLink.js +1102 -1137
  215. package/dist/cjs/unreal-integration/UnrealMarketplace.js +436 -473
  216. package/dist/cjs/unreal-integration/components/UnrealProjectBrowser.js +1150 -767
  217. package/dist/cjs/xr/ARVR.js +167 -175
  218. package/dist/esm/accessibility/Accessibility.js +160 -164
  219. package/dist/esm/ai/AI.js +310 -293
  220. package/dist/esm/ai/BehaviorTree.js +1057 -1112
  221. package/dist/esm/ai/StateMachine.js +709 -755
  222. package/dist/esm/animation/Animation.js +237 -240
  223. package/dist/esm/audio/AudioAdvanced.js +239 -235
  224. package/dist/esm/audio/AudioBridge.js +448 -434
  225. package/dist/esm/audio/AudioManager.js +243 -258
  226. package/dist/esm/build-cloud/BuildOrchestration.js +1071 -1097
  227. package/dist/esm/build-cloud/GodotBuildCloud.js +647 -669
  228. package/dist/esm/build-cloud/UnityBuildCloud.js +571 -609
  229. package/dist/esm/build-cloud/UnrealBuildCloud.js +615 -634
  230. package/dist/esm/core/EventBus.js +52 -55
  231. package/dist/esm/core/GameClock.js +63 -65
  232. package/dist/esm/core/GameConfig.js +77 -78
  233. package/dist/esm/core/GameLoop.js +81 -88
  234. package/dist/esm/core/ServiceLocator.js +63 -64
  235. package/dist/esm/core/Validation.js +82 -81
  236. package/dist/esm/core/math.js +109 -111
  237. package/dist/esm/devtools/DevTools.js +546 -562
  238. package/dist/esm/devtools/DeveloperExperience.js +535 -558
  239. package/dist/esm/devtools/GameplayAnalytics.js +647 -645
  240. package/dist/esm/dialogue/DialogueSystem.js +998 -985
  241. package/dist/esm/docs/DocGenerator.js +342 -363
  242. package/dist/esm/ecs/World.js +358 -370
  243. package/dist/esm/editor/AchievementEditor.js +584 -635
  244. package/dist/esm/editor/AdvancedEditor.js +191 -190
  245. package/dist/esm/editor/AnimationRetargeting.js +700 -740
  246. package/dist/esm/editor/AssetBrowser.js +1078 -1159
  247. package/dist/esm/editor/AssetManager.js +188 -191
  248. package/dist/esm/editor/ConsolePro.js +977 -1060
  249. package/dist/esm/editor/CraftingEditor.js +684 -729
  250. package/dist/esm/editor/DebugTools.js +194 -184
  251. package/dist/esm/editor/DialogueSystem.js +849 -900
  252. package/dist/esm/editor/LeaderboardSystem.js +433 -482
  253. package/dist/esm/editor/NiceGameEditor.js +1908 -1200
  254. package/dist/esm/editor/PrefabSystem.js +777 -837
  255. package/dist/esm/editor/ProfilerPanel.js +654 -699
  256. package/dist/esm/editor/QuestEditor.js +795 -838
  257. package/dist/esm/editor/ReplaySystem.js +591 -633
  258. package/dist/esm/editor/SceneEditor.js +189 -199
  259. package/dist/esm/editor/ScreenshotMode.js +628 -687
  260. package/dist/esm/editor/ShaderGraph.js +1565 -1581
  261. package/dist/esm/editor/TimelineEditor.js +733 -777
  262. package/dist/esm/editor/UndoRedoPro.js +835 -903
  263. package/dist/esm/editor/VRARMode.js +586 -644
  264. package/dist/esm/engine/NiceGameEngine.js +142 -163
  265. package/dist/esm/engine/SaveSystem.js +447 -494
  266. package/dist/esm/enterprise/Enterprise.js +265 -260
  267. package/dist/esm/export/BevyExporter.js +929 -966
  268. package/dist/esm/export/CocosExporter.js +646 -672
  269. package/dist/esm/export/Construct3Exporter.js +785 -793
  270. package/dist/esm/export/DefoldExporter.js +1030 -1068
  271. package/dist/esm/export/GDevelopExporter.js +676 -707
  272. package/dist/esm/export/GameMakerExporter.js +793 -804
  273. package/dist/esm/export/GodotExporter.js +1004 -1044
  274. package/dist/esm/export/MinecraftBedrockExporter.js +575 -577
  275. package/dist/esm/export/MonoGameExporter.js +1267 -1292
  276. package/dist/esm/export/Pico8Exporter.js +768 -811
  277. package/dist/esm/export/PlatformExporter.js +193 -205
  278. package/dist/esm/export/RPGMakerExporter.js +862 -878
  279. package/dist/esm/export/RobloxExporter.js +885 -918
  280. package/dist/esm/export/Solar2DExporter.js +1220 -1255
  281. package/dist/esm/export/ThreeJSExporter.js +1007 -1072
  282. package/dist/esm/export/Tic80Exporter.js +1212 -1266
  283. package/dist/esm/export/UnityExporter.js +1117 -1130
  284. package/dist/esm/export/UnrealExporter.js +891 -918
  285. package/dist/esm/export/WebExporter.js +933 -969
  286. package/dist/esm/export/index.js +86 -71
  287. package/dist/esm/godot-integration/GodotAssetLibrary.js +663 -691
  288. package/dist/esm/godot-integration/GodotImport.js +935 -1026
  289. package/dist/esm/godot-integration/GodotLiveLink.js +918 -944
  290. package/dist/esm/godot-integration/components/GodotProjectBrowser.js +912 -610
  291. package/dist/esm/i18n/I18n.js +871 -899
  292. package/dist/esm/i18n/useTranslation.js +88 -88
  293. package/dist/esm/import/AsepriteImporter.js +637 -715
  294. package/dist/esm/import/DragonBonesImporter.js +417 -460
  295. package/dist/esm/import/GameMakerImporter.js +491 -520
  296. package/dist/esm/import/GodotSceneImporter.js +767 -821
  297. package/dist/esm/import/LDtkImporter.js +415 -453
  298. package/dist/esm/import/Live2DImporter.js +477 -517
  299. package/dist/esm/import/NdgFormat.js +410 -456
  300. package/dist/esm/import/OgmoImporter.js +446 -492
  301. package/dist/esm/import/RPGMakerImporter.js +431 -476
  302. package/dist/esm/import/SceneImporter.js +385 -422
  303. package/dist/esm/import/SpineImporter.js +491 -545
  304. package/dist/esm/import/SpriterImporter.js +570 -612
  305. package/dist/esm/import/TiledMapImporter.js +790 -845
  306. package/dist/esm/import/UnitySceneImporter.js +666 -702
  307. package/dist/esm/import/index.js +247 -258
  308. package/dist/esm/index.js +1332 -188
  309. package/dist/esm/input/GamepadNavigation.js +187 -204
  310. package/dist/esm/input/InputManager.js +401 -420
  311. package/dist/esm/input/useGamepads.js +72 -80
  312. package/dist/esm/integration/IconSprite.js +143 -255
  313. package/dist/esm/inventory/InventorySystem.js +925 -994
  314. package/dist/esm/kids/KidMode.js +1003 -1021
  315. package/dist/esm/kids/KidTools.js +573 -593
  316. package/dist/esm/monetization/Monetization.js +180 -176
  317. package/dist/esm/multiplayer/LocalMultiplayer.js +290 -286
  318. package/dist/esm/multiplayer/MiniGameTypes.js +58 -58
  319. package/dist/esm/native-engine/AnimationSystem.js +735 -805
  320. package/dist/esm/native-engine/AssetPipeline.js +456 -514
  321. package/dist/esm/native-engine/AudioEngine.js +765 -803
  322. package/dist/esm/native-engine/InputSystem.js +1079 -1144
  323. package/dist/esm/native-engine/NetworkingSystem.js +740 -792
  324. package/dist/esm/native-engine/PhysicsEngine.js +585 -606
  325. package/dist/esm/native-engine/RenderingEngine.js +304 -349
  326. package/dist/esm/native-engine/SceneGraph.js +773 -807
  327. package/dist/esm/network/MultiplayerTransport.js +99 -131
  328. package/dist/esm/network/Networking.js +556 -563
  329. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/AbortController.js +22 -28
  330. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/AccessTokenHttpClient.js +41 -47
  331. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/DefaultHttpClient.js +36 -42
  332. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/DefaultReconnectPolicy.js +11 -14
  333. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/Errors.js +111 -134
  334. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/FetchHttpClient.js +132 -157
  335. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HandshakeProtocol.js +40 -52
  336. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HeaderNames.js +6 -7
  337. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HttpClient.js +42 -47
  338. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HttpConnection.js +496 -571
  339. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HubConnection.js +828 -952
  340. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HubConnectionBuilder.js +126 -145
  341. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/IHubProtocol.js +14 -23
  342. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/ILogger.js +12 -25
  343. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/ITransport.js +15 -24
  344. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/JsonHubProtocol.js +109 -120
  345. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/Loggers.js +11 -13
  346. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/LongPollingTransport.js +151 -184
  347. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/MessageBuffer.js +159 -195
  348. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/ServerSentEventsTransport.js +91 -104
  349. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/Subject.js +31 -34
  350. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/TextMessageFormat.js +17 -20
  351. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/Utils.js +230 -248
  352. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/WebSocketTransport.js +136 -156
  353. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/XhrHttpClient.js +77 -84
  354. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/index.js +31 -12
  355. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/pkg-version.js +4 -3
  356. package/dist/esm/pathfinding/Pathfinding.js +249 -262
  357. package/dist/esm/performance/AssetStreaming.js +567 -634
  358. package/dist/esm/performance/BenchmarkSuite.js +285 -310
  359. package/dist/esm/performance/DeltaCompression.js +478 -525
  360. package/dist/esm/performance/DeterministicPhysics.js +479 -497
  361. package/dist/esm/performance/ECSOptimization.js +653 -694
  362. package/dist/esm/performance/GameSaveSystem.js +515 -555
  363. package/dist/esm/performance/HotReload.js +454 -499
  364. package/dist/esm/performance/InputRecording.js +520 -560
  365. package/dist/esm/performance/InterestManagement.js +460 -499
  366. package/dist/esm/performance/LocalizationRuntime.js +382 -422
  367. package/dist/esm/performance/MemoryManagement.js +415 -469
  368. package/dist/esm/performance/ModSupport.js +455 -495
  369. package/dist/esm/performance/MultiThreadedPhysics.js +408 -442
  370. package/dist/esm/performance/NetworkPrediction.js +436 -481
  371. package/dist/esm/performance/ObjectPooling.js +582 -616
  372. package/dist/esm/performance/Performance.js +182 -189
  373. package/dist/esm/performance/PerformanceAdvanced.js +621 -636
  374. package/dist/esm/performance/WebGPURenderer.js +660 -682
  375. package/dist/esm/physics/PhysicsAdvanced.js +359 -378
  376. package/dist/esm/physics/PhysicsEngine2D.js +393 -426
  377. package/dist/esm/plugins/PluginSDK.js +435 -465
  378. package/dist/esm/plugins/PluginTestKit.js +315 -329
  379. package/dist/esm/procedural/Procedural.js +248 -253
  380. package/dist/esm/procedural/WorldBuilding.js +316 -313
  381. package/dist/esm/quest/QuestSystem.js +982 -931
  382. package/dist/esm/release/MobileExport.js +163 -162
  383. package/dist/esm/release/Release.js +234 -237
  384. package/dist/esm/rendering/Camera2D.js +122 -123
  385. package/dist/esm/rendering/Renderer2D.js +323 -334
  386. package/dist/esm/rendering/WebGPURenderPipeline.js +647 -650
  387. package/dist/esm/runtime3d/Runtime3D.js +368 -377
  388. package/dist/esm/runtime3d/SceneEditor3D.js +268 -262
  389. package/dist/esm/scene/SceneManager.js +178 -192
  390. package/dist/esm/scripting/GraphToAST.js +576 -546
  391. package/dist/esm/scripting/LanguageExporter.js +263 -278
  392. package/dist/esm/scripting/NodeGraph.js +550 -569
  393. package/dist/esm/scripting/ScriptAST.js +45 -38
  394. package/dist/esm/scripting/VisualScripting2.js +1025 -1064
  395. package/dist/esm/scripting/exporters/CSharpExporter.js +465 -495
  396. package/dist/esm/scripting/exporters/GDScriptExporter.js +391 -441
  397. package/dist/esm/scripting/exporters/LuaExporter.js +407 -446
  398. package/dist/esm/scripting/exporters/PythonExporter.js +485 -548
  399. package/dist/esm/scripting/exporters/RustExporter.js +460 -511
  400. package/dist/esm/scripting/exporters/TypeScriptExporter.js +506 -555
  401. package/dist/esm/social/Social.js +77 -79
  402. package/dist/esm/systems/LightingSystem.js +855 -930
  403. package/dist/esm/systems/ParticleSystem2.js +1453 -1450
  404. package/dist/esm/systems/PhysicsDebugSystem.js +1078 -1140
  405. package/dist/esm/systems/TerrainSystem.js +996 -1097
  406. package/dist/esm/templates/ActionTemplates.js +307 -308
  407. package/dist/esm/templates/FightingTemplate.js +439 -462
  408. package/dist/esm/templates/MetroidvaniaTemplate.js +391 -404
  409. package/dist/esm/templates/PartyTemplates.js +206 -201
  410. package/dist/esm/templates/PuzzleTemplates.js +260 -260
  411. package/dist/esm/templates/RPGTemplates.js +172 -177
  412. package/dist/esm/templates/SportsTemplates.js +251 -249
  413. package/dist/esm/templates/StrategyTemplates.js +158 -152
  414. package/dist/esm/templates/SurvivalTemplate.js +367 -379
  415. package/dist/esm/templates/WaveDefense.js +501 -525
  416. package/dist/esm/tilemap/Tilemap.js +209 -213
  417. package/dist/esm/tutorials/TutorialBranching.js +399 -416
  418. package/dist/esm/tutorials/TutorialEngine.js +893 -930
  419. package/dist/esm/tutorials/TutorialOverlay.js +603 -639
  420. package/dist/esm/tutorials/content/Tutorials_T05_T08.js +792 -808
  421. package/dist/esm/tutorials/content/Tutorials_T09_T11.js +740 -755
  422. package/dist/esm/tutorials/content/Tutorials_T12_T15.js +759 -777
  423. package/dist/esm/ui/GameUI.js +296 -311
  424. package/dist/esm/unity-integration/UnityAssetStore.js +704 -740
  425. package/dist/esm/unity-integration/UnityImport.js +1071 -1175
  426. package/dist/esm/unity-integration/UnityLiveLink.js +938 -980
  427. package/dist/esm/unity-integration/components/UnityAssetStoreBrowser.js +1234 -756
  428. package/dist/esm/unity-integration/components/UnityProjectBrowser.js +1241 -767
  429. package/dist/esm/unreal-integration/UnrealImport.js +395 -411
  430. package/dist/esm/unreal-integration/UnrealLiveLink.js +1105 -1136
  431. package/dist/esm/unreal-integration/UnrealMarketplace.js +442 -472
  432. package/dist/esm/unreal-integration/components/UnrealProjectBrowser.js +1151 -766
  433. package/dist/esm/xr/ARVR.js +181 -174
  434. package/package.json +7 -12
@@ -1,1246 +1,1142 @@
1
- /**
2
- * @file UnityImport.ts
3
- * @description Unity Project Import system for Nice2Dev Game Engine
4
- * PRO-1.8.1: Unity Project Import
5
- *
6
- * Features:
7
- * - Unity Project Importer (scene, prefab, hierarchy, components)
8
- * - Unity Asset Database Integration (meta files, GUIDs, dependencies)
9
- * - Unity Animation Import (clips, controllers, masks, events)
10
- * - Unity Script Import (MonoBehaviour parsing, SerializeField extraction)
11
- */
12
1
  function parseUnityYAML(content) {
13
- const documents = [];
14
- // Unity YAML uses --- !u! markers
15
- const docRegex = /--- !u!(\d+) &(\d+)(?:\s+stripped)?/g;
16
- const matches = [...content.matchAll(docRegex)];
17
- for (let i = 0; i < matches.length; i++) {
18
- const match = matches[i];
19
- const classID = parseInt(match[1], 10);
20
- const fileID = parseInt(match[2], 10);
21
- // Find content between this document and next
22
- const startIdx = match.index + match[0].length;
23
- const endIdx = i < matches.length - 1 ? matches[i + 1].index : content.length;
24
- const docContent = content.slice(startIdx, endIdx).trim();
25
- // Parse YAML content (simplified parser)
26
- const data = parseUnityYAMLContent(docContent);
27
- documents.push({
28
- fileID,
29
- classID,
30
- stripped: match[0].includes('stripped'),
31
- data,
32
- });
33
- }
34
- return documents;
2
+ const documents = [];
3
+ const docRegex = /--- !u!(\d+) &(\d+)(?:\s+stripped)?/g;
4
+ const matches = [...content.matchAll(docRegex)];
5
+ for (let i = 0; i < matches.length; i++) {
6
+ const match = matches[i];
7
+ const classID = parseInt(match[1], 10);
8
+ const fileID = parseInt(match[2], 10);
9
+ const startIdx = match.index + match[0].length;
10
+ const endIdx = i < matches.length - 1 ? matches[i + 1].index : content.length;
11
+ const docContent = content.slice(startIdx, endIdx).trim();
12
+ const data = parseUnityYAMLContent(docContent);
13
+ documents.push({
14
+ fileID,
15
+ classID,
16
+ stripped: match[0].includes("stripped"),
17
+ data
18
+ });
19
+ }
20
+ return documents;
35
21
  }
36
22
  function parseUnityYAMLContent(content) {
37
- const result = {};
38
- const lines = content.split('\n');
39
- const stack = [
40
- { obj: result, indent: -1 },
41
- ];
42
- for (const line of lines) {
43
- if (!line.trim() || line.trim().startsWith('#')) {
44
- continue;
45
- }
46
- const indent = line.search(/\S/);
47
- const trimmed = line.trim();
48
- // Pop stack until we find parent with smaller indent
49
- while (stack.length > 1 && stack[stack.length - 1].indent >= indent) {
50
- stack.pop();
51
- }
52
- const parent = stack[stack.length - 1].obj;
53
- // Check for key: value
54
- const colonIdx = trimmed.indexOf(':');
55
- if (colonIdx > 0) {
56
- const key = trimmed.slice(0, colonIdx).trim();
57
- const value = trimmed.slice(colonIdx + 1).trim();
58
- if (value === '' || value === '{}') {
59
- // Nested object
60
- const nested = {};
61
- parent[key] = nested;
62
- stack.push({ obj: nested, indent });
63
- }
64
- else if (value.startsWith('{') && value.endsWith('}')) {
65
- // Inline object like {fileID: 0}
66
- parent[key] = parseInlineYAML(value);
67
- }
68
- else if (value.startsWith('[') && value.endsWith(']')) {
69
- // Inline array
70
- parent[key] = parseInlineArray(value);
71
- }
72
- else {
73
- // Simple value
74
- parent[key] = parseYAMLValue(value);
75
- }
76
- }
77
- else if (trimmed.startsWith('- ')) {
78
- // Array element
79
- trimmed.slice(2).trim();
80
- }
23
+ const result = {};
24
+ const lines = content.split("\n");
25
+ const stack = [
26
+ { obj: result, indent: -1 }
27
+ ];
28
+ for (const line of lines) {
29
+ if (!line.trim() || line.trim().startsWith("#")) {
30
+ continue;
81
31
  }
82
- return result;
83
- }
84
- function parseInlineYAML(inline) {
85
- const result = {};
86
- // Remove braces
87
- const content = inline.slice(1, -1).trim();
88
- if (!content) {
89
- return result;
32
+ const indent = line.search(/\S/);
33
+ const trimmed = line.trim();
34
+ while (stack.length > 1 && stack[stack.length - 1].indent >= indent) {
35
+ stack.pop();
90
36
  }
91
- // Split by comma (simplified, doesn't handle nested)
92
- const pairs = content.split(',');
93
- for (const pair of pairs) {
94
- const [key, value] = pair.split(':').map((s) => s.trim());
95
- if (key && value !== undefined) {
96
- result[key] = parseYAMLValue(value);
97
- }
37
+ const parent = stack[stack.length - 1].obj;
38
+ const colonIdx = trimmed.indexOf(":");
39
+ if (colonIdx > 0) {
40
+ const key = trimmed.slice(0, colonIdx).trim();
41
+ const value = trimmed.slice(colonIdx + 1).trim();
42
+ if (value === "" || value === "{}") {
43
+ const nested = {};
44
+ parent[key] = nested;
45
+ stack.push({ obj: nested, indent });
46
+ } else if (value.startsWith("{") && value.endsWith("}")) {
47
+ parent[key] = parseInlineYAML(value);
48
+ } else if (value.startsWith("[") && value.endsWith("]")) {
49
+ parent[key] = parseInlineArray(value);
50
+ } else {
51
+ parent[key] = parseYAMLValue(value);
52
+ }
53
+ } else if (trimmed.startsWith("- ")) {
54
+ trimmed.slice(2).trim();
98
55
  }
56
+ }
57
+ return result;
58
+ }
59
+ function parseInlineYAML(inline) {
60
+ const result = {};
61
+ const content = inline.slice(1, -1).trim();
62
+ if (!content) {
99
63
  return result;
64
+ }
65
+ const pairs = content.split(",");
66
+ for (const pair of pairs) {
67
+ const [key, value] = pair.split(":").map((s) => s.trim());
68
+ if (key && value !== void 0) {
69
+ result[key] = parseYAMLValue(value);
70
+ }
71
+ }
72
+ return result;
100
73
  }
101
74
  function parseInlineArray(inline) {
102
- const content = inline.slice(1, -1).trim();
103
- if (!content) {
104
- return [];
105
- }
106
- // Simplified array parsing
107
- return content.split(',').map((s) => parseYAMLValue(s.trim()));
75
+ const content = inline.slice(1, -1).trim();
76
+ if (!content) {
77
+ return [];
78
+ }
79
+ return content.split(",").map((s) => parseYAMLValue(s.trim()));
108
80
  }
109
81
  function parseYAMLValue(value) {
110
- // Remove quotes if present
111
- if ((value.startsWith('"') && value.endsWith('"')) ||
112
- (value.startsWith("'") && value.endsWith("'"))) {
113
- return value.slice(1, -1);
114
- }
115
- // Boolean
116
- if (value === 'true' || value === '1') {
117
- return true;
118
- }
119
- if (value === 'false' || value === '0') {
120
- return false;
121
- }
122
- // Null
123
- if (value === 'null' || value === '~' || value === '') {
124
- return null;
125
- }
126
- // Number
127
- const num = parseFloat(value);
128
- if (!isNaN(num) && isFinite(num)) {
129
- return num;
130
- }
131
- return value;
82
+ if (value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'")) {
83
+ return value.slice(1, -1);
84
+ }
85
+ if (value === "true" || value === "1") {
86
+ return true;
87
+ }
88
+ if (value === "false" || value === "0") {
89
+ return false;
90
+ }
91
+ if (value === "null" || value === "~" || value === "") {
92
+ return null;
93
+ }
94
+ const num = parseFloat(value);
95
+ if (!isNaN(num) && isFinite(num)) {
96
+ return num;
97
+ }
98
+ return value;
132
99
  }
133
100
  function parseUnityMeta(content) {
134
- // Meta files are simpler YAML
135
- const lines = content.split('\n');
136
- const meta = {
137
- guid: '',
138
- importerType: 'unknown',
139
- importSettings: {},
140
- };
141
- for (const line of lines) {
142
- if (line.startsWith('guid:')) {
143
- meta.guid = line.slice(5).trim();
144
- }
145
- else if (line.includes('Importer:') || line.includes('importer:')) {
146
- meta.importerType = line.split(':')[0].trim();
147
- }
148
- else if (line.startsWith('timeCreated:')) {
149
- meta.timestamp = parseInt(line.slice(12).trim(), 10);
150
- }
151
- else if (line.startsWith('userData:')) {
152
- meta.userData = line.slice(9).trim();
153
- }
101
+ const lines = content.split("\n");
102
+ const meta = {
103
+ guid: "",
104
+ importerType: "unknown",
105
+ importSettings: {}
106
+ };
107
+ for (const line of lines) {
108
+ if (line.startsWith("guid:")) {
109
+ meta.guid = line.slice(5).trim();
110
+ } else if (line.includes("Importer:") || line.includes("importer:")) {
111
+ meta.importerType = line.split(":")[0].trim();
112
+ } else if (line.startsWith("timeCreated:")) {
113
+ meta.timestamp = parseInt(line.slice(12).trim(), 10);
114
+ } else if (line.startsWith("userData:")) {
115
+ meta.userData = line.slice(9).trim();
154
116
  }
155
- return meta;
117
+ }
118
+ return meta;
156
119
  }
157
- // ============================================================
158
- // Unity Class ID Mapping
159
- // ============================================================
160
120
  const UNITY_CLASS_IDS = {
161
- 1: 'GameObject',
162
- 2: 'Component',
163
- 3: 'LevelGameManager',
164
- 4: 'Transform',
165
- 20: 'Camera',
166
- 21: 'Material',
167
- 23: 'MeshRenderer',
168
- 25: 'Renderer',
169
- 28: 'Texture2D',
170
- 33: 'MeshFilter',
171
- 43: 'Mesh',
172
- 48: 'Shader',
173
- 49: 'TextAsset',
174
- 54: 'Rigidbody',
175
- 56: 'Collider',
176
- 61: 'BoxCollider',
177
- 64: 'MeshCollider',
178
- 65: 'SphereCollider',
179
- 82: 'AudioSource',
180
- 83: 'AudioClip',
181
- 84: 'RenderTexture',
182
- 87: 'MeshAnimator',
183
- 89: 'Cubemap',
184
- 91: 'AnimationClip',
185
- 93: 'RuntimeAnimatorController',
186
- 95: 'Animator',
187
- 104: 'RenderSettings',
188
- 108: 'Light',
189
- 109: 'CGProgram',
190
- 111: 'Animation',
191
- 114: 'MonoBehaviour',
192
- 115: 'MonoScript',
193
- 120: 'LineRenderer',
194
- 122: 'TrailRenderer',
195
- 124: 'Behaviour',
196
- 128: 'Font',
197
- 134: 'PhysicMaterial',
198
- 135: 'SphereCollider',
199
- 136: 'CapsuleCollider',
200
- 137: 'SkinnedMeshRenderer',
201
- 142: 'AssetBundle',
202
- 143: 'Prefab',
203
- 150: 'PreviewAnimationClip',
204
- 152: 'AudioListener',
205
- 156: 'Terrain',
206
- 157: 'TerrainCollider',
207
- 158: 'TerrainData',
208
- 177: 'VideoClip',
209
- 181: 'VideoPlayer',
210
- 183: 'Sprite',
211
- 184: 'CachedSpriteAtlas',
212
- 186: 'ReflectionProbe',
213
- 187: 'ReflectionProbes',
214
- 188: 'Terrain',
215
- 189: 'LightProbes',
216
- 191: 'LightProbeGroup',
217
- 192: 'SpriteAtlas',
218
- 193: 'SpriteAtlasDatabase',
219
- 195: 'NavMeshArea',
220
- 196: 'NavMeshAgent',
221
- 198: 'ParticleSystem',
222
- 199: 'ParticleSystemRenderer',
223
- 200: 'ShaderVariantCollection',
224
- 205: 'LODGroup',
225
- 206: 'BlendTree',
226
- 207: 'AudioMixer',
227
- 208: 'AudioMixerController',
228
- 212: 'SpriteRenderer',
229
- 213: 'Tilemap',
230
- 218: 'AudioMixerGroup',
231
- 220: 'CinemachineVirtualCamera',
232
- 221: 'AnimatorOverrideController',
233
- 222: 'Canvas',
234
- 223: 'CanvasRenderer',
235
- 224: 'RectTransform',
236
- 225: 'CanvasGroup',
237
- 226: 'BillboardAsset',
238
- 227: 'BillboardRenderer',
239
- 228: 'SpeedTreeWindAsset',
240
- 229: 'AnchoredJoint2D',
241
- 230: 'Joint2D',
242
- 231: 'SpringJoint2D',
243
- 232: 'DistanceJoint2D',
244
- 233: 'HingeJoint2D',
245
- 234: 'SliderJoint2D',
246
- 235: 'WheelJoint2D',
247
- 238: 'NavMeshData',
248
- 240: 'AudioMixerSnapshot',
249
- 241: 'AudioMixerEffectController',
250
- 243: 'PhysicsMaterial2D',
251
- 244: 'Rigidbody2D',
252
- 245: 'Collider2D',
253
- 246: 'BoxCollider2D',
254
- 247: 'CircleCollider2D',
255
- 248: 'CompositeCollider2D',
256
- 249: 'EdgeCollider2D',
257
- 250: 'PolygonCollider2D',
258
- 251: 'CapsuleCollider2D',
259
- 328: 'VideoClip',
260
- 334: 'PlayerSettings',
261
- 367: 'VideoPlayer',
121
+ 1: "GameObject",
122
+ 2: "Component",
123
+ 3: "LevelGameManager",
124
+ 4: "Transform",
125
+ 20: "Camera",
126
+ 21: "Material",
127
+ 23: "MeshRenderer",
128
+ 25: "Renderer",
129
+ 28: "Texture2D",
130
+ 33: "MeshFilter",
131
+ 43: "Mesh",
132
+ 48: "Shader",
133
+ 49: "TextAsset",
134
+ 54: "Rigidbody",
135
+ 56: "Collider",
136
+ 61: "BoxCollider",
137
+ 64: "MeshCollider",
138
+ 65: "SphereCollider",
139
+ 82: "AudioSource",
140
+ 83: "AudioClip",
141
+ 84: "RenderTexture",
142
+ 87: "MeshAnimator",
143
+ 89: "Cubemap",
144
+ 91: "AnimationClip",
145
+ 93: "RuntimeAnimatorController",
146
+ 95: "Animator",
147
+ 104: "RenderSettings",
148
+ 108: "Light",
149
+ 109: "CGProgram",
150
+ 111: "Animation",
151
+ 114: "MonoBehaviour",
152
+ 115: "MonoScript",
153
+ 120: "LineRenderer",
154
+ 122: "TrailRenderer",
155
+ 124: "Behaviour",
156
+ 128: "Font",
157
+ 134: "PhysicMaterial",
158
+ 135: "SphereCollider",
159
+ 136: "CapsuleCollider",
160
+ 137: "SkinnedMeshRenderer",
161
+ 142: "AssetBundle",
162
+ 143: "Prefab",
163
+ 150: "PreviewAnimationClip",
164
+ 152: "AudioListener",
165
+ 156: "Terrain",
166
+ 157: "TerrainCollider",
167
+ 158: "TerrainData",
168
+ 177: "VideoClip",
169
+ 181: "VideoPlayer",
170
+ 183: "Sprite",
171
+ 184: "CachedSpriteAtlas",
172
+ 186: "ReflectionProbe",
173
+ 187: "ReflectionProbes",
174
+ 188: "Terrain",
175
+ 189: "LightProbes",
176
+ 191: "LightProbeGroup",
177
+ 192: "SpriteAtlas",
178
+ 193: "SpriteAtlasDatabase",
179
+ 195: "NavMeshArea",
180
+ 196: "NavMeshAgent",
181
+ 198: "ParticleSystem",
182
+ 199: "ParticleSystemRenderer",
183
+ 200: "ShaderVariantCollection",
184
+ 205: "LODGroup",
185
+ 206: "BlendTree",
186
+ 207: "AudioMixer",
187
+ 208: "AudioMixerController",
188
+ 212: "SpriteRenderer",
189
+ 213: "Tilemap",
190
+ 218: "AudioMixerGroup",
191
+ 220: "CinemachineVirtualCamera",
192
+ 221: "AnimatorOverrideController",
193
+ 222: "Canvas",
194
+ 223: "CanvasRenderer",
195
+ 224: "RectTransform",
196
+ 225: "CanvasGroup",
197
+ 226: "BillboardAsset",
198
+ 227: "BillboardRenderer",
199
+ 228: "SpeedTreeWindAsset",
200
+ 229: "AnchoredJoint2D",
201
+ 230: "Joint2D",
202
+ 231: "SpringJoint2D",
203
+ 232: "DistanceJoint2D",
204
+ 233: "HingeJoint2D",
205
+ 234: "SliderJoint2D",
206
+ 235: "WheelJoint2D",
207
+ 238: "NavMeshData",
208
+ 240: "AudioMixerSnapshot",
209
+ 241: "AudioMixerEffectController",
210
+ 243: "PhysicsMaterial2D",
211
+ 244: "Rigidbody2D",
212
+ 245: "Collider2D",
213
+ 246: "BoxCollider2D",
214
+ 247: "CircleCollider2D",
215
+ 248: "CompositeCollider2D",
216
+ 249: "EdgeCollider2D",
217
+ 250: "PolygonCollider2D",
218
+ 251: "CapsuleCollider2D",
219
+ 328: "VideoClip",
220
+ 334: "PlayerSettings",
221
+ 367: "VideoPlayer"
262
222
  };
263
223
  function getUnityClassName(classID) {
264
- return UNITY_CLASS_IDS[classID] ?? `Unknown_${classID}`;
224
+ return UNITY_CLASS_IDS[classID] ?? `Unknown_${classID}`;
265
225
  }
266
226
  class UnityProjectImporter {
267
- constructor() {
268
- this.callbacks = {};
227
+ constructor() {
228
+ this.callbacks = {};
229
+ }
230
+ // ─── Project Scanning ──────────────────────────────────
231
+ async scanProject(projectPath) {
232
+ this.project = {
233
+ name: this.extractProjectName(projectPath),
234
+ path: projectPath,
235
+ unityVersion: "",
236
+ renderPipeline: "builtin",
237
+ assets: /* @__PURE__ */ new Map(),
238
+ scenes: [],
239
+ prefabs: [],
240
+ scripts: [],
241
+ materials: [],
242
+ missingRefs: []
243
+ };
244
+ this.project.unityVersion = await this.detectUnityVersion(projectPath);
245
+ this.project.renderPipeline = await this.detectRenderPipeline(projectPath);
246
+ await this.scanAssetsFolder(`${projectPath}/Assets`);
247
+ this.buildDependencyGraph();
248
+ this.detectMissingReferences();
249
+ this.callbacks.onProjectScanned?.(this.project);
250
+ return this.project;
251
+ }
252
+ extractProjectName(path) {
253
+ const parts = path.replace(/\\/g, "/").split("/");
254
+ return parts[parts.length - 1] || "UnknownProject";
255
+ }
256
+ async detectUnityVersion(_projectPath) {
257
+ return "2022.3.10f1";
258
+ }
259
+ async detectRenderPipeline(_projectPath) {
260
+ return "builtin";
261
+ }
262
+ async scanAssetsFolder(_assetsPath) {
263
+ this.callbacks.onScanProgress?.("Scanning assets...", 0);
264
+ }
265
+ // ─── Scene Import ──────────────────────────────────────
266
+ async importScene(scenePath, sceneContent) {
267
+ const documents = parseUnityYAML(sceneContent);
268
+ const scene = {
269
+ name: this.extractFileName(scenePath),
270
+ path: scenePath,
271
+ objects: /* @__PURE__ */ new Map(),
272
+ roots: []
273
+ };
274
+ for (const doc of documents) {
275
+ const typeName = getUnityClassName(doc.classID);
276
+ scene.objects.set(doc.fileID, {
277
+ fileID: doc.fileID,
278
+ type: typeName,
279
+ classID: doc.classID,
280
+ data: doc.data
281
+ });
282
+ if (typeName === "RenderSettings") {
283
+ scene.renderSettings = doc.data;
284
+ } else if (typeName === "LightmapSettings") {
285
+ scene.lightmapSettings = doc.data;
286
+ } else if (typeName === "NavMeshSettings") {
287
+ scene.navMeshSettings = doc.data;
288
+ } else if (typeName === "OcclusionCullingSettings") {
289
+ scene.occlusionSettings = doc.data;
290
+ }
269
291
  }
270
- // ─── Project Scanning ──────────────────────────────────
271
- async scanProject(projectPath) {
272
- this.project = {
273
- name: this.extractProjectName(projectPath),
274
- path: projectPath,
275
- unityVersion: '',
276
- renderPipeline: 'builtin',
277
- assets: new Map(),
278
- scenes: [],
279
- prefabs: [],
280
- scripts: [],
281
- materials: [],
282
- missingRefs: [],
283
- };
284
- // Detect Unity version from ProjectSettings
285
- this.project.unityVersion = await this.detectUnityVersion(projectPath);
286
- // Detect render pipeline
287
- this.project.renderPipeline = await this.detectRenderPipeline(projectPath);
288
- // Scan Assets folder
289
- await this.scanAssetsFolder(`${projectPath}/Assets`);
290
- // Build dependency graph
291
- this.buildDependencyGraph();
292
- // Detect missing references
293
- this.detectMissingReferences();
294
- this.callbacks.onProjectScanned?.(this.project);
295
- return this.project;
292
+ for (const obj of scene.objects.values()) {
293
+ if (obj.type === "Transform") {
294
+ const transform = obj.data["Transform"];
295
+ if (transform) {
296
+ const parent = transform["m_Father"];
297
+ if (!parent || parent.fileID === 0) {
298
+ const goRef = transform["m_GameObject"];
299
+ if (goRef?.fileID) {
300
+ scene.roots.push(goRef.fileID);
301
+ }
302
+ }
303
+ }
304
+ }
296
305
  }
297
- extractProjectName(path) {
298
- const parts = path.replace(/\\/g, '/').split('/');
299
- return parts[parts.length - 1] || 'UnknownProject';
306
+ this.callbacks.onSceneImported?.(scene);
307
+ return scene;
308
+ }
309
+ extractFileName(path) {
310
+ const parts = path.replace(/\\/g, "/").split("/");
311
+ const filename = parts[parts.length - 1];
312
+ return filename.replace(/\.[^/.]+$/, "");
313
+ }
314
+ // ─── Prefab Import ─────────────────────────────────────
315
+ async importPrefab(prefabPath, prefabContent, guid) {
316
+ const documents = parseUnityYAML(prefabContent);
317
+ const prefab = {
318
+ name: this.extractFileName(prefabPath),
319
+ guid,
320
+ path: prefabPath,
321
+ rootFileID: 0,
322
+ objects: /* @__PURE__ */ new Map(),
323
+ isVariant: false
324
+ };
325
+ for (const doc of documents) {
326
+ const typeName = getUnityClassName(doc.classID);
327
+ if (typeName === "PrefabInstance") {
328
+ prefab.isVariant = true;
329
+ const prefabInstance = doc.data["PrefabInstance"];
330
+ if (prefabInstance) {
331
+ const sourceRef = prefabInstance["m_SourcePrefab"];
332
+ if (sourceRef?.guid) {
333
+ prefab.basePrefabGUID = sourceRef.guid;
334
+ }
335
+ }
336
+ }
337
+ prefab.objects.set(doc.fileID, {
338
+ fileID: doc.fileID,
339
+ type: typeName,
340
+ classID: doc.classID,
341
+ data: doc.data
342
+ });
300
343
  }
301
- async detectUnityVersion(_projectPath) {
302
- // Read ProjectSettings/ProjectVersion.txt
303
- // In real implementation, read from file system
304
- // Format: m_EditorVersion: 2022.3.10f1
305
- return '2022.3.10f1';
344
+ for (const obj of prefab.objects.values()) {
345
+ if (obj.type === "Transform") {
346
+ const transform = obj.data["Transform"];
347
+ if (transform) {
348
+ const parent = transform["m_Father"];
349
+ if (!parent || parent.fileID === 0) {
350
+ const goRef = transform["m_GameObject"];
351
+ if (goRef?.fileID) {
352
+ prefab.rootFileID = goRef.fileID;
353
+ break;
354
+ }
355
+ }
356
+ }
357
+ }
306
358
  }
307
- async detectRenderPipeline(_projectPath) {
308
- // Check for URP/HDRP packages in Packages/manifest.json
309
- // Or check QualitySettings for render pipeline asset
310
- return 'builtin';
359
+ this.callbacks.onPrefabImported?.(prefab);
360
+ return prefab;
361
+ }
362
+ // ─── Script Import ─────────────────────────────────────
363
+ parseScript(scriptPath, scriptContent, guid) {
364
+ const scriptInfo = {
365
+ guid,
366
+ path: scriptPath,
367
+ type: "script",
368
+ className: "",
369
+ isMonoBehaviour: false,
370
+ isScriptableObject: false,
371
+ serializedFields: [],
372
+ publicMethods: [],
373
+ unityMessages: [],
374
+ dependencies: [],
375
+ dependents: []
376
+ };
377
+ scriptContent.split("\n");
378
+ const namespaceMatch = scriptContent.match(/namespace\s+([\w.]+)/);
379
+ if (namespaceMatch) {
380
+ scriptInfo.namespace = namespaceMatch[1];
311
381
  }
312
- async scanAssetsFolder(_assetsPath) {
313
- // In real implementation, use file system to scan
314
- // For now, simulate scanning
315
- this.callbacks.onScanProgress?.('Scanning assets...', 0);
316
- // This would recursively scan directories and process:
317
- // - .meta files for GUIDs
318
- // - .unity files for scenes
319
- // - .prefab files for prefabs
320
- // - .cs files for scripts
321
- // - .mat files for materials
322
- // - etc.
382
+ const classMatch = scriptContent.match(/class\s+(\w+)\s*(?::\s*([\w,\s<>]+))?/);
383
+ if (classMatch) {
384
+ scriptInfo.className = classMatch[1];
385
+ const baseClasses = classMatch[2]?.split(",").map((s) => s.trim()) ?? [];
386
+ scriptInfo.isMonoBehaviour = baseClasses.some(
387
+ (b) => b === "MonoBehaviour" || b.includes("MonoBehaviour")
388
+ );
389
+ scriptInfo.isScriptableObject = baseClasses.some(
390
+ (b) => b === "ScriptableObject" || b.includes("ScriptableObject")
391
+ );
323
392
  }
324
- // ─── Scene Import ──────────────────────────────────────
325
- async importScene(scenePath, sceneContent) {
326
- const documents = parseUnityYAML(sceneContent);
327
- const scene = {
328
- name: this.extractFileName(scenePath),
329
- path: scenePath,
330
- objects: new Map(),
331
- roots: [],
332
- };
333
- // First pass: create all objects
334
- for (const doc of documents) {
335
- const typeName = getUnityClassName(doc.classID);
336
- scene.objects.set(doc.fileID, {
337
- fileID: doc.fileID,
338
- type: typeName,
339
- classID: doc.classID,
340
- data: doc.data,
341
- });
342
- // Extract settings
343
- if (typeName === 'RenderSettings') {
344
- scene.renderSettings = doc.data;
345
- }
346
- else if (typeName === 'LightmapSettings') {
347
- scene.lightmapSettings = doc.data;
348
- }
349
- else if (typeName === 'NavMeshSettings') {
350
- scene.navMeshSettings = doc.data;
351
- }
352
- else if (typeName === 'OcclusionCullingSettings') {
353
- scene.occlusionSettings = doc.data;
354
- }
355
- }
356
- // Second pass: find root objects
357
- for (const obj of scene.objects.values()) {
358
- if (obj.type === 'Transform') {
359
- const transform = obj.data['Transform'];
360
- if (transform) {
361
- const parent = transform['m_Father'];
362
- if (!parent || parent.fileID === 0) {
363
- // This is a root transform, find its GameObject
364
- const goRef = transform['m_GameObject'];
365
- if (goRef?.fileID) {
366
- scene.roots.push(goRef.fileID);
367
- }
368
- }
369
- }
370
- }
371
- }
372
- this.callbacks.onSceneImported?.(scene);
373
- return scene;
393
+ const fieldRegex = /\[SerializeField\][\s\S]*?(?:private|protected)?\s*([\w<>[\],\s]+)\s+(\w+)\s*[;=]/g;
394
+ const publicFieldRegex = /public\s+([\w<>[\],\s]+)\s+(\w+)\s*[;=]/g;
395
+ const methodRegex = /(?:public|private|protected)\s+(?:override\s+)?(?:virtual\s+)?(?:async\s+)?(\w+(?:<[\w,\s]+>)?)\s+(\w+)\s*\(/g;
396
+ let fieldMatch;
397
+ while ((fieldMatch = fieldRegex.exec(scriptContent)) !== null) {
398
+ const field = this.parseFieldDeclaration(fieldMatch[1], fieldMatch[2], false, true);
399
+ scriptInfo.serializedFields.push(field);
400
+ }
401
+ while ((fieldMatch = publicFieldRegex.exec(scriptContent)) !== null) {
402
+ const field = this.parseFieldDeclaration(fieldMatch[1], fieldMatch[2], true, false);
403
+ if (!scriptContent.slice(Math.max(0, fieldMatch.index - 20), fieldMatch.index).includes("static")) {
404
+ scriptInfo.serializedFields.push(field);
405
+ }
374
406
  }
375
- extractFileName(path) {
376
- const parts = path.replace(/\\/g, '/').split('/');
377
- const filename = parts[parts.length - 1];
378
- return filename.replace(/\.[^/.]+$/, '');
407
+ let methodMatch;
408
+ while ((methodMatch = methodRegex.exec(scriptContent)) !== null) {
409
+ const methodName = methodMatch[2];
410
+ if (UNITY_MESSAGES.includes(methodName)) {
411
+ scriptInfo.unityMessages.push(methodName);
412
+ }
413
+ const methodContext = scriptContent.slice(
414
+ Math.max(0, methodMatch.index - 10),
415
+ methodMatch.index
416
+ );
417
+ if (methodContext.includes("public")) {
418
+ scriptInfo.publicMethods.push(methodName);
419
+ }
379
420
  }
380
- // ─── Prefab Import ─────────────────────────────────────
381
- async importPrefab(prefabPath, prefabContent, guid) {
382
- const documents = parseUnityYAML(prefabContent);
383
- const prefab = {
384
- name: this.extractFileName(prefabPath),
385
- guid,
386
- path: prefabPath,
387
- rootFileID: 0,
388
- objects: new Map(),
389
- isVariant: false,
421
+ this.parseFieldAttributes(scriptContent, scriptInfo.serializedFields);
422
+ this.callbacks.onScriptParsed?.(scriptInfo);
423
+ return scriptInfo;
424
+ }
425
+ parseFieldDeclaration(typeStr, name, isPublic, hasSerializeField) {
426
+ const cleanType = typeStr.trim();
427
+ const isArray = cleanType.endsWith("[]") || cleanType.includes("List<");
428
+ return {
429
+ name,
430
+ type: this.mapCSharpType(cleanType),
431
+ customType: this.isCustomType(cleanType) ? cleanType : void 0,
432
+ isArray,
433
+ isPublic,
434
+ hasSerializeField
435
+ };
436
+ }
437
+ mapCSharpType(typeStr) {
438
+ const baseType = typeStr.replace("[]", "").replace(/List<(.+)>/, "$1").trim();
439
+ const typeMap = {
440
+ int: "int",
441
+ Int32: "int",
442
+ float: "float",
443
+ Single: "float",
444
+ double: "float",
445
+ bool: "bool",
446
+ Boolean: "bool",
447
+ string: "string",
448
+ String: "string",
449
+ Vector2: "Vector2",
450
+ Vector3: "Vector3",
451
+ Vector4: "Vector4",
452
+ Quaternion: "Quaternion",
453
+ Color: "Color",
454
+ Color32: "Color",
455
+ LayerMask: "LayerMask",
456
+ AnimationCurve: "AnimationCurve",
457
+ Gradient: "Gradient",
458
+ GameObject: "Object",
459
+ Transform: "Object",
460
+ Sprite: "Object",
461
+ Texture: "Object",
462
+ Texture2D: "Object",
463
+ Material: "Object",
464
+ AudioClip: "Object"
465
+ };
466
+ return typeMap[baseType] ?? "Custom";
467
+ }
468
+ isCustomType(typeStr) {
469
+ const knownTypes = [
470
+ "int",
471
+ "float",
472
+ "double",
473
+ "bool",
474
+ "string",
475
+ "Vector2",
476
+ "Vector3",
477
+ "Vector4",
478
+ "Quaternion",
479
+ "Color",
480
+ "Color32",
481
+ "LayerMask",
482
+ "AnimationCurve",
483
+ "Gradient",
484
+ "GameObject",
485
+ "Transform",
486
+ "Sprite",
487
+ "Texture",
488
+ "Texture2D",
489
+ "Material",
490
+ "AudioClip",
491
+ "Rigidbody",
492
+ "Collider"
493
+ ];
494
+ const baseType = typeStr.replace("[]", "").replace(/List<(.+)>/, "$1").trim();
495
+ return !knownTypes.includes(baseType);
496
+ }
497
+ parseFieldAttributes(scriptContent, fields) {
498
+ for (const field of fields) {
499
+ const fieldPattern = new RegExp(
500
+ `((?:\\[.*?\\]\\s*)*?)(?:public|private|protected)?\\s*\\w+\\s+${field.name}\\s*[;=]`,
501
+ "s"
502
+ );
503
+ const match = scriptContent.match(fieldPattern);
504
+ if (!match) {
505
+ continue;
506
+ }
507
+ const attrBlock = match[1];
508
+ const headerMatch = attrBlock.match(/\[Header\("([^"]+)"\)\]/);
509
+ if (headerMatch) {
510
+ field.header = headerMatch[1];
511
+ }
512
+ const tooltipMatch = attrBlock.match(/\[Tooltip\("([^"]+)"\)\]/);
513
+ if (tooltipMatch) {
514
+ field.tooltip = tooltipMatch[1];
515
+ }
516
+ const rangeMatch = attrBlock.match(/\[Range\(([^,]+),\s*([^)]+)\)\]/);
517
+ if (rangeMatch) {
518
+ field.range = {
519
+ min: parseFloat(rangeMatch[1]),
520
+ max: parseFloat(rangeMatch[2])
390
521
  };
391
- // Check if it's a prefab variant
392
- for (const doc of documents) {
393
- const typeName = getUnityClassName(doc.classID);
394
- if (typeName === 'PrefabInstance') {
395
- prefab.isVariant = true;
396
- const prefabInstance = doc.data['PrefabInstance'];
397
- if (prefabInstance) {
398
- const sourceRef = prefabInstance['m_SourcePrefab'];
399
- if (sourceRef?.guid) {
400
- prefab.basePrefabGUID = sourceRef.guid;
401
- }
402
- }
403
- }
404
- prefab.objects.set(doc.fileID, {
405
- fileID: doc.fileID,
406
- type: typeName,
407
- classID: doc.classID,
408
- data: doc.data,
409
- });
522
+ }
523
+ }
524
+ }
525
+ // ─── Material Import ───────────────────────────────────
526
+ parseMaterial(matPath, matContent, guid) {
527
+ const documents = parseUnityYAML(matContent);
528
+ const matInfo = {
529
+ guid,
530
+ path: matPath,
531
+ type: "material",
532
+ shaderName: "Standard",
533
+ textures: {},
534
+ floats: {},
535
+ colors: {},
536
+ vectors: {},
537
+ renderQueue: 2e3,
538
+ keywords: [],
539
+ dependencies: [],
540
+ dependents: []
541
+ };
542
+ for (const doc of documents) {
543
+ if (getUnityClassName(doc.classID) === "Material") {
544
+ const material = doc.data["Material"];
545
+ if (!material) {
546
+ continue;
410
547
  }
411
- // Find root transform
412
- for (const obj of prefab.objects.values()) {
413
- if (obj.type === 'Transform') {
414
- const transform = obj.data['Transform'];
415
- if (transform) {
416
- const parent = transform['m_Father'];
417
- if (!parent || parent.fileID === 0) {
418
- const goRef = transform['m_GameObject'];
419
- if (goRef?.fileID) {
420
- prefab.rootFileID = goRef.fileID;
421
- break;
422
- }
423
- }
424
- }
425
- }
548
+ const shaderRef = material["m_Shader"];
549
+ if (shaderRef?.guid) {
550
+ matInfo.shaderGUID = shaderRef.guid;
551
+ }
552
+ const shaderKeywords = material["m_ShaderKeywords"];
553
+ if (shaderKeywords) {
554
+ matInfo.keywords = shaderKeywords.split(" ").filter(Boolean);
555
+ }
556
+ const texEnvs = material["m_TexEnvs"];
557
+ if (texEnvs) {
558
+ for (const texEnv of texEnvs) {
559
+ const name = Object.keys(texEnv)[0];
560
+ const data = texEnv[name];
561
+ const texRef = data?.["m_Texture"];
562
+ matInfo.textures[name] = texRef?.guid ?? null;
563
+ }
564
+ }
565
+ const floats = material["m_Floats"];
566
+ if (floats) {
567
+ for (const floatProp of floats) {
568
+ const name = Object.keys(floatProp)[0];
569
+ matInfo.floats[name] = floatProp[name];
570
+ }
571
+ }
572
+ const colors = material["m_Colors"];
573
+ if (colors) {
574
+ for (const colorProp of colors) {
575
+ const name = Object.keys(colorProp)[0];
576
+ const c = colorProp[name];
577
+ matInfo.colors[name] = {
578
+ r: c.r ?? 0,
579
+ g: c.g ?? 0,
580
+ b: c.b ?? 0,
581
+ a: c.a ?? 1
582
+ };
583
+ }
426
584
  }
427
- this.callbacks.onPrefabImported?.(prefab);
428
- return prefab;
585
+ if (typeof material["m_CustomRenderQueue"] === "number") {
586
+ matInfo.renderQueue = material["m_CustomRenderQueue"];
587
+ }
588
+ }
429
589
  }
430
- // ─── Script Import ─────────────────────────────────────
431
- parseScript(scriptPath, scriptContent, guid) {
432
- const scriptInfo = {
433
- guid,
434
- path: scriptPath,
435
- type: 'script',
436
- className: '',
437
- isMonoBehaviour: false,
438
- isScriptableObject: false,
439
- serializedFields: [],
440
- publicMethods: [],
441
- unityMessages: [],
442
- dependencies: [],
443
- dependents: [],
444
- };
445
- // Parse C# content
446
- scriptContent.split('\n');
447
- // Extract namespace
448
- const namespaceMatch = scriptContent.match(/namespace\s+([\w.]+)/);
449
- if (namespaceMatch) {
450
- scriptInfo.namespace = namespaceMatch[1];
590
+ this.callbacks.onMaterialParsed?.(matInfo);
591
+ return matInfo;
592
+ }
593
+ // ─── Animation Import ──────────────────────────────────
594
+ parseAnimationClip(clipPath, clipContent, guid) {
595
+ const documents = parseUnityYAML(clipContent);
596
+ const clipInfo = {
597
+ guid,
598
+ path: clipPath,
599
+ name: this.extractFileName(clipPath),
600
+ length: 0,
601
+ frameRate: 60,
602
+ wrapMode: "Default",
603
+ isLooping: false,
604
+ curves: [],
605
+ events: []
606
+ };
607
+ for (const doc of documents) {
608
+ if (getUnityClassName(doc.classID) === "AnimationClip") {
609
+ const clip = doc.data["AnimationClip"];
610
+ if (!clip) {
611
+ continue;
451
612
  }
452
- // Extract class declaration
453
- const classMatch = scriptContent.match(/class\s+(\w+)\s*(?::\s*([\w,\s<>]+))?/);
454
- if (classMatch) {
455
- scriptInfo.className = classMatch[1];
456
- const baseClasses = classMatch[2]?.split(',').map((s) => s.trim()) ?? [];
457
- scriptInfo.isMonoBehaviour = baseClasses.some((b) => b === 'MonoBehaviour' || b.includes('MonoBehaviour'));
458
- scriptInfo.isScriptableObject = baseClasses.some((b) => b === 'ScriptableObject' || b.includes('ScriptableObject'));
613
+ clipInfo.name = clip["m_Name"] ?? clipInfo.name;
614
+ const settings = clip["m_AnimationClipSettings"];
615
+ if (settings) {
616
+ clipInfo.length = settings["m_StopTime"] ?? 0;
617
+ clipInfo.isLooping = settings["m_LoopTime"] ?? false;
459
618
  }
460
- // Parse fields and methods
461
- const fieldRegex = /\[SerializeField\][\s\S]*?(?:private|protected)?\s*([\w<>[\],\s]+)\s+(\w+)\s*[;=]/g;
462
- const publicFieldRegex = /public\s+([\w<>[\],\s]+)\s+(\w+)\s*[;=]/g;
463
- const methodRegex = /(?:public|private|protected)\s+(?:override\s+)?(?:virtual\s+)?(?:async\s+)?(\w+(?:<[\w,\s]+>)?)\s+(\w+)\s*\(/g;
464
- // Extract SerializeField fields
465
- let fieldMatch;
466
- while ((fieldMatch = fieldRegex.exec(scriptContent)) !== null) {
467
- const field = this.parseFieldDeclaration(fieldMatch[1], fieldMatch[2], false, true);
468
- scriptInfo.serializedFields.push(field);
619
+ clipInfo.frameRate = clip["m_SampleRate"] ?? 60;
620
+ const positionCurves = clip["m_PositionCurves"];
621
+ const rotationCurves = clip["m_RotationCurves"];
622
+ const scaleCurves = clip["m_ScaleCurves"];
623
+ const floatCurves = clip["m_FloatCurves"];
624
+ if (positionCurves) {
625
+ for (const curve of positionCurves) {
626
+ clipInfo.curves.push(this.parseCurve(curve, "position"));
627
+ }
469
628
  }
470
- // Extract public fields (auto-serialized)
471
- while ((fieldMatch = publicFieldRegex.exec(scriptContent)) !== null) {
472
- const field = this.parseFieldDeclaration(fieldMatch[1], fieldMatch[2], true, false);
473
- // Exclude static fields
474
- if (!scriptContent
475
- .slice(Math.max(0, fieldMatch.index - 20), fieldMatch.index)
476
- .includes('static')) {
477
- scriptInfo.serializedFields.push(field);
478
- }
629
+ if (rotationCurves) {
630
+ for (const curve of rotationCurves) {
631
+ clipInfo.curves.push(this.parseCurve(curve, "rotation"));
632
+ }
633
+ }
634
+ if (scaleCurves) {
635
+ for (const curve of scaleCurves) {
636
+ clipInfo.curves.push(this.parseCurve(curve, "scale"));
637
+ }
638
+ }
639
+ if (floatCurves) {
640
+ for (const curve of floatCurves) {
641
+ clipInfo.curves.push(this.parseCurve(curve, "float"));
642
+ }
479
643
  }
480
- // Extract methods
481
- let methodMatch;
482
- while ((methodMatch = methodRegex.exec(scriptContent)) !== null) {
483
- const methodName = methodMatch[2];
484
- // Check if it's a Unity message
485
- if (UNITY_MESSAGES.includes(methodName)) {
486
- scriptInfo.unityMessages.push(methodName);
644
+ const events = clip["m_Events"];
645
+ if (events) {
646
+ for (const event of events) {
647
+ clipInfo.events.push(this.parseAnimationEvent(event));
648
+ }
649
+ }
650
+ }
651
+ }
652
+ return clipInfo;
653
+ }
654
+ parseCurve(curve, type) {
655
+ return {
656
+ path: curve["path"] ?? "",
657
+ propertyName: curve["attribute"] ?? type,
658
+ type,
659
+ keyframes: []
660
+ // Would parse m_Curve keyframes
661
+ };
662
+ }
663
+ parseAnimationEvent(event) {
664
+ return {
665
+ time: event["time"] ?? 0,
666
+ functionName: event["functionName"] ?? "",
667
+ stringParameter: event["data"],
668
+ floatParameter: event["floatParameter"],
669
+ intParameter: event["intParameter"],
670
+ objectReferenceParameter: event["objectReferenceParameter"]?.guid
671
+ };
672
+ }
673
+ parseAnimatorController(controllerPath, controllerContent, guid) {
674
+ const documents = parseUnityYAML(controllerContent);
675
+ const controllerInfo = {
676
+ guid,
677
+ path: controllerPath,
678
+ name: this.extractFileName(controllerPath),
679
+ parameters: [],
680
+ layers: []
681
+ };
682
+ const states = /* @__PURE__ */ new Map();
683
+ const transitions = /* @__PURE__ */ new Map();
684
+ for (const doc of documents) {
685
+ const typeName = getUnityClassName(doc.classID);
686
+ if (typeName === "AnimatorController") {
687
+ const controller = doc.data["AnimatorController"];
688
+ if (controller) {
689
+ controllerInfo.name = controller["m_Name"] ?? controllerInfo.name;
690
+ const params = controller["m_AnimatorParameters"];
691
+ if (params) {
692
+ for (const param of params) {
693
+ const p = param;
694
+ const defaultVal = p["m_DefaultFloat"] ?? p["m_DefaultInt"] ?? p["m_DefaultBool"];
695
+ controllerInfo.parameters.push({
696
+ name: p["m_Name"] ?? "",
697
+ type: this.mapAnimatorParameterType(p["m_Type"]),
698
+ defaultValue: typeof defaultVal === "number" || typeof defaultVal === "boolean" ? defaultVal : 0
699
+ });
487
700
  }
488
- // Check if public
489
- const methodContext = scriptContent.slice(Math.max(0, methodMatch.index - 10), methodMatch.index);
490
- if (methodContext.includes('public')) {
491
- scriptInfo.publicMethods.push(methodName);
701
+ }
702
+ }
703
+ } else if (typeName === "AnimatorStateMachine") {
704
+ const stateMachine = doc.data["AnimatorStateMachine"];
705
+ if (stateMachine) {
706
+ const layer = {
707
+ name: stateMachine["m_Name"] ?? "Base Layer",
708
+ stateMachine: {
709
+ fileID: doc.fileID,
710
+ states: [],
711
+ transitions: [],
712
+ defaultStateIndex: 0
713
+ },
714
+ weight: 1,
715
+ blendingMode: "Override"
716
+ };
717
+ controllerInfo.layers.push(layer);
718
+ }
719
+ } else if (typeName === "AnimatorState") {
720
+ const state = doc.data["AnimatorState"];
721
+ if (state) {
722
+ const stateInfo = {
723
+ fileID: doc.fileID,
724
+ name: state["m_Name"] ?? "",
725
+ speed: state["m_Speed"] ?? 1,
726
+ motionGUID: state["m_Motion"]?.guid,
727
+ transitions: []
728
+ };
729
+ states.set(doc.fileID, stateInfo);
730
+ }
731
+ } else if (typeName === "AnimatorStateTransition") {
732
+ const transition = doc.data["AnimatorStateTransition"];
733
+ if (transition) {
734
+ const transInfo = {
735
+ fileID: doc.fileID,
736
+ destinationStateID: transition["m_DstState"]?.fileID ?? 0,
737
+ hasExitTime: transition["m_HasExitTime"] ?? false,
738
+ exitTime: transition["m_ExitTime"] ?? 0.9,
739
+ duration: transition["m_TransitionDuration"] ?? 0.25,
740
+ conditions: []
741
+ };
742
+ const conditions = transition["m_Conditions"];
743
+ if (conditions) {
744
+ for (const cond of conditions) {
745
+ const c = cond;
746
+ transInfo.conditions.push({
747
+ parameter: c["m_ConditionEvent"] ?? "",
748
+ mode: this.mapConditionMode(c["m_ConditionMode"]),
749
+ threshold: c["m_EventTreshold"] ?? 0
750
+ });
492
751
  }
752
+ }
753
+ transitions.set(doc.fileID, transInfo);
493
754
  }
494
- // Extract attributes (Header, Tooltip, Range)
495
- this.parseFieldAttributes(scriptContent, scriptInfo.serializedFields);
496
- this.callbacks.onScriptParsed?.(scriptInfo);
497
- return scriptInfo;
755
+ }
498
756
  }
499
- parseFieldDeclaration(typeStr, name, isPublic, hasSerializeField) {
500
- const cleanType = typeStr.trim();
501
- const isArray = cleanType.endsWith('[]') || cleanType.includes('List<');
502
- return {
503
- name,
504
- type: this.mapCSharpType(cleanType),
505
- customType: this.isCustomType(cleanType) ? cleanType : undefined,
506
- isArray,
507
- isPublic,
508
- hasSerializeField,
509
- };
757
+ return controllerInfo;
758
+ }
759
+ mapAnimatorParameterType(type) {
760
+ const types = {
761
+ 1: "Float",
762
+ 3: "Int",
763
+ 4: "Bool",
764
+ 9: "Trigger"
765
+ };
766
+ return types[type] ?? "Float";
767
+ }
768
+ mapConditionMode(mode) {
769
+ const modes = {
770
+ 1: "If",
771
+ 2: "IfNot",
772
+ 3: "Greater",
773
+ 4: "Less",
774
+ 6: "Equals",
775
+ 7: "NotEquals"
776
+ };
777
+ return modes[mode] ?? "If";
778
+ }
779
+ // ─── Dependency Graph ──────────────────────────────────
780
+ buildDependencyGraph() {
781
+ for (const [guid, asset] of this.project.assets) {
782
+ for (const depGUID of asset.dependencies) {
783
+ const depAsset = this.project.assets.get(depGUID);
784
+ if (depAsset && !depAsset.dependents.includes(guid)) {
785
+ depAsset.dependents.push(guid);
786
+ }
787
+ }
510
788
  }
511
- mapCSharpType(typeStr) {
512
- const baseType = typeStr
513
- .replace('[]', '')
514
- .replace(/List<(.+)>/, '$1')
515
- .trim();
516
- const typeMap = {
517
- int: 'int',
518
- Int32: 'int',
519
- float: 'float',
520
- Single: 'float',
521
- double: 'float',
522
- bool: 'bool',
523
- Boolean: 'bool',
524
- string: 'string',
525
- String: 'string',
526
- Vector2: 'Vector2',
527
- Vector3: 'Vector3',
528
- Vector4: 'Vector4',
529
- Quaternion: 'Quaternion',
530
- Color: 'Color',
531
- Color32: 'Color',
532
- LayerMask: 'LayerMask',
533
- AnimationCurve: 'AnimationCurve',
534
- Gradient: 'Gradient',
535
- GameObject: 'Object',
536
- Transform: 'Object',
537
- Sprite: 'Object',
538
- Texture: 'Object',
539
- Texture2D: 'Object',
540
- Material: 'Object',
541
- AudioClip: 'Object',
542
- };
543
- return typeMap[baseType] ?? 'Custom';
789
+ }
790
+ detectMissingReferences() {
791
+ for (const [guid, asset] of this.project.assets) {
792
+ for (const depGUID of asset.dependencies) {
793
+ if (!this.project.assets.has(depGUID)) {
794
+ this.project.missingRefs.push({
795
+ assetGUID: guid,
796
+ assetPath: asset.path,
797
+ missingGUID: depGUID,
798
+ propertyPath: "unknown"
799
+ // Would need context to determine
800
+ });
801
+ }
802
+ }
544
803
  }
545
- isCustomType(typeStr) {
546
- const knownTypes = [
547
- 'int',
548
- 'float',
549
- 'double',
550
- 'bool',
551
- 'string',
552
- 'Vector2',
553
- 'Vector3',
554
- 'Vector4',
555
- 'Quaternion',
556
- 'Color',
557
- 'Color32',
558
- 'LayerMask',
559
- 'AnimationCurve',
560
- 'Gradient',
561
- 'GameObject',
562
- 'Transform',
563
- 'Sprite',
564
- 'Texture',
565
- 'Texture2D',
566
- 'Material',
567
- 'AudioClip',
568
- 'Rigidbody',
569
- 'Collider',
570
- ];
571
- const baseType = typeStr
572
- .replace('[]', '')
573
- .replace(/List<(.+)>/, '$1')
574
- .trim();
575
- return !knownTypes.includes(baseType);
804
+ }
805
+ // ─── Conversion to Nice2Dev ────────────────────────────
806
+ convertSceneToNice2Dev(scene) {
807
+ const nice2devScene = {
808
+ name: scene.name,
809
+ entities: [],
810
+ cameras: [],
811
+ lights: []
812
+ };
813
+ for (const rootID of scene.roots) {
814
+ const entity = this.convertGameObject(scene, rootID);
815
+ if (entity) {
816
+ nice2devScene.entities.push(entity);
817
+ }
576
818
  }
577
- parseFieldAttributes(scriptContent, fields) {
578
- for (const field of fields) {
579
- // Find field in content and check preceding attributes
580
- const fieldPattern = new RegExp(`((?:\\[.*?\\]\\s*)*?)(?:public|private|protected)?\\s*\\w+\\s+${field.name}\\s*[;=]`, 's');
581
- const match = scriptContent.match(fieldPattern);
582
- if (!match) {
583
- continue;
584
- }
585
- const attrBlock = match[1];
586
- // Header
587
- const headerMatch = attrBlock.match(/\[Header\("([^"]+)"\)\]/);
588
- if (headerMatch) {
589
- field.header = headerMatch[1];
819
+ return nice2devScene;
820
+ }
821
+ convertGameObject(scene, fileID) {
822
+ const goObj = scene.objects.get(fileID);
823
+ if (!goObj || goObj.type !== "GameObject") {
824
+ return null;
825
+ }
826
+ const goData = goObj.data["GameObject"];
827
+ if (!goData) {
828
+ return null;
829
+ }
830
+ const entity = {
831
+ name: goData["m_Name"] ?? "GameObject",
832
+ active: goData["m_IsActive"] ?? true,
833
+ tag: goData["m_Tag"] ?? "Untagged",
834
+ layer: goData["m_Layer"] ?? 0,
835
+ transform: {
836
+ position: { x: 0, y: 0, z: 0 },
837
+ rotation: { x: 0, y: 0, z: 0, w: 1 },
838
+ scale: { x: 1, y: 1, z: 1 }
839
+ },
840
+ components: [],
841
+ children: []
842
+ };
843
+ const components = goData["m_Component"];
844
+ if (components) {
845
+ for (const compRef of components) {
846
+ if (compRef.component.fileID === void 0) {
847
+ continue;
848
+ }
849
+ const compObj = scene.objects.get(compRef.component.fileID);
850
+ if (!compObj) {
851
+ continue;
852
+ }
853
+ if (compObj.type === "Transform" || compObj.type === "RectTransform") {
854
+ const transform = compObj.data[compObj.type];
855
+ if (transform) {
856
+ const pos = transform["m_LocalPosition"];
857
+ const rot = transform["m_LocalRotation"];
858
+ const scale = transform["m_LocalScale"];
859
+ if (pos) {
860
+ entity.transform.position = { x: pos.x, y: pos.y, z: pos.z };
590
861
  }
591
- // Tooltip
592
- const tooltipMatch = attrBlock.match(/\[Tooltip\("([^"]+)"\)\]/);
593
- if (tooltipMatch) {
594
- field.tooltip = tooltipMatch[1];
862
+ if (rot) {
863
+ entity.transform.rotation = { x: rot.x, y: rot.y, z: rot.z, w: rot.w };
595
864
  }
596
- // Range
597
- const rangeMatch = attrBlock.match(/\[Range\(([^,]+),\s*([^)]+)\)\]/);
598
- if (rangeMatch) {
599
- field.range = {
600
- min: parseFloat(rangeMatch[1]),
601
- max: parseFloat(rangeMatch[2]),
602
- };
865
+ if (scale) {
866
+ entity.transform.scale = { x: scale.x, y: scale.y, z: scale.z };
603
867
  }
604
- }
605
- }
606
- // ─── Material Import ───────────────────────────────────
607
- parseMaterial(matPath, matContent, guid) {
608
- const documents = parseUnityYAML(matContent);
609
- const matInfo = {
610
- guid,
611
- path: matPath,
612
- type: 'material',
613
- shaderName: 'Standard',
614
- textures: {},
615
- floats: {},
616
- colors: {},
617
- vectors: {},
618
- renderQueue: 2000,
619
- keywords: [],
620
- dependencies: [],
621
- dependents: [],
622
- };
623
- for (const doc of documents) {
624
- if (getUnityClassName(doc.classID) === 'Material') {
625
- const material = doc.data['Material'];
626
- if (!material) {
627
- continue;
628
- }
629
- // Shader reference
630
- const shaderRef = material['m_Shader'];
631
- if (shaderRef?.guid) {
632
- matInfo.shaderGUID = shaderRef.guid;
633
- }
634
- // Shader name from saved properties (if built-in shader)
635
- const shaderKeywords = material['m_ShaderKeywords'];
636
- if (shaderKeywords) {
637
- matInfo.keywords = shaderKeywords.split(' ').filter(Boolean);
638
- }
639
- // Texture properties
640
- const texEnvs = material['m_TexEnvs'];
641
- if (texEnvs) {
642
- for (const texEnv of texEnvs) {
643
- const name = Object.keys(texEnv)[0];
644
- const data = texEnv[name];
645
- const texRef = data?.['m_Texture'];
646
- matInfo.textures[name] = texRef?.guid ?? null;
647
- }
648
- }
649
- // Float properties
650
- const floats = material['m_Floats'];
651
- if (floats) {
652
- for (const floatProp of floats) {
653
- const name = Object.keys(floatProp)[0];
654
- matInfo.floats[name] = floatProp[name];
655
- }
868
+ const children = transform["m_Children"];
869
+ if (children) {
870
+ for (const childRef of children) {
871
+ if (childRef.fileID === void 0) {
872
+ continue;
656
873
  }
657
- // Color properties
658
- const colors = material['m_Colors'];
659
- if (colors) {
660
- for (const colorProp of colors) {
661
- const name = Object.keys(colorProp)[0];
662
- const c = colorProp[name];
663
- matInfo.colors[name] = {
664
- r: c.r ?? 0,
665
- g: c.g ?? 0,
666
- b: c.b ?? 0,
667
- a: c.a ?? 1,
668
- };
874
+ const childTransform = scene.objects.get(childRef.fileID);
875
+ if (childTransform) {
876
+ const childGO = childTransform.data["Transform"]?.["m_GameObject"];
877
+ if (childGO?.fileID) {
878
+ const childEntity = this.convertGameObject(scene, childGO.fileID);
879
+ if (childEntity) {
880
+ entity.children.push(childEntity);
669
881
  }
882
+ }
670
883
  }
671
- // Render queue
672
- if (typeof material['m_CustomRenderQueue'] === 'number') {
673
- matInfo.renderQueue = material['m_CustomRenderQueue'];
674
- }
884
+ }
675
885
  }
886
+ }
887
+ } else {
888
+ const compData = this.convertComponent(compObj);
889
+ if (compData) {
890
+ entity.components.push(compData);
891
+ }
676
892
  }
677
- this.callbacks.onMaterialParsed?.(matInfo);
678
- return matInfo;
893
+ }
679
894
  }
680
- // ─── Animation Import ──────────────────────────────────
681
- parseAnimationClip(clipPath, clipContent, guid) {
682
- const documents = parseUnityYAML(clipContent);
683
- const clipInfo = {
684
- guid,
685
- path: clipPath,
686
- name: this.extractFileName(clipPath),
687
- length: 0,
688
- frameRate: 60,
689
- wrapMode: 'Default',
690
- isLooping: false,
691
- curves: [],
692
- events: [],
693
- };
694
- for (const doc of documents) {
695
- if (getUnityClassName(doc.classID) === 'AnimationClip') {
696
- const clip = doc.data['AnimationClip'];
697
- if (!clip) {
698
- continue;
699
- }
700
- clipInfo.name = clip['m_Name'] ?? clipInfo.name;
701
- const settings = clip['m_AnimationClipSettings'];
702
- if (settings) {
703
- clipInfo.length = settings['m_StopTime'] ?? 0;
704
- clipInfo.isLooping = settings['m_LoopTime'] ?? false;
705
- }
706
- clipInfo.frameRate = clip['m_SampleRate'] ?? 60;
707
- // Parse curves
708
- const positionCurves = clip['m_PositionCurves'];
709
- const rotationCurves = clip['m_RotationCurves'];
710
- const scaleCurves = clip['m_ScaleCurves'];
711
- const floatCurves = clip['m_FloatCurves'];
712
- if (positionCurves) {
713
- for (const curve of positionCurves) {
714
- clipInfo.curves.push(this.parseCurve(curve, 'position'));
715
- }
716
- }
717
- if (rotationCurves) {
718
- for (const curve of rotationCurves) {
719
- clipInfo.curves.push(this.parseCurve(curve, 'rotation'));
720
- }
721
- }
722
- if (scaleCurves) {
723
- for (const curve of scaleCurves) {
724
- clipInfo.curves.push(this.parseCurve(curve, 'scale'));
725
- }
726
- }
727
- if (floatCurves) {
728
- for (const curve of floatCurves) {
729
- clipInfo.curves.push(this.parseCurve(curve, 'float'));
730
- }
731
- }
732
- // Parse events
733
- const events = clip['m_Events'];
734
- if (events) {
735
- for (const event of events) {
736
- clipInfo.events.push(this.parseAnimationEvent(event));
737
- }
738
- }
739
- }
740
- }
741
- return clipInfo;
895
+ return entity;
896
+ }
897
+ convertComponent(compObj) {
898
+ const typeName = compObj.type;
899
+ const data = compObj.data[typeName];
900
+ if (!data) {
901
+ return null;
742
902
  }
743
- parseCurve(curve, type) {
903
+ switch (typeName) {
904
+ case "Camera":
744
905
  return {
745
- path: curve['path'] ?? '',
746
- propertyName: curve['attribute'] ?? type,
747
- type,
748
- keyframes: [], // Would parse m_Curve keyframes
906
+ type: "Camera",
907
+ data: {
908
+ fieldOfView: data["field of view"] ?? 60,
909
+ nearClip: data["near clip plane"] ?? 0.3,
910
+ farClip: data["far clip plane"] ?? 1e3,
911
+ orthographic: data["orthographic"] ?? false,
912
+ orthographicSize: data["orthographic size"] ?? 5
913
+ }
749
914
  };
750
- }
751
- parseAnimationEvent(event) {
915
+ case "Light":
752
916
  return {
753
- time: event['time'] ?? 0,
754
- functionName: event['functionName'] ?? '',
755
- stringParameter: event['data'],
756
- floatParameter: event['floatParameter'],
757
- intParameter: event['intParameter'],
758
- objectReferenceParameter: event['objectReferenceParameter']?.guid,
917
+ type: "Light",
918
+ data: {
919
+ type: this.mapLightType(data["m_Type"]),
920
+ color: data["m_Color"] ?? { r: 1, g: 1, b: 1, a: 1 },
921
+ intensity: data["m_Intensity"] ?? 1,
922
+ range: data["m_Range"] ?? 10,
923
+ spotAngle: data["m_SpotAngle"] ?? 30,
924
+ shadows: data["m_Shadows"] !== 0
925
+ }
759
926
  };
760
- }
761
- parseAnimatorController(controllerPath, controllerContent, guid) {
762
- const documents = parseUnityYAML(controllerContent);
763
- const controllerInfo = {
764
- guid,
765
- path: controllerPath,
766
- name: this.extractFileName(controllerPath),
767
- parameters: [],
768
- layers: [],
927
+ case "MeshRenderer":
928
+ case "SkinnedMeshRenderer":
929
+ return {
930
+ type: "MeshRenderer",
931
+ data: {
932
+ enabled: data["m_Enabled"] ?? true,
933
+ castShadows: data["m_CastShadows"] ?? true,
934
+ receiveShadows: data["m_ReceiveShadows"] ?? true,
935
+ materials: []
936
+ // Would resolve material GUIDs
937
+ }
769
938
  };
770
- const states = new Map();
771
- const transitions = new Map();
772
- for (const doc of documents) {
773
- const typeName = getUnityClassName(doc.classID);
774
- if (typeName === 'AnimatorController') {
775
- const controller = doc.data['AnimatorController'];
776
- if (controller) {
777
- controllerInfo.name = controller['m_Name'] ?? controllerInfo.name;
778
- // Parse parameters
779
- const params = controller['m_AnimatorParameters'];
780
- if (params) {
781
- for (const param of params) {
782
- const p = param;
783
- const defaultVal = p['m_DefaultFloat'] ?? p['m_DefaultInt'] ?? p['m_DefaultBool'];
784
- controllerInfo.parameters.push({
785
- name: p['m_Name'] ?? '',
786
- type: this.mapAnimatorParameterType(p['m_Type']),
787
- defaultValue: typeof defaultVal === 'number' || typeof defaultVal === 'boolean'
788
- ? defaultVal
789
- : 0,
790
- });
791
- }
792
- }
793
- }
794
- }
795
- else if (typeName === 'AnimatorStateMachine') {
796
- const stateMachine = doc.data['AnimatorStateMachine'];
797
- if (stateMachine) {
798
- const layer = {
799
- name: stateMachine['m_Name'] ?? 'Base Layer',
800
- stateMachine: {
801
- fileID: doc.fileID,
802
- states: [],
803
- transitions: [],
804
- defaultStateIndex: 0,
805
- },
806
- weight: 1,
807
- blendingMode: 'Override',
808
- };
809
- controllerInfo.layers.push(layer);
810
- }
811
- }
812
- else if (typeName === 'AnimatorState') {
813
- const state = doc.data['AnimatorState'];
814
- if (state) {
815
- const stateInfo = {
816
- fileID: doc.fileID,
817
- name: state['m_Name'] ?? '',
818
- speed: state['m_Speed'] ?? 1,
819
- motionGUID: state['m_Motion']?.guid,
820
- transitions: [],
821
- };
822
- states.set(doc.fileID, stateInfo);
823
- }
824
- }
825
- else if (typeName === 'AnimatorStateTransition') {
826
- const transition = doc.data['AnimatorStateTransition'];
827
- if (transition) {
828
- const transInfo = {
829
- fileID: doc.fileID,
830
- destinationStateID: transition['m_DstState']?.fileID ?? 0,
831
- hasExitTime: transition['m_HasExitTime'] ?? false,
832
- exitTime: transition['m_ExitTime'] ?? 0.9,
833
- duration: transition['m_TransitionDuration'] ?? 0.25,
834
- conditions: [],
835
- };
836
- const conditions = transition['m_Conditions'];
837
- if (conditions) {
838
- for (const cond of conditions) {
839
- const c = cond;
840
- transInfo.conditions.push({
841
- parameter: c['m_ConditionEvent'] ?? '',
842
- mode: this.mapConditionMode(c['m_ConditionMode']),
843
- threshold: c['m_EventTreshold'] ?? 0,
844
- });
845
- }
846
- }
847
- transitions.set(doc.fileID, transInfo);
848
- }
849
- }
850
- }
851
- // Link states and transitions to layers
852
- // (Simplified - real implementation would trace m_ChildStates references)
853
- return controllerInfo;
854
- }
855
- mapAnimatorParameterType(type) {
856
- const types = {
857
- 1: 'Float',
858
- 3: 'Int',
859
- 4: 'Bool',
860
- 9: 'Trigger',
939
+ case "SpriteRenderer":
940
+ return {
941
+ type: "SpriteRenderer",
942
+ data: {
943
+ color: data["m_Color"] ?? { r: 1, g: 1, b: 1, a: 1 },
944
+ flipX: data["m_FlipX"] ?? false,
945
+ flipY: data["m_FlipY"] ?? false,
946
+ sortingLayer: data["m_SortingLayer"] ?? 0,
947
+ sortingOrder: data["m_SortingOrder"] ?? 0
948
+ }
861
949
  };
862
- return types[type] ?? 'Float';
863
- }
864
- mapConditionMode(mode) {
865
- const modes = {
866
- 1: 'If',
867
- 2: 'IfNot',
868
- 3: 'Greater',
869
- 4: 'Less',
870
- 6: 'Equals',
871
- 7: 'NotEquals',
950
+ case "Rigidbody":
951
+ return {
952
+ type: "Rigidbody3D",
953
+ data: {
954
+ mass: data["m_Mass"] ?? 1,
955
+ drag: data["m_Drag"] ?? 0,
956
+ angularDrag: data["m_AngularDrag"] ?? 0.05,
957
+ useGravity: data["m_UseGravity"] ?? true,
958
+ isKinematic: data["m_IsKinematic"] ?? false
959
+ }
872
960
  };
873
- return modes[mode] ?? 'If';
874
- }
875
- // ─── Dependency Graph ──────────────────────────────────
876
- buildDependencyGraph() {
877
- // For each asset, find what it references and update dependents
878
- for (const [guid, asset] of this.project.assets) {
879
- for (const depGUID of asset.dependencies) {
880
- const depAsset = this.project.assets.get(depGUID);
881
- if (depAsset && !depAsset.dependents.includes(guid)) {
882
- depAsset.dependents.push(guid);
883
- }
884
- }
885
- }
886
- }
887
- detectMissingReferences() {
888
- for (const [guid, asset] of this.project.assets) {
889
- for (const depGUID of asset.dependencies) {
890
- if (!this.project.assets.has(depGUID)) {
891
- this.project.missingRefs.push({
892
- assetGUID: guid,
893
- assetPath: asset.path,
894
- missingGUID: depGUID,
895
- propertyPath: 'unknown', // Would need context to determine
896
- });
897
- }
898
- }
899
- }
900
- }
901
- // ─── Conversion to Nice2Dev ────────────────────────────
902
- convertSceneToNice2Dev(scene) {
903
- const nice2devScene = {
904
- name: scene.name,
905
- entities: [],
906
- cameras: [],
907
- lights: [],
961
+ case "Rigidbody2D":
962
+ return {
963
+ type: "Rigidbody2D",
964
+ data: {
965
+ bodyType: this.mapRigidBodyType(data["m_BodyType"]),
966
+ mass: data["m_Mass"] ?? 1,
967
+ linearDrag: data["m_LinearDrag"] ?? 0,
968
+ angularDrag: data["m_AngularDrag"] ?? 0.05,
969
+ gravityScale: data["m_GravityScale"] ?? 1
970
+ }
908
971
  };
909
- // Convert each root and its children
910
- for (const rootID of scene.roots) {
911
- const entity = this.convertGameObject(scene, rootID);
912
- if (entity) {
913
- nice2devScene.entities.push(entity);
914
- }
915
- }
916
- return nice2devScene;
917
- }
918
- convertGameObject(scene, fileID) {
919
- const goObj = scene.objects.get(fileID);
920
- if (!goObj || goObj.type !== 'GameObject') {
921
- return null;
922
- }
923
- const goData = goObj.data['GameObject'];
924
- if (!goData) {
925
- return null;
926
- }
927
- const entity = {
928
- name: goData['m_Name'] ?? 'GameObject',
929
- active: goData['m_IsActive'] ?? true,
930
- tag: goData['m_Tag'] ?? 'Untagged',
931
- layer: goData['m_Layer'] ?? 0,
932
- transform: {
933
- position: { x: 0, y: 0, z: 0 },
934
- rotation: { x: 0, y: 0, z: 0, w: 1 },
935
- scale: { x: 1, y: 1, z: 1 },
936
- },
937
- components: [],
938
- children: [],
972
+ case "BoxCollider":
973
+ return {
974
+ type: "BoxCollider3D",
975
+ data: {
976
+ isTrigger: data["m_IsTrigger"] ?? false,
977
+ center: data["m_Center"] ?? { x: 0, y: 0, z: 0 },
978
+ size: data["m_Size"] ?? { x: 1, y: 1, z: 1 }
979
+ }
939
980
  };
940
- // Find transform
941
- const components = goData['m_Component'];
942
- if (components) {
943
- for (const compRef of components) {
944
- if (compRef.component.fileID === undefined) {
945
- continue;
946
- }
947
- const compObj = scene.objects.get(compRef.component.fileID);
948
- if (!compObj) {
949
- continue;
950
- }
951
- if (compObj.type === 'Transform' || compObj.type === 'RectTransform') {
952
- const transform = compObj.data[compObj.type];
953
- if (transform) {
954
- const pos = transform['m_LocalPosition'];
955
- const rot = transform['m_LocalRotation'];
956
- const scale = transform['m_LocalScale'];
957
- if (pos) {
958
- entity.transform.position = { x: pos.x, y: pos.y, z: pos.z };
959
- }
960
- if (rot) {
961
- entity.transform.rotation = { x: rot.x, y: rot.y, z: rot.z, w: rot.w };
962
- }
963
- if (scale) {
964
- entity.transform.scale = { x: scale.x, y: scale.y, z: scale.z };
965
- }
966
- // Get children
967
- const children = transform['m_Children'];
968
- if (children) {
969
- for (const childRef of children) {
970
- if (childRef.fileID === undefined) {
971
- continue;
972
- }
973
- const childTransform = scene.objects.get(childRef.fileID);
974
- if (childTransform) {
975
- const childGO = childTransform.data['Transform']?.['m_GameObject'];
976
- if (childGO?.fileID) {
977
- const childEntity = this.convertGameObject(scene, childGO.fileID);
978
- if (childEntity) {
979
- entity.children.push(childEntity);
980
- }
981
- }
982
- }
983
- }
984
- }
985
- }
986
- }
987
- else {
988
- // Convert other components
989
- const compData = this.convertComponent(compObj);
990
- if (compData) {
991
- entity.components.push(compData);
992
- }
993
- }
994
- }
995
- }
996
- return entity;
997
- }
998
- convertComponent(compObj) {
999
- const typeName = compObj.type;
1000
- const data = compObj.data[typeName];
1001
- if (!data) {
1002
- return null;
1003
- }
1004
- switch (typeName) {
1005
- case 'Camera':
1006
- return {
1007
- type: 'Camera',
1008
- data: {
1009
- fieldOfView: data['field of view'] ?? 60,
1010
- nearClip: data['near clip plane'] ?? 0.3,
1011
- farClip: data['far clip plane'] ?? 1000,
1012
- orthographic: data['orthographic'] ?? false,
1013
- orthographicSize: data['orthographic size'] ?? 5,
1014
- },
1015
- };
1016
- case 'Light':
1017
- return {
1018
- type: 'Light',
1019
- data: {
1020
- type: this.mapLightType(data['m_Type']),
1021
- color: data['m_Color'] ?? { r: 1, g: 1, b: 1, a: 1 },
1022
- intensity: data['m_Intensity'] ?? 1,
1023
- range: data['m_Range'] ?? 10,
1024
- spotAngle: data['m_SpotAngle'] ?? 30,
1025
- shadows: data['m_Shadows'] !== 0,
1026
- },
1027
- };
1028
- case 'MeshRenderer':
1029
- case 'SkinnedMeshRenderer':
1030
- return {
1031
- type: 'MeshRenderer',
1032
- data: {
1033
- enabled: data['m_Enabled'] ?? true,
1034
- castShadows: data['m_CastShadows'] ?? true,
1035
- receiveShadows: data['m_ReceiveShadows'] ?? true,
1036
- materials: [], // Would resolve material GUIDs
1037
- },
1038
- };
1039
- case 'SpriteRenderer':
1040
- return {
1041
- type: 'SpriteRenderer',
1042
- data: {
1043
- color: data['m_Color'] ?? { r: 1, g: 1, b: 1, a: 1 },
1044
- flipX: data['m_FlipX'] ?? false,
1045
- flipY: data['m_FlipY'] ?? false,
1046
- sortingLayer: data['m_SortingLayer'] ?? 0,
1047
- sortingOrder: data['m_SortingOrder'] ?? 0,
1048
- },
1049
- };
1050
- case 'Rigidbody':
1051
- return {
1052
- type: 'Rigidbody3D',
1053
- data: {
1054
- mass: data['m_Mass'] ?? 1,
1055
- drag: data['m_Drag'] ?? 0,
1056
- angularDrag: data['m_AngularDrag'] ?? 0.05,
1057
- useGravity: data['m_UseGravity'] ?? true,
1058
- isKinematic: data['m_IsKinematic'] ?? false,
1059
- },
1060
- };
1061
- case 'Rigidbody2D':
1062
- return {
1063
- type: 'Rigidbody2D',
1064
- data: {
1065
- bodyType: this.mapRigidBodyType(data['m_BodyType']),
1066
- mass: data['m_Mass'] ?? 1,
1067
- linearDrag: data['m_LinearDrag'] ?? 0,
1068
- angularDrag: data['m_AngularDrag'] ?? 0.05,
1069
- gravityScale: data['m_GravityScale'] ?? 1,
1070
- },
1071
- };
1072
- case 'BoxCollider':
1073
- return {
1074
- type: 'BoxCollider3D',
1075
- data: {
1076
- isTrigger: data['m_IsTrigger'] ?? false,
1077
- center: data['m_Center'] ?? { x: 0, y: 0, z: 0 },
1078
- size: data['m_Size'] ?? { x: 1, y: 1, z: 1 },
1079
- },
1080
- };
1081
- case 'BoxCollider2D':
1082
- return {
1083
- type: 'BoxCollider2D',
1084
- data: {
1085
- isTrigger: data['m_IsTrigger'] ?? false,
1086
- offset: data['m_Offset'] ?? { x: 0, y: 0 },
1087
- size: data['m_Size'] ?? { x: 1, y: 1 },
1088
- },
1089
- };
1090
- case 'CircleCollider2D':
1091
- return {
1092
- type: 'CircleCollider2D',
1093
- data: {
1094
- isTrigger: data['m_IsTrigger'] ?? false,
1095
- offset: data['m_Offset'] ?? { x: 0, y: 0 },
1096
- radius: data['m_Radius'] ?? 0.5,
1097
- },
1098
- };
1099
- case 'Animator':
1100
- return {
1101
- type: 'Animator',
1102
- data: {
1103
- controllerGUID: data['m_Controller']?.guid,
1104
- applyRootMotion: data['m_ApplyRootMotion'] ?? false,
1105
- updateMode: data['m_UpdateMode'] ?? 0,
1106
- cullingMode: data['m_CullingMode'] ?? 0,
1107
- },
1108
- };
1109
- case 'AudioSource': {
1110
- const panCurve = data['panLevelCustomCurve'];
1111
- const curveData = panCurve?.['m_Curve'];
1112
- return {
1113
- type: 'AudioSource',
1114
- data: {
1115
- clipGUID: data['m_audioClip']?.guid,
1116
- playOnAwake: data['m_PlayOnAwake'] ?? true,
1117
- loop: data['Loop'] ?? false,
1118
- volume: data['m_Volume'] ?? 1,
1119
- pitch: data['m_Pitch'] ?? 1,
1120
- spatialBlend: curveData?.[0]?.value ?? 0,
1121
- },
1122
- };
1123
- }
1124
- case 'ParticleSystem':
1125
- return {
1126
- type: 'ParticleSystem',
1127
- data: {
1128
- // Particle systems are complex, just mark as present
1129
- hasEmission: true,
1130
- },
1131
- };
1132
- case 'MonoBehaviour':
1133
- return {
1134
- type: 'Script',
1135
- data: {
1136
- scriptGUID: data['m_Script']?.guid,
1137
- serializedData: this.extractMonoBehaviourData(data),
1138
- },
1139
- };
1140
- default:
1141
- return {
1142
- type: 'Unknown',
1143
- data: { originalType: typeName },
1144
- };
1145
- }
1146
- }
1147
- mapLightType(type) {
1148
- const types = {
1149
- 0: 'spot',
1150
- 1: 'directional',
1151
- 2: 'point',
1152
- 3: 'area',
981
+ case "BoxCollider2D":
982
+ return {
983
+ type: "BoxCollider2D",
984
+ data: {
985
+ isTrigger: data["m_IsTrigger"] ?? false,
986
+ offset: data["m_Offset"] ?? { x: 0, y: 0 },
987
+ size: data["m_Size"] ?? { x: 1, y: 1 }
988
+ }
1153
989
  };
1154
- return types[type] ?? 'point';
1155
- }
1156
- mapRigidBodyType(type) {
1157
- const types = {
1158
- 0: 'dynamic',
1159
- 1: 'kinematic',
1160
- 2: 'static',
990
+ case "CircleCollider2D":
991
+ return {
992
+ type: "CircleCollider2D",
993
+ data: {
994
+ isTrigger: data["m_IsTrigger"] ?? false,
995
+ offset: data["m_Offset"] ?? { x: 0, y: 0 },
996
+ radius: data["m_Radius"] ?? 0.5
997
+ }
998
+ };
999
+ case "Animator":
1000
+ return {
1001
+ type: "Animator",
1002
+ data: {
1003
+ controllerGUID: data["m_Controller"]?.guid,
1004
+ applyRootMotion: data["m_ApplyRootMotion"] ?? false,
1005
+ updateMode: data["m_UpdateMode"] ?? 0,
1006
+ cullingMode: data["m_CullingMode"] ?? 0
1007
+ }
1008
+ };
1009
+ case "AudioSource": {
1010
+ const panCurve = data["panLevelCustomCurve"];
1011
+ const curveData = panCurve?.["m_Curve"];
1012
+ return {
1013
+ type: "AudioSource",
1014
+ data: {
1015
+ clipGUID: data["m_audioClip"]?.guid,
1016
+ playOnAwake: data["m_PlayOnAwake"] ?? true,
1017
+ loop: data["Loop"] ?? false,
1018
+ volume: data["m_Volume"] ?? 1,
1019
+ pitch: data["m_Pitch"] ?? 1,
1020
+ spatialBlend: curveData?.[0]?.value ?? 0
1021
+ }
1022
+ };
1023
+ }
1024
+ case "ParticleSystem":
1025
+ return {
1026
+ type: "ParticleSystem",
1027
+ data: {
1028
+ // Particle systems are complex, just mark as present
1029
+ hasEmission: true
1030
+ }
1031
+ };
1032
+ case "MonoBehaviour":
1033
+ return {
1034
+ type: "Script",
1035
+ data: {
1036
+ scriptGUID: data["m_Script"]?.guid,
1037
+ serializedData: this.extractMonoBehaviourData(data)
1038
+ }
1039
+ };
1040
+ default:
1041
+ return {
1042
+ type: "Unknown",
1043
+ data: { originalType: typeName }
1161
1044
  };
1162
- return types[type] ?? 'dynamic';
1163
- }
1164
- extractMonoBehaviourData(data) {
1165
- const result = {};
1166
- // Extract all non-internal properties
1167
- for (const [key, value] of Object.entries(data)) {
1168
- if (!key.startsWith('m_') ||
1169
- [
1170
- 'm_Enabled',
1171
- 'm_Script',
1172
- 'm_Name',
1173
- 'm_EditorHideFlags',
1174
- 'm_GameObject',
1175
- 'm_EditorClassIdentifier',
1176
- ].includes(key)) {
1177
- continue;
1178
- }
1179
- // Remove m_ prefix and convert to camelCase
1180
- const propName = key.slice(2, 3).toLowerCase() + key.slice(3);
1181
- result[propName] = value;
1182
- }
1183
- return result;
1184
1045
  }
1185
- // ─── Callbacks ─────────────────────────────────────────
1186
- setCallbacks(callbacks) {
1187
- this.callbacks = { ...this.callbacks, ...callbacks };
1046
+ }
1047
+ mapLightType(type) {
1048
+ const types = {
1049
+ 0: "spot",
1050
+ 1: "directional",
1051
+ 2: "point",
1052
+ 3: "area"
1053
+ };
1054
+ return types[type] ?? "point";
1055
+ }
1056
+ mapRigidBodyType(type) {
1057
+ const types = {
1058
+ 0: "dynamic",
1059
+ 1: "kinematic",
1060
+ 2: "static"
1061
+ };
1062
+ return types[type] ?? "dynamic";
1063
+ }
1064
+ extractMonoBehaviourData(data) {
1065
+ const result = {};
1066
+ for (const [key, value] of Object.entries(data)) {
1067
+ if (!key.startsWith("m_") || [
1068
+ "m_Enabled",
1069
+ "m_Script",
1070
+ "m_Name",
1071
+ "m_EditorHideFlags",
1072
+ "m_GameObject",
1073
+ "m_EditorClassIdentifier"
1074
+ ].includes(key)) {
1075
+ continue;
1076
+ }
1077
+ const propName = key.slice(2, 3).toLowerCase() + key.slice(3);
1078
+ result[propName] = value;
1188
1079
  }
1080
+ return result;
1081
+ }
1082
+ // ─── Callbacks ─────────────────────────────────────────
1083
+ setCallbacks(callbacks) {
1084
+ this.callbacks = { ...this.callbacks, ...callbacks };
1085
+ }
1189
1086
  }
1190
- // ============================================================
1191
- // Unity Messages List
1192
- // ============================================================
1193
1087
  const UNITY_MESSAGES = [
1194
- 'Awake',
1195
- 'Start',
1196
- 'Update',
1197
- 'FixedUpdate',
1198
- 'LateUpdate',
1199
- 'OnEnable',
1200
- 'OnDisable',
1201
- 'OnDestroy',
1202
- 'OnTriggerEnter',
1203
- 'OnTriggerStay',
1204
- 'OnTriggerExit',
1205
- 'OnTriggerEnter2D',
1206
- 'OnTriggerStay2D',
1207
- 'OnTriggerExit2D',
1208
- 'OnCollisionEnter',
1209
- 'OnCollisionStay',
1210
- 'OnCollisionExit',
1211
- 'OnCollisionEnter2D',
1212
- 'OnCollisionStay2D',
1213
- 'OnCollisionExit2D',
1214
- 'OnMouseDown',
1215
- 'OnMouseUp',
1216
- 'OnMouseEnter',
1217
- 'OnMouseExit',
1218
- 'OnMouseOver',
1219
- 'OnMouseDrag',
1220
- 'OnGUI',
1221
- 'OnDrawGizmos',
1222
- 'OnDrawGizmosSelected',
1223
- 'OnBecameVisible',
1224
- 'OnBecameInvisible',
1225
- 'OnPreCull',
1226
- 'OnPreRender',
1227
- 'OnPostRender',
1228
- 'OnRenderImage',
1229
- 'OnRenderObject',
1230
- 'OnWillRenderObject',
1231
- 'OnAnimatorMove',
1232
- 'OnAnimatorIK',
1233
- 'OnApplicationFocus',
1234
- 'OnApplicationPause',
1235
- 'OnApplicationQuit',
1236
- 'OnValidate',
1237
- 'Reset',
1088
+ "Awake",
1089
+ "Start",
1090
+ "Update",
1091
+ "FixedUpdate",
1092
+ "LateUpdate",
1093
+ "OnEnable",
1094
+ "OnDisable",
1095
+ "OnDestroy",
1096
+ "OnTriggerEnter",
1097
+ "OnTriggerStay",
1098
+ "OnTriggerExit",
1099
+ "OnTriggerEnter2D",
1100
+ "OnTriggerStay2D",
1101
+ "OnTriggerExit2D",
1102
+ "OnCollisionEnter",
1103
+ "OnCollisionStay",
1104
+ "OnCollisionExit",
1105
+ "OnCollisionEnter2D",
1106
+ "OnCollisionStay2D",
1107
+ "OnCollisionExit2D",
1108
+ "OnMouseDown",
1109
+ "OnMouseUp",
1110
+ "OnMouseEnter",
1111
+ "OnMouseExit",
1112
+ "OnMouseOver",
1113
+ "OnMouseDrag",
1114
+ "OnGUI",
1115
+ "OnDrawGizmos",
1116
+ "OnDrawGizmosSelected",
1117
+ "OnBecameVisible",
1118
+ "OnBecameInvisible",
1119
+ "OnPreCull",
1120
+ "OnPreRender",
1121
+ "OnPostRender",
1122
+ "OnRenderImage",
1123
+ "OnRenderObject",
1124
+ "OnWillRenderObject",
1125
+ "OnAnimatorMove",
1126
+ "OnAnimatorIK",
1127
+ "OnApplicationFocus",
1128
+ "OnApplicationPause",
1129
+ "OnApplicationQuit",
1130
+ "OnValidate",
1131
+ "Reset"
1238
1132
  ];
1239
- // ============================================================
1240
- // Factory Functions
1241
- // ============================================================
1242
1133
  function createUnityProjectImporter() {
1243
- return new UnityProjectImporter();
1134
+ return new UnityProjectImporter();
1244
1135
  }
1245
-
1246
- export { UnityProjectImporter, createUnityProjectImporter, getUnityClassName, parseUnityMeta, parseUnityYAML };
1136
+ export {
1137
+ UnityProjectImporter,
1138
+ createUnityProjectImporter,
1139
+ getUnityClassName,
1140
+ parseUnityMeta,
1141
+ parseUnityYAML
1142
+ };