gg.easy.airship 0.1.2192 → 0.1.2194

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 (66) hide show
  1. package/Editor/Accessories/Clothing/PlatformGearBundleManifestEditor.cs +7 -1
  2. package/Editor/CreateAssetBundles.cs +9 -11
  3. package/Editor/Publish/Callback/IBuildAirshipGameBundle.cs +49 -0
  4. package/Editor/Publish/Callback/IBuildAirshipGameBundle.cs.meta +3 -0
  5. package/Editor/Publish/Callback.meta +3 -0
  6. package/Editor/Publish/Deploy.cs +28 -21
  7. package/Editor/Quality/QualityConfig.cs +39 -12
  8. package/Editor/Settings/AirshipSettingsProvider.cs +17 -0
  9. package/Runtime/Code/AirshipConst.cs +2 -2
  10. package/Runtime/Code/Bootstrap/LuauScriptsDtoSerializer.cs +1 -1
  11. package/Runtime/Code/Bundles/LoadedAssetBundle.cs +1 -2
  12. package/Runtime/Code/Bundles/SystemRoot.cs +25 -92
  13. package/Runtime/Code/CoreUI/Components/AirshipVersionOverlay.cs +21 -0
  14. package/Runtime/Code/CoreUI/Components/AirshipVersionOverlay.cs.meta +3 -0
  15. package/Runtime/Code/Luau/LuauAssembly/BinaryBlob.cs +2 -1
  16. package/Runtime/Code/Luau/LuauCore.cs +0 -3
  17. package/Runtime/Code/Luau/LuauCoreCallbacks.cs +5 -0
  18. package/Runtime/Code/LuauAPI/GameObjectAPI.cs +15 -4
  19. package/Runtime/Code/LuauAPI/TransformAPI.cs +14 -2
  20. package/Runtime/Code/LuauHelper/LuauHelper.cs +9 -1
  21. package/Runtime/Code/Network/Simulation/AirshipNetworkedObject.cs +1 -3
  22. package/Runtime/Code/Network/Simulation/AirshipSimulationManager.cs +11 -10
  23. package/Runtime/Code/Network/Simulation/History.cs +3 -3
  24. package/Runtime/Code/Network/StateSystem/AirshipNetworkedStateManager.cs +21 -15
  25. package/Runtime/Code/Network/StateSystem/Implementations/TestMovementSystem/TestMovementInputDiff.cs +7 -0
  26. package/Runtime/Code/Network/StateSystem/Implementations/TestMovementSystem/TestMovementInputDiff.cs.meta +3 -0
  27. package/Runtime/Code/Network/StateSystem/Implementations/TestMovementSystem/TestMovementInputGroup.cs +16 -0
  28. package/Runtime/Code/Network/StateSystem/Implementations/TestMovementSystem/TestMovementInputGroup.cs.meta +3 -0
  29. package/Runtime/Code/Network/StateSystem/Implementations/TestMovementSystem/TestNetworkedStateManager.cs +7 -5
  30. package/Runtime/Code/Network/StateSystem/Structures/InputCommand.cs +9 -0
  31. package/Runtime/Code/Network/StateSystem/Structures/InputCommandDiff.cs +13 -0
  32. package/Runtime/Code/Network/StateSystem/Structures/InputCommandDiff.cs.meta +3 -0
  33. package/Runtime/Code/Network/StateSystem/Structures/InputCommandGroup.cs +43 -0
  34. package/Runtime/Code/Network/StateSystem/Structures/InputCommandGroup.cs.meta +3 -0
  35. package/Runtime/Code/Player/Character/MovementSystems/Character/CharacterMovement.cs +68 -167
  36. package/Runtime/Code/Player/Character/MovementSystems/Character/CharacterNetworkedStateManager.cs +5 -6
  37. package/Runtime/Code/Player/Character/MovementSystems/Character/CharacterPhysics.cs +2 -2
  38. package/Runtime/Code/Player/Character/MovementSystems/Character/Structures/CharacterInputData.cs +113 -2
  39. package/Runtime/Code/Player/Character/MovementSystems/Character/Structures/CharacterInputDiff.cs +56 -0
  40. package/Runtime/Code/Player/Character/MovementSystems/Character/Structures/CharacterInputDiff.cs.meta +3 -0
  41. package/Runtime/Code/Player/Character/MovementSystems/Character/Structures/CharacterInputGroup.cs +27 -0
  42. package/Runtime/Code/Player/Character/MovementSystems/Character/Structures/CharacterInputGroup.cs.meta +3 -0
  43. package/Runtime/Code/Player/Character/MovementSystems/Character/Structures/CharacterSnapshotData.cs +30 -41
  44. package/Runtime/Code/VoxelWorld/Resources/VoxelWorldMatURP.mat +3 -3
  45. package/Runtime/Code/VoxelWorld/VoxelBlocks.cs +3 -0
  46. package/Runtime/Code/VoxelWorld/VoxelMeshProcessor.cs +4 -0
  47. package/Runtime/Code/VoxelWorld/VoxelWorld.cs +125 -95
  48. package/Runtime/Code/VoxelWorld/VoxelWorldChunk.cs +4 -1
  49. package/Runtime/Code/VoxelWorld/VoxelWorldEditorConfig.cs +13 -0
  50. package/Runtime/Code/VoxelWorld/VoxelWorldEditorConfig.cs.meta +3 -0
  51. package/Runtime/Code/VoxelWorld/VoxelWorldNetworker.cs +2 -0
  52. package/Runtime/Scenes/CoreScene.unity +261 -648
  53. package/ThirdParty/UiRoundedCorners/ImageWithIndependentRoundedCorners.cs +1 -0
  54. package/ThirdParty/UiRoundedCorners/ImageWithRoundedCorners.cs +1 -0
  55. package/ThirdParty/Unified-Universal-Blur-0.7.3/Runtime/UniversalBlurFeature.cs +1 -1
  56. package/ThirdParty/Unified-Universal-Blur-0.7.3/Shaders/Blur.shader +32 -0
  57. package/ThirdParty/Unified-Universal-Blur-0.7.3/Shaders/Blur.shader.meta +10 -0
  58. package/ThirdParty/Unified-Universal-Blur-0.7.3/Shaders/Common.hlsl +190 -0
  59. package/ThirdParty/Unified-Universal-Blur-0.7.3/Shaders/Common.hlsl.meta +3 -0
  60. package/ThirdParty/Unified-Universal-Blur-0.7.3/Shaders.meta +8 -0
  61. package/URP/AirshipLowestURPAsset_Renderer.asset +1 -1
  62. package/URP/AirshipMobileURPAsset.asset +2 -0
  63. package/URP/AirshipMobileURPAsset_Renderer.asset +3 -3
  64. package/URP/AirshipURPAsset.asset +3 -1
  65. package/URP/AirshipURPAsset_Renderer.asset +3 -3
  66. package/package.json +1 -1
@@ -23,7 +23,13 @@ namespace Editor.Accessories.Clothing {
23
23
  [CustomEditor(typeof(PlatformGearBundleManifest))]
24
24
  [CanEditMultipleObjects]
25
25
  public class PlatformGearBundleManifestEditor : UnityEditor.Editor {
26
+ #if AIRSHIP_STAGING
27
+ private static string easyOrgId = "6536df9f3843ac629cf3b8b1";
28
+ private static string defaultImageId = "b5f260d4-2678-4255-b9bd-9136dd3edf36";
29
+ #else
26
30
  private static string easyOrgId = "6b62d6e3-9d74-449c-aeac-b4feed2012b1";
31
+ private static string defaultImageId = "64351892-40d4-409b-ab3a-501818213b50";
32
+ #endif
27
33
  private bool skipBuild = false;
28
34
 
29
35
  [MenuItem("Airship/Internal/Publish All Platform Gear")]
@@ -140,7 +146,7 @@ namespace Editor.Accessories.Clothing {
140
146
  // Create a new class id
141
147
  var data = JsonUtility.ToJson(new GearCreateRequest() {
142
148
  name = gear.name,
143
- imageId = "64351892-40d4-409b-ab3a-501818213b50",
149
+ imageId = defaultImageId,
144
150
  description = "Clothing",
145
151
  airAssets = new string[] { },
146
152
  category = category,
@@ -5,6 +5,7 @@ using System.IO;
5
5
  using System.Linq;
6
6
  using Code.Bootstrap;
7
7
  using Editor.Packages;
8
+ using Editor.Publish.Callback;
8
9
  using UnityEditor.Build.Pipeline;
9
10
  using UnityEditor.Build.Pipeline.Interfaces;
10
11
  using UnityEditor.Build.Pipeline.Tasks;
@@ -197,7 +198,11 @@ public static class CreateAssetBundles {
197
198
  assetGuids.AddRange(urpGuids);
198
199
  });
199
200
 
201
+
200
202
  if (!compileURPShaders) {
203
+ // This adds a reference to Core's URP shaders which will prevent them from being duplicated
204
+ // in the game's bundle. Note that these URP shaders are hardcoded to not compile in the Scriptable
205
+ // Build Pipeline source in this scenario.
201
206
  Debug.Log("Adding URP assets to CoreMaterials bundle.");
202
207
  addUrpFiles("Packages/com.unity.render-pipelines.universal/Shaders");
203
208
  addUrpFiles("Packages/com.unity.render-pipelines.universal/ShaderLibrary");
@@ -340,9 +345,7 @@ public static class CreateAssetBundles {
340
345
  addressableNames = addressableNames
341
346
  };
342
347
  builds.Add(build);
343
- } else {
344
- if (assetBundleName != "shared/resources") continue;
345
-
348
+ } else if (assetBundleName == "shared/resources") {
346
349
  var assetGuids = AssetDatabase.FindAssets("*", new string[] {"Assets/Resources"}).ToHashSet();
347
350
  if (AssetDatabase.AssetPathExists("Assets/Airship.asbuildinfo")) {
348
351
  assetGuids.Add(AssetDatabase.AssetPathToGUID("Assets/Airship.asbuildinfo"));
@@ -412,14 +415,6 @@ public static class CreateAssetBundles {
412
415
  buildParams.BundleCompression = BuildCompression.LZ4;
413
416
  var buildContent = new BundleBuildContent(builds);
414
417
 
415
- // Debug.Log("Additional files:");
416
- // foreach (var pair in buildContent.AdditionalFiles) {
417
- // Debug.Log(pair.Key + ":");
418
- // foreach (var p in pair.Value) {
419
- // Debug.Log(" - " + p.fileAlias);
420
- // }
421
- // }
422
-
423
418
  ContentPipeline.BuildCallbacks.PostPackingCallback = (parameters, data, arg3) => {
424
419
  return ReturnCode.Success;
425
420
  };
@@ -427,6 +422,9 @@ public static class CreateAssetBundles {
427
422
  AirshipPackagesWindow.buildingPackageId = "game";
428
423
  buildingBundles = true;
429
424
  AirshipScriptableBuildPipelineConfig.buildingGameBundles = true;
425
+ // Allow other logic to hook into pre build game bundles (used for setting up scriptable shader
426
+ // scripting based on target).
427
+ BuildAirshipGameBundleProcessor.InvokePreBuildGameBundle(buildTarget);
430
428
  ReturnCode returnCode = ContentPipeline.BuildAssetBundles(buildParams, buildContent, out var result);
431
429
  buildingBundles = false;
432
430
  AirshipScriptableBuildPipelineConfig.buildingGameBundles = false;
@@ -0,0 +1,49 @@
1
+ using System;
2
+ using System.Collections.Generic;
3
+ using System.Linq;
4
+ using System.Reflection;
5
+ using UnityEditor;
6
+ using UnityEditor.Build;
7
+ using UnityEngine;
8
+
9
+ namespace Editor.Publish.Callback {
10
+ public interface IBuildAirshipGameBundle : IOrderedCallback {
11
+ /// <summary>
12
+ /// Fired before building asset bundles for game
13
+ /// </summary>
14
+ void OnPreBuildGameBundle(BuildTarget buildTarget);
15
+ }
16
+
17
+ [InitializeOnLoad]
18
+ public static class BuildAirshipGameBundleProcessor {
19
+ private static List<IBuildAirshipGameBundle> callbacks;
20
+
21
+ static BuildAirshipGameBundleProcessor() {
22
+ callbacks = GetCallbackInstances();
23
+ }
24
+
25
+ public static void InvokePreBuildGameBundle(BuildTarget target) {
26
+ foreach (var callback in callbacks) {
27
+ try {
28
+ callback.OnPreBuildGameBundle(target);
29
+ } catch (Exception e) {
30
+ Debug.LogError(e);
31
+ }
32
+ }
33
+ }
34
+
35
+ /// <summary>
36
+ /// Create instances of each implementation of IBuildAirshipGameBundle
37
+ /// </summary>
38
+ private static List<IBuildAirshipGameBundle> GetCallbackInstances() {
39
+ var instances = new List<IBuildAirshipGameBundle>();
40
+
41
+ var derivedTypes = TypeCache.GetTypesDerivedFrom<IBuildAirshipGameBundle>();
42
+ foreach (var type in derivedTypes) {
43
+ var instance = (IBuildAirshipGameBundle) Activator.CreateInstance(type);
44
+ instances.Add(instance);
45
+ }
46
+ return instances.OrderBy(i => i.callbackOrder).ToList();
47
+ }
48
+ }
49
+ }
@@ -0,0 +1,3 @@
1
+ fileFormatVersion: 2
2
+ guid: f2e2ed287f3d4bf3b9c35d62abcf1ae0
3
+ timeCreated: 1762807654
@@ -0,0 +1,3 @@
1
+ fileFormatVersion: 2
2
+ guid: e745493002eb40668673cc8bce661f2f
3
+ timeCreated: 1762807626
@@ -51,21 +51,7 @@ public class Deploy {
51
51
  // Sort the current platform first to speed up build time
52
52
  List<AirshipPlatform> platforms = new();
53
53
 
54
- #if UNITY_EDITOR_OSX
55
- platforms.Add(AirshipPlatform.Windows);
56
- platforms.Add(AirshipPlatform.Mac);
57
- #else
58
- platforms.Add(AirshipPlatform.Windows);
59
- platforms.Add(AirshipPlatform.Mac);
60
- #endif
61
-
62
- var gameConfig = GameConfig.Load();
63
- if (gameConfig.supportsMobile) {
64
- platforms.Add(AirshipPlatform.iOS);
65
- platforms.Add(AirshipPlatform.Android);
66
- }
67
-
68
- EditorCoroutines.Execute((BuildAndDeploy(platforms.ToArray(), false)));
54
+ EditorCoroutines.Execute(BuildAndDeploy());
69
55
  }
70
56
 
71
57
  [MenuItem("Airship/Misc/Build Game Asset Bundle")]
@@ -86,12 +72,8 @@ public class Deploy {
86
72
  }
87
73
 
88
74
  [MenuItem("Airship/Publish Game (No Cache)", priority = 51)]
89
- public static void PublishWithoutCache()
90
- {
91
- // Make sure we generate and write all `NetworkPrefabCollection`s before we
92
- // build the game.
93
- // NetworkPrefabManager.WriteAllCollections();
94
- EditorCoroutines.Execute((BuildAndDeploy(AirshipPlatformUtil.livePlatforms, false, false)));
75
+ public static void PublishWithoutCache() {
76
+ EditorCoroutines.Execute(BuildAndDeploy(false, false));
95
77
  }
96
78
 
97
79
  private static string GetDeployKey(DeployAuthType authType) {
@@ -106,6 +88,28 @@ public class Deploy {
106
88
  throw new Exception($"[Airship] Unknown auth type: {authType}");
107
89
  }
108
90
 
91
+ /// <summary>
92
+ /// BuildAndDeploy with the target platforms defined in GameConfig. Should only be used in asset deployments
93
+ /// (not code only).
94
+ /// </summary>
95
+ private static IEnumerator BuildAndDeploy(bool skipBuild = false, bool useCache = true, bool dontUpload = false) {
96
+ var platforms = new List<AirshipPlatform>();
97
+ #if UNITY_EDITOR_OSX
98
+ platforms.Add(AirshipPlatform.Windows);
99
+ platforms.Add(AirshipPlatform.Mac);
100
+ #else
101
+ platforms.Add(AirshipPlatform.Windows);
102
+ platforms.Add(AirshipPlatform.Mac);
103
+ #endif
104
+
105
+ var gameConfig = GameConfig.Load();
106
+ if (gameConfig.supportsMobile) {
107
+ platforms.Add(AirshipPlatform.iOS);
108
+ platforms.Add(AirshipPlatform.Android);
109
+ }
110
+ return BuildAndDeploy(platforms.ToArray(), skipBuild, useCache, dontUpload);
111
+ }
112
+
109
113
  private static IEnumerator BuildAndDeploy(AirshipPlatform[] platforms, bool skipBuild = false, bool useCache = true, bool dontUpload = false) {
110
114
  var possibleKeys = new List<string> { GetDeployKey(DeployAuthType.DeployKey), GetDeployKey(DeployAuthType.EditorAuthToken) };
111
115
  possibleKeys.RemoveAll(string.IsNullOrEmpty);
@@ -345,6 +349,9 @@ public class Deploy {
345
349
  var success = CreateAssetBundles.BuildPlatforms(platforms, useCache);
346
350
  if (!success) {
347
351
  Debug.Log("Cancelled publish.");
352
+
353
+ // Switch back to starting build target
354
+ EditorUserBuildSettings.SwitchActiveBuildTarget(startingBuildGroup, startingBuildTarget);
348
355
  yield break;
349
356
  }
350
357
 
@@ -1,6 +1,7 @@
1
1
  #if UNITY_EDITOR
2
2
  using System;
3
3
  using UnityEditor;
4
+ using UnityEditor.Build;
4
5
  using UnityEngine;
5
6
  using UnityEngine.Rendering;
6
7
  using UnityEngine.Rendering.Universal;
@@ -16,7 +17,14 @@ namespace Editor.Quality {
16
17
  [MenuItem("Airship/Quality/Config Mobile")]
17
18
  #endif
18
19
  public static void ConfigureLowQualityLevel() {
19
- SwapToQualityLevel(LOW_QUALITY_NAME);
20
+ var index = GetOrCreateQualityLevel(LOW_QUALITY_NAME);
21
+ // Switch to it so QualitySettings.* edits apply to the right level
22
+ QualitySettings.SetQualityLevel(index, true);
23
+ ConfigureSupportedPlatforms(index,
24
+ new []{ NamedBuildTarget.Android, NamedBuildTarget.iOS, },
25
+ new []{ NamedBuildTarget.Standalone }
26
+ );
27
+
20
28
  ConfigureForLow();
21
29
  SaveChangesToQualitySettings();
22
30
  }
@@ -25,11 +33,31 @@ namespace Editor.Quality {
25
33
  [MenuItem("Airship/Quality/Config Normal")]
26
34
  #endif
27
35
  public static void ConfigureNormalQualityLevel() {
28
- SwapToQualityLevel(NORMAL_QUALITY_NAME);
36
+ var index = GetOrCreateQualityLevel(NORMAL_QUALITY_NAME);
37
+ // Switch to it so QualitySettings.* edits apply to the right level
38
+ QualitySettings.SetQualityLevel(index, true);
39
+ ConfigureSupportedPlatforms(index,
40
+ new []{ NamedBuildTarget.Standalone },
41
+ new []{ NamedBuildTarget.Android, NamedBuildTarget.iOS, }
42
+ );
43
+
29
44
  ConfigureForNormal();
30
45
  SaveChangesToQualitySettings();
31
46
  }
32
47
 
48
+ private static void ConfigureSupportedPlatforms(int index, NamedBuildTarget[] included, NamedBuildTarget[] excluded) {
49
+ foreach (var target in included) {
50
+ if (!QualitySettings.TryIncludePlatformAt(target.TargetName, index, out var ex)) {
51
+ Debug.LogError($"Failed to configure included platforms for quality level: {ex}");
52
+ }
53
+ }
54
+ foreach (var target in excluded) {
55
+ if (!QualitySettings.TryExcludePlatformAt(target.TargetName, index, out var ex)) {
56
+ Debug.LogError($"Failed to configure excluded platforms for quality level: {ex}");
57
+ }
58
+ }
59
+ }
60
+
33
61
  private static void ConfigureForLow() {
34
62
  // At a value of 1 this reduces the max texture mipmap level to half resolution.
35
63
  QualitySettings.globalTextureMipmapLimit = 1;
@@ -88,21 +116,20 @@ namespace Editor.Quality {
88
116
  pipeline.shadowCascadeCount = 2;
89
117
  pipeline.cascade4Split = new Vector3(0.067f, 0.2f, 0.467f);
90
118
  }
91
-
92
- private static void SwapToQualityLevel(string name) {
93
- int index = GetQualityIndex(name);
119
+
120
+ /// <summary>
121
+ /// Returns the index of the quality level with given name. Will create a new quality level if none
122
+ /// exist with the name.
123
+ /// </summary>
124
+ private static int GetOrCreateQualityLevel(string name) {
125
+ var index = GetQualityIndex(name);
94
126
  if (index < 0) {
95
127
  if (!TryAddQualityLevel(name, out index)) {
96
- Debug.LogError("Failed to add Mobile quality level. See console for details.");
97
- return;
128
+ throw new Exception("Failed to create quality level.");
98
129
  }
99
130
  Debug.Log($"Created quality level '{name}' at index {index}.");
100
- } else {
101
- Debug.Log($"Found existing quality level '{name}' at index {index}.");
102
131
  }
103
-
104
- // Switch to it so QualitySettings.* edits apply to the right level
105
- QualitySettings.SetQualityLevel(index, true);
132
+ return index;
106
133
  }
107
134
 
108
135
  private static void SaveChangesToQualitySettings() {
@@ -38,6 +38,7 @@ public class AirshipSettingsProvider : SettingsProvider
38
38
  private bool showAutomaticEditorIntegrations = true;
39
39
  private bool showLuauOptions = true;
40
40
  private bool showNetworkOptions = true;
41
+ private bool showVoxelWorldOptions = false;
41
42
  private bool showBetaOptions = false;
42
43
 
43
44
  bool showGithubAccessToken = false;
@@ -209,6 +210,22 @@ public class AirshipSettingsProvider : SettingsProvider
209
210
  }
210
211
  }
211
212
  EditorGUILayout.EndFoldoutHeaderGroup();
213
+
214
+ EditorGUILayout.Space();
215
+ showVoxelWorldOptions = EditorGUILayout.BeginFoldoutHeaderGroup(showVoxelWorldOptions, "Voxel World");
216
+ if (showVoxelWorldOptions) {
217
+ EditorGUILayout.HelpBox("Updating Server View Rendering requires you to restart multiplayer play mode window", MessageType.Warning);
218
+ VoxelWorldEditorConfig.instance.renderVoxelWorldInServerView = EditorGUILayout.Toggle(
219
+ new GUIContent(
220
+ "Server View Rendering",
221
+ "When enabled the Voxel World will be visible in dedicated server view. This is an editor only preference that results in worse performance (but can be useful for debugging)."
222
+ ), VoxelWorldEditorConfig.instance.renderVoxelWorldInServerView);
223
+
224
+ if (GUI.changed) {
225
+ VoxelWorldEditorConfig.instance.Modify();
226
+ }
227
+ }
228
+ EditorGUILayout.EndFoldoutHeaderGroup();
212
229
 
213
230
  // EditorGUILayout.Space();
214
231
  // showBetaOptions = EditorGUILayout.BeginFoldoutHeaderGroup(showBetaOptions, "Betas");
@@ -6,7 +6,7 @@ using UnityEngine.Scripting;
6
6
  namespace Code {
7
7
  [LuauAPI][Preserve]
8
8
  public static class AirshipConst {
9
- public const int playerVersion = 20;
9
+ public const int playerVersion = 21;
10
10
  public static readonly IReadOnlyList<string> playerFlags = new string[] {
11
11
  "SkipLoading",
12
12
  "LagCompCheckIdIsInt",
@@ -17,6 +17,6 @@ namespace Code {
17
17
  /// <summary>
18
18
  /// The server will kick clients that have a playerVersion lower than this value.
19
19
  /// </summary>
20
- public const int minAcceptedPlayerVersionOnServer = 20;
20
+ public const int minAcceptedPlayerVersionOnServer = 21;
21
21
  }
22
22
  }
@@ -52,10 +52,10 @@ namespace Code.Bootstrap {
52
52
  writer.WriteBytes(compressedBytes, 0, compressedSize);
53
53
 
54
54
  compressedFileCache.Add(cacheId, new CachedCompressedFile(compressedBytes, compressedSize));
55
+ Profiler.EndSample();
55
56
  }
56
57
 
57
58
  writer.WriteBool(file.airshipBehaviour);
58
- Profiler.EndSample();
59
59
  }
60
60
  }
61
61
  Profiler.EndSample();
@@ -14,11 +14,10 @@ public class LoadedAssetBundle {
14
14
  /// Example: "shared/resources"
15
15
  /// </summary>
16
16
  public string assetBundleFile;
17
- public LoadedAssetBundle(AirshipPackage airshipPackage, string bundleFolder, AssetBundle assetBundle, ushort netCollectionId) {
17
+ public LoadedAssetBundle(AirshipPackage airshipPackage, string bundleFolder, AssetBundle assetBundle) {
18
18
  this.airshipPackage = airshipPackage;
19
19
  this.bundleId = this.airshipPackage.id.ToLower();
20
20
  this.assetBundleFile = bundleFolder.ToLower();
21
21
  this.assetBundle = assetBundle;
22
- this.netCollectionId = netCollectionId;
23
22
  }
24
23
  }
@@ -305,82 +305,36 @@ public class SystemRoot : Singleton<SystemRoot> {
305
305
  // 0 is reserved for player prefab
306
306
  this.networkCollectionIdCounter = 1;
307
307
 
308
- // sort packages by load order
309
- List<List<IEnumerator>> loadLists = new(2);
310
- for (int i = 0; i < loadLists.Capacity; i++) {
311
- loadLists.Add(new());
312
- }
313
-
314
- List<IEnumerator> GetLoadList(AirshipPackage package) {
315
- // // Load core first because packages may depend them
316
- // if (package.id == "@Easy/CoreMaterials" || package.id == "@Easy/Core") {
317
- // return loadLists[0];
318
- // }
319
-
320
- // All packages first
321
- if (package.packageType == AirshipPackageType.Package) {
322
- return loadLists[0];
323
- }
324
-
325
- // Games go last
326
- return loadLists[1];
327
- }
308
+ List<IEnumerator> loadList = new List<IEnumerator>();
328
309
 
329
310
  // Find packages to load
330
311
  AssetBridge.useBundles = useUnityAssetBundles;
331
312
  if (useUnityAssetBundles) {
332
- // Resources
333
- foreach (var package in packages) {
334
- GetLoadList(package).Add(LoadSingleAssetBundleFromAirshipPackage(package, "shared/resources", this.networkCollectionIdCounter));
335
- this.networkCollectionIdCounter++;
336
- }
337
- // foreach (var package in packages) {
338
- // GetLoadList(package).Add(LoadSingleAssetBundleFromAirshipPackage(package, "client/resources", this.networkCollectionIdCounter));
339
- // this.networkCollectionIdCounter++;
340
- // }
313
+ // Create a list of tasks that load each game & package asset bundle
341
314
  foreach (var package in packages) {
315
+ loadList.Add(LoadSingleAssetBundleFromAirshipPackage(package, "shared/resources"));
342
316
  if (RunCore.IsServer()) {
343
- GetLoadList(package).Add(LoadSingleAssetBundleFromAirshipPackage(package, "server/resources", this.networkCollectionIdCounter));
317
+ loadList.Add(LoadSingleAssetBundleFromAirshipPackage(package, "server/resources"));
344
318
  }
345
- this.networkCollectionIdCounter++;
346
- }
347
-
348
- // Scenes
349
- foreach (var package in packages) {
350
- GetLoadList(package).Add(LoadSingleAssetBundleFromAirshipPackage(package, "shared/scenes", this.networkCollectionIdCounter));
351
- this.networkCollectionIdCounter++;
319
+ loadList.Add(LoadSingleAssetBundleFromAirshipPackage(package, "shared/scenes"));
352
320
  }
353
- // foreach (var package in packages) {
354
- // GetLoadList(package).Add(LoadSingleAssetBundleFromAirshipPackage(package, "client/scenes", this.networkCollectionIdCounter));
355
- // this.networkCollectionIdCounter++;
356
- // }
357
- // foreach (var package in packages) {
358
- // if (RunCore.IsServer()) {
359
- // GetLoadList(package).Add(LoadSingleAssetBundleFromAirshipPackage(package, "server/scenes", this.networkCollectionIdCounter));
360
- // }
361
- // this.networkCollectionIdCounter++;
362
- // }
363
-
364
- #if AIRSHIP_PLAYER || true
365
- try {
366
- // Debug.Log("Scanning network prefabs...");
367
- Debug.Log($"Listing {NetworkClient.prefabs.Count} network prefabs:");
368
- int i = 1;
369
- foreach (var pair in NetworkClient.prefabs) {
370
- if (pair.Value != null) {
371
- Debug.Log($" {i}. {pair.Value.name} ({pair.Key})");
372
- i++;
373
- }
321
+
322
+ // Load asset bundles
323
+ // We are OK to load all asset bundles at the same time. Asset dependencies are only relevant
324
+ // when we actually load assets from a bundle, at which point all dependant assets need to be
325
+ // in loaded asset bundles.
326
+ Debug.Log("Loading asset bundles...");
327
+ yield return this.WaitAll(loadList.GetEnumerator());
328
+
329
+ // Load all network prefab collections once all asset bundles have loaded
330
+ var doNetworkPrefabLoading = !RunCore.IsClient() || NetworkClient.isConnected; // Don't load in menu
331
+ if (doNetworkPrefabLoading) {
332
+ foreach (var bundleInfo in this.loadedAssetBundles.Values) {
333
+ bundleInfo.netCollectionId = networkCollectionIdCounter++;
334
+ yield return networkNetworkPrefabLoader.RegisterNetworkObjects(bundleInfo.assetBundle,
335
+ bundleInfo.netCollectionId);
374
336
  }
375
- } catch (Exception e) {
376
- Debug.LogException(e);
377
337
  }
378
- #endif
379
-
380
- Debug.Log("Loading packages...");
381
- yield return this.WaitAll(loadLists[0].ToArray());
382
- Debug.Log("Loading game...");
383
- yield return this.WaitAll(loadLists[1].ToArray());
384
338
 
385
339
  if (!disableCoreMaterialsBundle) {
386
340
  foreach (var ao in this.extraBundleLoadRequests) {
@@ -548,29 +502,12 @@ public class SystemRoot : Singleton<SystemRoot> {
548
502
  return package.id + "_" + assetBundleFile;
549
503
  }
550
504
 
551
- private IEnumerator LoadSingleAssetBundleFromAirshipPackage(AirshipPackage airshipPackage, string assetBundleFile, ushort netCollectionId) {
552
- // ReSharper disable once ReplaceWithSingleAssignment.True
553
- bool doNetworkPrefabLoading = true;
554
- // check if client is in the main menu
555
- if (!NetworkClient.isConnected && RunCore.IsClient()) {
556
- doNetworkPrefabLoading = false;
557
- }
558
-
559
- string assetBundleId = GetLoadedAssetBundleKey(airshipPackage, assetBundleFile);
560
- if (this.loadedAssetBundles.ContainsKey(assetBundleId)) {
561
- // Debug.Log($"AssetBundle \"{assetBundleId}\" was already loaded. Skipping load.");
562
- var existingBundle = this.loadedAssetBundles[assetBundleId];
563
- if (doNetworkPrefabLoading) {
564
- existingBundle.netCollectionId = netCollectionId;
565
- yield return networkNetworkPrefabLoader.RegisterNetworkObjects(existingBundle.assetBundle, netCollectionId);
566
- }
567
- yield break;
568
- }
569
-
570
- string bundleFilePath = Path.Join(airshipPackage.GetPersistentDataDirectory(AirshipPlatformUtil.GetLocalPlatform()), assetBundleFile);
505
+ private IEnumerator LoadSingleAssetBundleFromAirshipPackage(AirshipPackage airshipPackage, string assetBundleFile) {
506
+ var assetBundleId = GetLoadedAssetBundleKey(airshipPackage, assetBundleFile);
507
+ var bundleFilePath = Path.Join(airshipPackage.GetPersistentDataDirectory(AirshipPlatformUtil.GetLocalPlatform()), assetBundleFile);
508
+ if (loadedAssetBundles.ContainsKey(assetBundleId)) yield break;
571
509
 
572
510
  if (!File.Exists(bundleFilePath) || !File.Exists(bundleFilePath + "_downloadSuccess.txt")) {
573
- // Debug.Log($"Bundle file did not exist \"{bundleFilePath}\". skipping.");
574
511
  yield break;
575
512
  }
576
513
 
@@ -601,12 +538,8 @@ public class SystemRoot : Singleton<SystemRoot> {
601
538
  // Debug.Log("");
602
539
  #endif
603
540
 
604
- var loadedAssetBundle = new LoadedAssetBundle(airshipPackage, assetBundleFile, assetBundle, netCollectionId);
541
+ var loadedAssetBundle = new LoadedAssetBundle(airshipPackage, assetBundleFile, assetBundle);
605
542
  loadedAssetBundles.Add(assetBundleId, loadedAssetBundle);
606
-
607
- if (doNetworkPrefabLoading) { // InstanceFinder.IsOffline && RunCore.IsClient()
608
- yield return networkNetworkPrefabLoader.RegisterNetworkObjects(assetBundle, netCollectionId);
609
- }
610
543
  }
611
544
 
612
545
  private void RegisterCommands() {
@@ -0,0 +1,21 @@
1
+ using Code.Bundles;
2
+ using TMPro;
3
+ using UnityEngine;
4
+
5
+ namespace Code.CoreUI.Components {
6
+ public class AirshipVersionOverlay : MonoBehaviour {
7
+ public TMP_Text versionText;
8
+
9
+ private void Start() {
10
+ #if !AIRSHIP_PLAYER
11
+ if (Application.isEditor) {
12
+ this.versionText.gameObject.SetActive(false);
13
+ return;
14
+ }
15
+ #endif
16
+
17
+ var hash = AirshipVersion.GetVersionHash();
18
+ this.versionText.text = Application.version + "-" + hash;
19
+ }
20
+ }
21
+ }
@@ -0,0 +1,3 @@
1
+ fileFormatVersion: 2
2
+ guid: cc41e11900334dc284bc9b2dd63d0ed7
3
+ timeCreated: 1762977812
@@ -4,6 +4,7 @@ using System.Runtime.InteropServices;
4
4
  using Mirror;
5
5
  using Code.Util;
6
6
  using Code.Zstd;
7
+ using UnityEngine;
7
8
 
8
9
  namespace Assets.Luau {
9
10
  [Serializable]
@@ -100,7 +101,7 @@ namespace Assets.Luau {
100
101
  NetworkWriterPool.Return(writer);
101
102
  NetworkWriterPool.Return(changedByteWriter);
102
103
 
103
- // Debug.Log($"Final diff is {bytes.Length} bytes");
104
+ // Debug.Log($"Final diff is {bytes.Length} bytes. Base data was {Data.Length}, new data was {other.Data.Length}. Change bytes: {changeBytes.Length}, Change data: {newByteValues.Length}");
104
105
  return bytes;
105
106
  }
106
107
 
@@ -305,13 +305,10 @@ public partial class LuauCore : MonoBehaviour {
305
305
  // }
306
306
  // runBuffer.Clear();
307
307
 
308
- Profiler.BeginSample("ResumeCompletedTasks");
309
308
  try {
310
309
  ResumeCompletedTasks();
311
310
  } catch (Exception err) {
312
311
  Debug.LogError(err);
313
- } finally {
314
- Profiler.EndSample();
315
312
  }
316
313
 
317
314
  //Run all pending callbacks
@@ -703,6 +703,9 @@ public partial class LuauCore : MonoBehaviour {
703
703
  }
704
704
  }
705
705
 
706
+ /// <summary>
707
+ /// Returns field value for a blittable object by directly accessing memory. Won't work for managed types.
708
+ /// </summary>
706
709
  private static unsafe T GetFieldValue<T>(object instance, FieldInfo fieldInfo) where T : unmanaged {
707
710
  var addr = UnsafeUtility.PinGCObjectAndGetAddress(instance, out ulong handle);
708
711
  try {
@@ -1120,6 +1123,8 @@ public partial class LuauCore : MonoBehaviour {
1120
1123
  if (cacheData.memberInfo is not FieldInfo fieldInfo) throw new Exception("FastGetAndWriteValueField must be called with FieldInfo.");
1121
1124
 
1122
1125
  var fieldType = cacheData.memberType;
1126
+ // GetFieldValue only works reliably with blittable types
1127
+ if (!UnsafeUtility.IsBlittable(cacheData.objectType)) return false;
1123
1128
 
1124
1129
  if (fieldType == intType) {
1125
1130
  var intValue = GetFieldValue<int>(objectReference, fieldInfo);
@@ -350,13 +350,18 @@ public class GameObjectAPI : BaseLuaAPIClass {
350
350
  var gameObject = (GameObject)targetObject;
351
351
 
352
352
  Type objectType = LuauCore.CoreInstance.GetTypeFromString(typeName);
353
- if (objectType == null)
354
- {
353
+ if (objectType == null) {
355
354
  ThreadDataManager.Error(thread);
356
355
  Debug.LogError("Error: GetComponentsInChildren component type not found: " + typeName + " (consider registering it?)");
357
356
  return 0;
358
357
  }
359
- var results = gameObject.GetComponentsInChildren(objectType);
358
+
359
+ var includeInactive = false;
360
+ if (numParameters >= 2) {
361
+ includeInactive = LuauCore.GetParameterAsBool(1, numParameters, parameterDataPODTypes, parameterDataPtrs, parameterDataSizes, out _);
362
+ }
363
+
364
+ var results = gameObject.GetComponentsInChildren(objectType, includeInactive);
360
365
  LuauCore.WritePropertyToThread(thread, results, typeof(Component[]));
361
366
  return 1;
362
367
  }
@@ -380,7 +385,13 @@ public class GameObjectAPI : BaseLuaAPIClass {
380
385
  Debug.LogError("Error: GetComponentsInParent component type not found: " + typeName + " (consider registering it?)");
381
386
  return 0;
382
387
  }
383
- var results = gameObject.GetComponentsInParent(objectType);
388
+
389
+ var includeInactive = false;
390
+ if (numParameters >= 2) {
391
+ includeInactive = LuauCore.GetParameterAsBool(1, numParameters, parameterDataPODTypes, parameterDataPtrs, parameterDataSizes, out _);
392
+ }
393
+
394
+ var results = gameObject.GetComponentsInParent(objectType, includeInactive);
384
395
  LuauCore.WritePropertyToThread(thread, results, typeof(Component[]));
385
396
  return 1;
386
397
  }