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