gg.easy.airship 0.1.2176 → 0.1.2178

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 (122) hide show
  1. package/Editor/Accessories/Clothing/PlatformGearBundleManifestEditor.cs +2 -2
  2. package/Editor/AirshipComponentEditor.cs +2 -2
  3. package/Editor/Build/AutoIncrementIOSBuildNumber.cs +26 -0
  4. package/Editor/Build/AutoIncrementIOSBuildNumber.cs.meta +2 -0
  5. package/Editor/BuildMenu.cs +1 -3
  6. package/Editor/CreateAssetBundles.cs +4 -15
  7. package/Editor/Easy.Airship.Editor.asmdef +3 -3
  8. package/Editor/GameConfig/EditorGameConfigSerializer.cs +33 -0
  9. package/Editor/GameConfig/EditorGameConfigSerializer.cs.meta +3 -0
  10. package/Editor/Packages/AirshipPackagesWindow.cs +5 -2
  11. package/Editor/Publish/Deploy.cs +17 -7
  12. package/Editor/Util/LuauReflectionGenerator.cs +2 -1
  13. package/Generator/LuauDirectCallbackGenerator.dll +0 -0
  14. package/Generator/LuauDirectCallbackGenerator.dll.meta +67 -0
  15. package/Generator.meta +8 -0
  16. package/Runtime/Code/Airship/Resources/Scripts/Editor/Airship.Airship.Editor.asmdef +4 -3
  17. package/Runtime/Code/Bootstrap/ClientBundleLoader.cs +3 -2
  18. package/Runtime/Code/Bootstrap/ServerBootstrap.cs +49 -20
  19. package/Runtime/Code/Bootstrap/SignalHandler.cs +3 -5
  20. package/Runtime/Code/Bundles/Airship.Bundles.asmdef +9 -2
  21. package/Runtime/Code/Components/DynamicVariables/Airship.DynamicVariables.asmdef +3 -1
  22. package/Runtime/Code/Components/DynamicVariables/GameObjectReferences.cs +3 -1
  23. package/Runtime/Code/Components/WorldSpaceScreenScaler.cs +81 -0
  24. package/Runtime/Code/Components/WorldSpaceScreenScaler.cs.meta +3 -0
  25. package/Runtime/Code/Core/Airship.Core.asmdef +4 -1
  26. package/Runtime/Code/CoreUI/Login/LoginApp.cs +10 -1
  27. package/Runtime/Code/DeveloperTooling/EasyDestroy.cs +11 -8
  28. package/Runtime/Code/DeveloperTooling/EasyGridAlign.cs +19 -13
  29. package/Runtime/Code/DeveloperTooling/EasyLookAt.cs +11 -8
  30. package/Runtime/Code/DeveloperTooling/EasyTransformAnchor.cs +1 -0
  31. package/Runtime/Code/Easy.Airship.asmdef +3 -3
  32. package/Runtime/Code/GameConfig/GameConfig.cs +186 -50
  33. package/Runtime/Code/Luau/Airship.LuauCore.asmdef +7 -1
  34. package/Runtime/Code/Luau/AirshipComponent.cs +2 -1
  35. package/Runtime/Code/Luau/AirshipScript.cs +5 -0
  36. package/Runtime/Code/Luau/Editor/LuauEditorUtilities.cs +2 -1
  37. package/Runtime/Code/Luau/{BaseLuaAPI.cs → LuauAssembly/BaseLuaAPI.cs} +5 -3
  38. package/Runtime/Code/Luau/LuauAssembly/LuauAPI.asmdef +17 -13
  39. package/Runtime/Code/Luau/LuauAssembly/LuauAPI.cs +5 -5
  40. package/Runtime/Code/Luau/LuauAssembly/LuauContext.cs +1 -1
  41. package/Runtime/Code/Luau/LuauAssembly/PodType.cs +25 -0
  42. package/Runtime/Code/Luau/LuauAssembly/PodType.cs.meta +3 -0
  43. package/Runtime/Code/Luau/LuauAssembly/Protection/LuauProtection.cs +94 -0
  44. package/Runtime/Code/Luau/LuauAssembly/Protection/LuauProtection.cs.meta +3 -0
  45. package/Runtime/Code/Luau/LuauAssembly/Protection.meta +3 -0
  46. package/Runtime/Code/Luau/LuauCore.cs +5 -81
  47. package/Runtime/Code/Luau/LuauCoreCallbacks.cs +82 -58
  48. package/Runtime/Code/Luau/LuauCoreReflection.cs +189 -118
  49. package/Runtime/Code/Luau/LuauDirectCallbacks.cs +19 -0
  50. package/Runtime/Code/Luau/LuauDirectCallbacks.cs.meta +3 -0
  51. package/Runtime/Code/Luau/LuauMetadata.cs +17 -10
  52. package/Runtime/Code/Luau/LuauMetadataPropertySerializer.cs +27 -4
  53. package/Runtime/Code/Luau/LuauPlugin.cs +2 -1
  54. package/Runtime/Code/Luau/LuauSignalWrapper.cs +45 -19
  55. package/Runtime/Code/Luau/LuauStringPool.cs +35 -52
  56. package/Runtime/Code/Luau/ReflectionList.cs +1 -0
  57. package/Runtime/Code/Luau/RendererAPI.cs +2 -2
  58. package/Runtime/Code/Luau/UnityCustomAPI.cs +2 -2
  59. package/Runtime/Code/LuauAPI/AnimatorOverrideControllerAPI.cs +1 -1
  60. package/Runtime/Code/LuauAPI/Bridge.cs +25 -9
  61. package/Runtime/Code/LuauAPI/CharacterControllerAPI.cs +1 -1
  62. package/Runtime/Code/LuauAPI/ColliderAPI.cs +1 -1
  63. package/Runtime/Code/LuauAPI/EventSystemAPI.cs +1 -1
  64. package/Runtime/Code/LuauAPI/FrameTimingManagerAPI.cs +3 -3
  65. package/Runtime/Code/LuauAPI/GameObjectAPI.cs +15 -14
  66. package/Runtime/Code/LuauAPI/GradientAPI.cs +3 -3
  67. package/Runtime/Code/LuauAPI/InputAPI.cs +2 -2
  68. package/Runtime/Code/LuauAPI/LagCompensatorAPI.cs +2 -2
  69. package/Runtime/Code/LuauAPI/LayerMaskAPI.cs +21 -17
  70. package/Runtime/Code/LuauAPI/NavMeshAPI.cs +4 -4
  71. package/Runtime/Code/LuauAPI/ObjectAPI.cs +4 -3
  72. package/Runtime/Code/LuauAPI/ParticleSystemAPI.cs +3 -3
  73. package/Runtime/Code/LuauAPI/PhysicsAPI.cs +11 -12
  74. package/Runtime/Code/LuauAPI/RigidbodyAPI.cs +2 -2
  75. package/Runtime/Code/LuauAPI/ScreenAPI.cs +2 -2
  76. package/Runtime/Code/LuauAPI/ScreenCaptureAPI.cs +2 -2
  77. package/Runtime/Code/LuauAPI/SplineUtilityAPI.cs +1 -1
  78. package/Runtime/Code/LuauAPI/StyleColorAPI.cs +1 -1
  79. package/Runtime/Code/LuauAPI/TerrainDataAPI.cs +2 -2
  80. package/Runtime/Code/LuauAPI/Texture2DAPI.cs +9 -0
  81. package/Runtime/Code/LuauAPI/Texture2DAPI.cs.meta +3 -0
  82. package/Runtime/Code/LuauAPI/Texture2DArrayAPI.cs +9 -0
  83. package/Runtime/Code/LuauAPI/Texture2DArrayAPI.cs.meta +3 -0
  84. package/Runtime/Code/LuauAPI/TransformAPI.cs +6 -6
  85. package/Runtime/Code/LuauAPI/VisualElementAPI.cs +2 -2
  86. package/Runtime/Code/LuauAPI/VolumeProfileAPI.cs +3 -3
  87. package/Runtime/Code/LuauAPI/WheelColliderAPI.cs +1 -1
  88. package/Runtime/Code/LuauHelper/LuauHelper.cs +17 -14
  89. package/Runtime/Code/Network/AirshipNetworkManager.cs +2 -1
  90. package/Runtime/Code/PoolManager/Airship.PoolManager.asmdef +0 -1
  91. package/Runtime/Code/PoolManager/PoolManager.cs +3 -2
  92. package/Runtime/Code/ProjectSetup/Editor/SetupManager.cs +2 -4
  93. package/Runtime/Code/ProjectSetup/PhysicsSetup.cs +95 -26
  94. package/Runtime/Code/Steam/SteamLuauAPI.cs +3 -0
  95. package/Runtime/Code/TSCodeGen/Editor/CsToTs/CsToTs.asmdef +0 -1
  96. package/Runtime/Code/TSCodeGen/TypeGenerator.cs +14 -0
  97. package/Runtime/Code/VoxelWorld/Airship.VoxelWorld.asmdef +11 -4
  98. package/Runtime/Code/VoxelWorld/Editor/Airship.VoxelWorld.Editor.asmdef +2 -1
  99. package/Runtime/DevConsole/Runtime/Airship.DevConsole.asmdef +3 -1
  100. package/Runtime/Plugins/Android/libLuauPlugin.so +0 -0
  101. package/Runtime/Plugins/Linux/libLuauPlugin.so +0 -0
  102. package/Runtime/Plugins/Mac/LuauPlugin.bundle/Contents/MacOS/LuauPlugin +0 -0
  103. package/Runtime/Plugins/Windows/x64/LuauPlugin.dll +0 -0
  104. package/Runtime/Plugins/iOS/LuauPluginIos.a +0 -0
  105. package/Runtime/Scenes/Login.unity +372 -372
  106. package/ThirdParty/Agones/AgonesSdk.cs +3 -1
  107. package/ThirdParty/UiRoundedCorners/Editor/Nobi.UiRoundedCorners.Editor.asmdef +4 -1
  108. package/ThirdParty/UiRoundedCorners/Nobi.UiRoundedCorners.asmdef +4 -1
  109. package/URP/AirshipMobileURPAsset.asset +3 -3
  110. package/URP/AirshipMobileURPAsset_Renderer.asset +1 -1
  111. package/package.json +1 -1
  112. package/Editor/Tools/HumanEntityRemapping/HumanEntityMeshRemapWindow.cs +0 -119
  113. package/Editor/Tools/HumanEntityRemapping/HumanEntityMeshRemapWindow.cs.meta +0 -11
  114. package/Runtime/Code/LuauAPI/RectAPI.cs +0 -9
  115. package/Runtime/Code/LuauAPI/RectAPI.cs.meta +0 -3
  116. /package/Runtime/Code/Luau/{AttachContext.cs → LuauAssembly/AttachContext.cs} +0 -0
  117. /package/Runtime/Code/Luau/{AttachContext.cs.meta → LuauAssembly/AttachContext.cs.meta} +0 -0
  118. /package/Runtime/Code/Luau/{BaseLuaAPI.cs.meta → LuauAssembly/BaseLuaAPI.cs.meta} +0 -0
  119. /package/Runtime/Code/Luau/{BinaryBlob.cs → LuauAssembly/BinaryBlob.cs} +0 -0
  120. /package/Runtime/Code/Luau/{BinaryBlob.cs.meta → LuauAssembly/BinaryBlob.cs.meta} +0 -0
  121. /package/Runtime/Code/Luau/{LuauBuffer.cs → LuauAssembly/LuauBuffer.cs} +0 -0
  122. /package/Runtime/Code/Luau/{LuauBuffer.cs.meta → LuauAssembly/LuauBuffer.cs.meta} +0 -0
@@ -1,4 +1,4 @@
1
- #if AIRSHIP_INTERNAL
1
+ // #if AIRSHIP_INTERNAL
2
2
  using System;
3
3
  using System.Collections.Generic;
4
4
  using System.Diagnostics;
@@ -387,4 +387,4 @@ namespace Editor.Accessories.Clothing {
387
387
  }
388
388
  }
389
389
  }
390
- #endif
390
+ // #endif
@@ -1083,10 +1083,10 @@ public class ScriptBindingEditor : UnityEditor.Editor {
1083
1083
 
1084
1084
  private void DrawCustomRectProperty(GUIContent guiContent, SerializedProperty type, SerializedProperty modifiers, SerializedProperty value, SerializedProperty modified)
1085
1085
  {
1086
- var currentValue = JsonUtility.FromJson<Rect>(value.stringValue);
1086
+ var currentValue = LuauMetadataPropertySerializer.DeserializeRect(value.stringValue);
1087
1087
  var newValue = EditorGUILayout.RectField(guiContent, currentValue);
1088
1088
  if (newValue != currentValue) {
1089
- value.stringValue = JsonUtility.ToJson(newValue);
1089
+ value.stringValue = LuauMetadataPropertySerializer.SerializeRect(newValue);
1090
1090
  modified.boolValue = true;
1091
1091
  }
1092
1092
  }
@@ -0,0 +1,26 @@
1
+ using UnityEditor;
2
+ using UnityEditor.Build;
3
+ using UnityEditor.Build.Reporting;
4
+ using UnityEngine;
5
+
6
+ namespace Editor.Build {
7
+ public class AutoIncrementIOSBuildNumber : IPreprocessBuildWithReport {
8
+ // This makes sure the script runs before the build starts.
9
+ public int callbackOrder => 0;
10
+
11
+ public void OnPreprocessBuild(BuildReport report) {
12
+ if (report.summary.platform == BuildTarget.iOS) {
13
+ // Get current build number
14
+ int currentBuild = int.Parse(PlayerSettings.iOS.buildNumber);
15
+
16
+ // Increment by 1
17
+ int newBuild = currentBuild + 1;
18
+
19
+ // Set the new build number
20
+ PlayerSettings.iOS.buildNumber = newBuild.ToString();
21
+
22
+ Debug.Log($"[iOS] Auto-incremented build number: {currentBuild} → {newBuild}");
23
+ }
24
+ }
25
+ }
26
+ }
@@ -0,0 +1,2 @@
1
+ fileFormatVersion: 2
2
+ guid: 3f671b56afeae4e4882356894b25c412
@@ -43,9 +43,7 @@ namespace Editor {
43
43
  }
44
44
 
45
45
  private static void OnBuild() {
46
- PhysicsSetup.Setup(null);
47
-
48
-
46
+ PhysicsSetup.Setup();
49
47
  }
50
48
 
51
49
  public static void BuildLinuxServerStaging() {
@@ -239,24 +239,13 @@ public static class CreateAssetBundles {
239
239
 
240
240
  public static GameConfig BuildGameConfig() {
241
241
  GameConfig gameConfig = GameConfig.Load();
242
-
243
- // Update tags
244
- var tagList = UnityEditorInternal.InternalEditorUtility.tags[7..];
245
- if (tagList.Length > GameConfig.MaximumTags) {
246
- Debug.LogError($"Maximum number of allowed unity tags in Airship is {GameConfig.MaximumTags} - you have {tagList.Length} defined.");
242
+ try {
243
+ gameConfig.SerializeSettings();
244
+ } catch (Exception ex) {
245
+ Debug.LogError("Error when copying Unity properties to GameConfig: " + ex);
247
246
  return null;
248
247
  }
249
- gameConfig.gameTags = tagList.ToArray();
250
248
 
251
- // Update layers
252
- var layers = new List<string>();
253
- for (int i = 0; i < 31; i++) {
254
- var layerName = LayerMask.LayerToName(i);
255
- layers.Add(layerName);
256
- }
257
- gameConfig.gameLayers = layers.ToArray();
258
- gameConfig.SerializeSettings();
259
-
260
249
  // Local source packages set to forceLatest
261
250
  foreach (var package in gameConfig.packages) {
262
251
  if (package.localSource) {
@@ -17,7 +17,6 @@
17
17
  "GUID:33b0850c3f930a440abe6b01a9898921",
18
18
  "GUID:5c1ff9bd975acec488150743d53a93ca",
19
19
  "GUID:c5ecc461727906345a35491a0440694f",
20
- "GUID:5966039ae77c64b44bc04472c1ae63bb",
21
20
  "GUID:894a6cc6ed5cd2645bb542978cbed6a9",
22
21
  "GUID:4c25c05f410a3a447a75c3b0909152ef",
23
22
  "GUID:7f7d1af65c2641843945d409d28f2e20",
@@ -39,7 +38,6 @@
39
38
  "GUID:36bccdedfe0feeb4daf43bef9e43b65b",
40
39
  "GUID:17013b2a21298c14ea4808251346a38a",
41
40
  "GUID:ec266f293c0b4f6c9d06847488a52a0c",
42
- "GUID:8db43d2f2329593428db90e3b3a6034c",
43
41
  "GUID:9e34ae0a5b8947247abb9d001d89e512",
44
42
  "GUID:199bc21c5ec6a3e41b1d67e225a7bd04",
45
43
  "GUID:103be11cab738ef4d849a96eca5df2eb",
@@ -67,7 +65,9 @@
67
65
  "GUID:3b5390adca4e2bb4791cb930316d6f3e",
68
66
  "GUID:725ee7191c021de4dbf9269590ded755",
69
67
  "GUID:2a0340569ab0e1245a38e0d6c7b2529b",
70
- "GUID:befe48b9a36afc04ea625c93daad910e"
68
+ "GUID:befe48b9a36afc04ea625c93daad910e",
69
+ "GUID:5966039ae77c64b44bc04472c1ae63bb",
70
+ "GUID:8db43d2f2329593428db90e3b3a6034c"
71
71
  ],
72
72
  "includePlatforms": [
73
73
  "Editor"
@@ -0,0 +1,33 @@
1
+ using System;
2
+ using System.Diagnostics;
3
+ using UnityEditor;
4
+ using UnityEngine;
5
+ using Debug = UnityEngine.Debug;
6
+
7
+ [InitializeOnLoad]
8
+ public class EditorGameConfigSerializer {
9
+ static EditorGameConfigSerializer() {
10
+ #if !AIRSHIP_PLAYER
11
+ EditorApplication.playModeStateChanged += OnPlayModeStateChanged;
12
+ #endif
13
+ }
14
+
15
+ private static void OnPlayModeStateChanged(PlayModeStateChange stateChange) {
16
+ if (stateChange == PlayModeStateChange.ExitingEditMode) {
17
+ try {
18
+ var gameConfig = GameConfig.Load();
19
+
20
+ // Only Dirty & Save GameConfig if the JSON changes. On my device takes less than 10ms if no changes
21
+ // were found. If we do have to save this takes around 80ms.
22
+ var prevHash = JsonUtility.ToJson(gameConfig).GetHashCode();
23
+ gameConfig.SerializeSettings();
24
+ if (prevHash != JsonUtility.ToJson(gameConfig).GetHashCode()) {
25
+ EditorUtility.SetDirty(gameConfig);
26
+ AssetDatabase.SaveAssetIfDirty(gameConfig);
27
+ }
28
+ } catch (Exception ex) {
29
+ Debug.LogError("Error when copying Unity properties to GameConfig: " + ex);
30
+ }
31
+ }
32
+ }
33
+ }
@@ -0,0 +1,3 @@
1
+ fileFormatVersion: 2
2
+ guid: 07c2968480ef45448314aa4eddd9cc7e
3
+ timeCreated: 1757018905
@@ -398,7 +398,7 @@ namespace Editor.Packages {
398
398
  if (isCoreMaterials) {
399
399
  platforms.Clear();
400
400
  platforms.Add(AirshipPlatform.iOS);
401
- // platforms.Add(AirshipPlatform.Android);
401
+ platforms.Add(AirshipPlatform.Android);
402
402
  // platforms.Add(AirshipPlatform.Windows);
403
403
  // platforms.Add(AirshipPlatform.Mac);
404
404
  }
@@ -451,7 +451,7 @@ namespace Editor.Packages {
451
451
  }
452
452
 
453
453
  if (platform == AirshipPlatform.iOS || platform == AirshipPlatform.Android) {
454
- CreateAssetBundles.SwapToQualityLevel("Mobile");
454
+ CreateAssetBundles.SwapToQualityLevel("Low");
455
455
  } else {
456
456
  CreateAssetBundles.SwapToQualityLevel("Normal");
457
457
  }
@@ -487,6 +487,7 @@ namespace Editor.Packages {
487
487
  yield break;
488
488
  }
489
489
 
490
+
490
491
  // var manifest = BuildPipeline.BuildAssetBundles(
491
492
  // buildPath,
492
493
  // builds.ToArray(),
@@ -500,6 +501,8 @@ namespace Editor.Packages {
500
501
  }
501
502
 
502
503
  if (isCoreMaterials) {
504
+ packageUploadProgress.Remove(packageDoc.id);
505
+ Repaint();
503
506
  yield break;
504
507
  }
505
508
 
@@ -9,6 +9,7 @@ using Airship.Editor;
9
9
  using Code.Authentication;
10
10
  using Code.Bootstrap;
11
11
  using Code.Http.Internal;
12
+ using Code.Luau.LuauAssembly.Protection;
12
13
  using Code.Platform.Shared;
13
14
  using Editor.Packages;
14
15
  using Luau;
@@ -60,6 +61,17 @@ public class Deploy {
60
61
  EditorCoroutines.Execute((BuildAndDeploy(platforms.ToArray(), false)));
61
62
  }
62
63
 
64
+ [MenuItem("Airship/Misc/Build Game Asset Bundle")]
65
+ public static void BuildGameAssetBundleForAnalysis() {
66
+ List<AirshipPlatform> platforms = new();
67
+ #if UNITY_EDITOR_OSX
68
+ platforms.Add(AirshipPlatform.Mac);
69
+ #else
70
+ platforms.Add(AirshipPlatform.Windows);
71
+ #endif
72
+ EditorCoroutines.Execute((BuildAndDeploy(platforms.ToArray(), false, true, true)));
73
+ }
74
+
63
75
  [MenuItem("Airship/Publish Game (Code Only)", priority = 50)]
64
76
  public static void DeployCodeOnly()
65
77
  {
@@ -75,7 +87,7 @@ public class Deploy {
75
87
  EditorCoroutines.Execute((BuildAndDeploy(AirshipPlatformUtil.livePlatforms, false, false)));
76
88
  }
77
89
 
78
- private static IEnumerator BuildAndDeploy(AirshipPlatform[] platforms, bool skipBuild = false, bool useCache = true) {
90
+ private static IEnumerator BuildAndDeploy(AirshipPlatform[] platforms, bool skipBuild = false, bool useCache = true, bool dontUpload = false) {
79
91
  var possibleKeys = new List<string>() { AuthConfig.instance.deployKey, InternalHttpManager.editorAuthToken };
80
92
  possibleKeys.RemoveAll(string.IsNullOrEmpty);
81
93
  if (possibleKeys.Count == 0) {
@@ -97,8 +109,6 @@ public class Deploy {
97
109
  }
98
110
  }
99
111
 
100
-
101
-
102
112
  var confirmedSaveState = EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo();
103
113
  if (!confirmedSaveState || SceneManager.GetActiveScene().isDirty) { // User clicked "cancel"
104
114
  Debug.LogError("[Airship]: Cancelling publish: you must save or discard scene changes.");
@@ -106,7 +116,7 @@ public class Deploy {
106
116
  }
107
117
 
108
118
  foreach (var scene in gameConfig.gameScenes) {
109
- if (LuauCore.IsProtectedSceneName(scene.name)) {
119
+ if (LuauProtection.IsProtectedSceneName(scene.name)) {
110
120
  Debug.LogError($"Game scene name not allowed: {scene.name}");
111
121
  yield break;
112
122
  }
@@ -117,7 +127,7 @@ public class Deploy {
117
127
  }
118
128
  }
119
129
 
120
- if (LuauCore.IsProtectedSceneName(gameConfig.startingScene.name)) {
130
+ if (LuauProtection.IsProtectedSceneName(gameConfig.startingScene.name)) {
121
131
  Debug.LogError($"Game starting scene not allowed: {gameConfig.startingScene}");
122
132
  yield break;
123
133
  }
@@ -318,9 +328,9 @@ public class Deploy {
318
328
  yield return null;
319
329
  }
320
330
 
321
- if (EditorIntegrationsConfig.instance.buildWithoutUpload) {
331
+ if (EditorIntegrationsConfig.instance.buildWithoutUpload || dontUpload) {
322
332
  if (shouldResumeTypescriptWatch) TypescriptCompilationService.StartCompilerServices();
323
- Debug.Log("Build without upload is enabled. Ending early. You can now view bundles using AssetBundle browser.");
333
+ Debug.Log("Build without upload is enabled. Ending early. You can now inspect the built bundle inside \"bundles\" folder.");
324
334
  yield break;
325
335
  }
326
336
 
@@ -95,7 +95,7 @@ namespace Editor.Util {
95
95
  "CsToTs",
96
96
  "Easy.Airship",
97
97
  "LeTai.TrueShadow",
98
- "LuauAPI",
98
+ "LuauAPIAttribute",
99
99
  "Mirror.Authenticators",
100
100
  "Mirror.CompilerSymbols",
101
101
  "Mirror.Components",
@@ -247,3 +247,4 @@ namespace Editor.Util {
247
247
  }
248
248
  }
249
249
  */
250
+
@@ -0,0 +1,67 @@
1
+ fileFormatVersion: 2
2
+ guid: 2a0a8e30474a3411a9bea8f5b0b91f89
3
+ labels:
4
+ - RoslynAnalyzer
5
+ PluginImporter:
6
+ externalObjects: {}
7
+ serializedVersion: 3
8
+ iconMap: {}
9
+ executionOrder: {}
10
+ defineConstraints: []
11
+ isPreloaded: 0
12
+ isOverridable: 1
13
+ isExplicitlyReferenced: 1
14
+ validateReferences: 0
15
+ platformData:
16
+ Android:
17
+ enabled: 0
18
+ settings:
19
+ AndroidLibraryDependee: UnityLibrary
20
+ AndroidSharedLibraryType: Executable
21
+ CPU: ARMv7
22
+ Any:
23
+ enabled: 0
24
+ settings:
25
+ Exclude Android: 1
26
+ Exclude Editor: 1
27
+ Exclude Linux64: 1
28
+ Exclude OSXUniversal: 1
29
+ Exclude Win: 1
30
+ Exclude Win64: 1
31
+ Exclude iOS: 1
32
+ Editor:
33
+ enabled: 0
34
+ settings:
35
+ CPU: AnyCPU
36
+ DefaultValueInitialized: true
37
+ OS: AnyOS
38
+ Linux64:
39
+ enabled: 0
40
+ settings:
41
+ CPU: None
42
+ OSXUniversal:
43
+ enabled: 0
44
+ settings:
45
+ CPU: None
46
+ Win:
47
+ enabled: 0
48
+ settings:
49
+ CPU: None
50
+ Win64:
51
+ enabled: 0
52
+ settings:
53
+ CPU: None
54
+ WindowsStoreApps:
55
+ enabled: 0
56
+ settings:
57
+ CPU: AnyCPU
58
+ iOS:
59
+ enabled: 0
60
+ settings:
61
+ AddToEmbeddedBinaries: false
62
+ CPU: AnyCPU
63
+ CompileFlags:
64
+ FrameworkDependencies:
65
+ userData:
66
+ assetBundleName:
67
+ assetBundleVariant:
package/Generator.meta ADDED
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: 0913ecbdee29746f3be77ba6622f513e
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
@@ -4,7 +4,6 @@
4
4
  "references": [
5
5
  "GUID:eab6daf15424fc24a878e63a8cd81ec2",
6
6
  "GUID:842bf14b8e2ba45638e25dba28f03539",
7
- "GUID:1f7f51f8968140b8be5bcee537b6d629",
8
7
  "GUID:3b7e0a4d14cc4c4b98380d63986903e1",
9
8
  "GUID:563fac65016c405bb85a284491b989f2",
10
9
  "GUID:9a16190c3a18e8a4b84be0d37f3b4bd4",
@@ -12,7 +11,6 @@
12
11
  "GUID:98164ae7d6df4261a415a46ee3d095fc",
13
12
  "GUID:90710d4fb4a84d0f8ece9f3b9b5c2556",
14
13
  "GUID:a7ffa74110914b76bbe3b751b4e05b45",
15
- "GUID:5966039ae77c64b44bc04472c1ae63bb",
16
14
  "GUID:5e727e99520a4004a883ac814ea3911e",
17
15
  "GUID:cc332e87d96278649bb327cfb7b97850",
18
16
  "GUID:76216682843b45b59a5ee4264241dec3",
@@ -59,7 +57,10 @@
59
57
  "GUID:725ee7191c021de4dbf9269590ded755",
60
58
  "GUID:77ccaf49895b0d64e87cd4b4faf83c49",
61
59
  "GUID:2a0340569ab0e1245a38e0d6c7b2529b",
62
- "GUID:befe48b9a36afc04ea625c93daad910e"
60
+ "GUID:befe48b9a36afc04ea625c93daad910e",
61
+ "GUID:1f7f51f8968140b8be5bcee537b6d629",
62
+ "GUID:bdc05fc3964826a4a87a7a1f462f46e7",
63
+ "GUID:5966039ae77c64b44bc04472c1ae63bb"
63
64
  ],
64
65
  "includePlatforms": [
65
66
  "Editor"
@@ -6,6 +6,7 @@ using System.IO;
6
6
  using Airship.DevConsole;
7
7
  using Code.Authentication;
8
8
  using Code.Analytics;
9
+ using Code.Luau.LuauAssembly.Protection;
9
10
  using Luau;
10
11
  using Mirror;
11
12
  using UnityEngine;
@@ -101,7 +102,7 @@ namespace Code.Bootstrap {
101
102
  }, false);
102
103
  NetworkServer.RegisterHandler<ClientFinishedPreparingMessage>((conn, data) => {
103
104
  var sceneName = serverBootstrap.startupConfig.StartingSceneName;
104
- if (LuauCore.IsProtectedSceneName(sceneName)) {
105
+ if (LuauProtection.IsProtectedSceneName(sceneName)) {
105
106
  Debug.LogError("Invalid starting scene name: " + sceneName);
106
107
  conn.Disconnect();
107
108
  return;
@@ -118,7 +119,7 @@ namespace Code.Bootstrap {
118
119
 
119
120
  // Validate scene name
120
121
  var sceneName = this.serverBootstrap.startupConfig.StartingSceneName;
121
- if (LuauCore.IsProtectedSceneName(sceneName)) {
122
+ if (LuauProtection.IsProtectedSceneName(sceneName)) {
122
123
  Debug.LogError("Invalid starting scene name: " + sceneName + ". The name of this scene is not allowed.");
123
124
  conn.Send(new KickMessage() {
124
125
  reason = "Invalid starting scene name: " + sceneName + ". The name of this scene is not allowed. Report this to the game developer.",
@@ -59,6 +59,7 @@ public class ServerBootstrap : MonoBehaviour
59
59
  [NonSerialized] public string organizationId = "";
60
60
  [NonSerialized] public bool isShutdownEventTriggered = false;
61
61
  [NonSerialized] public bool isAgonesShutdownTriggered = false;
62
+ [NonSerialized] public bool isShutdownComplete = false;
62
63
 
63
64
  public ServerContext serverContext;
64
65
 
@@ -142,29 +143,54 @@ public class ServerBootstrap : MonoBehaviour
142
143
  }
143
144
 
144
145
  this.Setup();
145
-
146
- AppDomain.CurrentDomain.ProcessExit += ProcessExit;
147
146
  }
148
147
 
149
148
  public void InvokeOnProcessExit() {
149
+ // If Shutdown() was called, any future term signals or mark for shutdown should immedately close the server.
150
+ // Shutdown() should never be called unless we are ok with not running shutdown handlers (usually because they already
151
+ // finished).
152
+ if (isShutdownComplete) {
153
+ Application.Quit();
154
+ return;
155
+ }
156
+ // Don't need to refire shutdown events if they've already been processed or if agones has been notified of
157
+ // the shutdown. (agones in shutdown state means we are exiting immediately (OnApplicationQuit) and cannot yield)
158
+ if (this.isAgonesShutdownTriggered) {
159
+ Debug.Log("Agones Shutdown already triggered when invoking OnProcessExit. TS Handlers will not be called.");
160
+ return;
161
+ }
162
+ // Don't refire the events if we've already fired them. (This might happen if we have multiple sigterms)
150
163
  if (this.isShutdownEventTriggered) return;
151
164
  this.isShutdownEventTriggered = true;
165
+
166
+ // Ensure we always shut down the server after 1 hour even if TS fails to complete for some reason.
167
+ StartCoroutine(HandleTimeout());
152
168
 
169
+ // If we have TS handlers, fire them.
153
170
  if ((this.onProcessExit?.GetInvocationList().Length ?? 0) > 0) {
154
171
  Debug.Log("Invoking OnProcessExit handlers.");
155
172
  this.onProcessExit?.Invoke();
156
173
  } else {
157
- Debug.LogWarning("No OnProcessExit handlers were registered. Directly exiting process.");
158
- this.Shutdown();
174
+ // If we don't have handlers, shut down immediately.
175
+ Application.Quit();
159
176
  }
160
177
  }
161
-
162
- private void OnDestroy() {
163
- AppDomain.CurrentDomain.ProcessExit -= ProcessExit;
178
+
179
+ private IEnumerator HandleTimeout() {
180
+ yield return new WaitForSecondsRealtime(3600f);
181
+ Debug.Log($"OnProcessExit handlers did not complete after 1 hour. Shutting down.");
182
+ Application.Quit();
164
183
  }
165
184
 
166
- private void ProcessExit(object sender, EventArgs args) {
167
- this.InvokeOnProcessExit();
185
+ private void OnApplicationQuit() {
186
+ Debug.Log($"OnApplicationQuit() fired.");
187
+
188
+ // Notify agones we are going to quit
189
+ if (agones && !this.isAgonesShutdownTriggered) {
190
+ this.isAgonesShutdownTriggered = true;
191
+ agones.Shutdown();
192
+ Debug.Log($"Sent Agones Shutdown notification.");
193
+ }
168
194
  }
169
195
 
170
196
  public bool IsAgonesEnvironment() {
@@ -252,7 +278,8 @@ public class ServerBootstrap : MonoBehaviour
252
278
  if (!processedMarkedForDeletion && server.ObjectMeta != null && server.ObjectMeta.Labels != null && server.ObjectMeta.Labels.ContainsKey("MarkedForShutdown")) {
253
279
  Debug.Log("Found \"MarkedForShutdown\" label!");
254
280
  this.processedMarkedForDeletion = true;
255
- this.InvokeOnProcessExit();
281
+ InvokeOnProcessExit();
282
+ return;
256
283
  }
257
284
 
258
285
  if (this.allocatedByAgones) return;
@@ -486,14 +513,6 @@ public class ServerBootstrap : MonoBehaviour
486
513
  isServerReady = true;
487
514
  OnServerReady?.Invoke();
488
515
  }
489
-
490
- private void ShutdownInternal(int exitCode = 0) {
491
- if (agones && !this.isAgonesShutdownTriggered) {
492
- this.isAgonesShutdownTriggered = true;
493
- agones.Shutdown();
494
- Application.Quit(exitCode);
495
- }
496
- }
497
516
 
498
517
  private void ShutdownDueToAssetFailure(int exitCode = 1) {
499
518
  if (NetworkServer.connections != null && NetworkServer.connections.Count > 0) {
@@ -508,12 +527,22 @@ public class ServerBootstrap : MonoBehaviour
508
527
  }
509
528
  }
510
529
 
511
- ShutdownInternal(exitCode);
530
+ Application.Quit(exitCode);
512
531
  }
513
532
 
533
+ /**
534
+ * Used to immediately shutdown the server. Used by TS to confirm it is ready to shut down.
535
+ * Sets the isShutdownComplete field, meaning that InvokeOnProcessExit has completed and will not be called
536
+ * again.
537
+ */
514
538
  public void Shutdown()
515
539
  {
516
- ShutdownInternal(0);
540
+ Debug.LogWarning($"Bootstrap Shutdown() started.");
541
+ if (!isShutdownEventTriggered) {
542
+ Debug.LogWarning("Shutdown() was called before InvokeOnProcessExit(). TS handlers will not be fired.");
543
+ }
544
+ isShutdownComplete = true; // The application _should_ quit, but if it doesn't we'll mark shutdown as complete so the next interrupt will immediately shut down.
545
+ Application.Quit();
517
546
  }
518
547
 
519
548
  /**
@@ -7,7 +7,7 @@ namespace Code.Bootstrap {
7
7
  public class SignalHandler : MonoBehaviour {
8
8
  public ServerBootstrap serverBootstrap;
9
9
  public UnityMainThreadDispatcher unityMainThread;
10
-
10
+
11
11
  #if UNITY_STANDALONE_LINUX || UNITY_EDITOR_LINUX
12
12
  [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
13
13
  private delegate void SignalDelegate();
@@ -47,12 +47,10 @@ namespace Code.Bootstrap {
47
47
  }
48
48
  }
49
49
 
50
- private IEnumerator HandleSigterm()
51
- {
52
- Debug.Log("SIGTERM received. Performing cleanup.");
50
+ private IEnumerator HandleSigterm() {
51
+ Debug.Log("SIGTERM received. Starting application shutdown.");
53
52
  serverBootstrap.InvokeOnProcessExit();
54
53
  yield return null;
55
- Application.Quit();
56
54
  }
57
55
  #endif
58
56
  }
@@ -12,7 +12,6 @@
12
12
  "GUID:894a6cc6ed5cd2645bb542978cbed6a9",
13
13
  "GUID:33b0850c3f930a440abe6b01a9898921",
14
14
  "GUID:103be11cab738ef4d849a96eca5df2eb",
15
- "GUID:5966039ae77c64b44bc04472c1ae63bb",
16
15
  "GUID:5a902c5989fd2e74c9e7050e78d83db3",
17
16
  "GUID:199bc21c5ec6a3e41b1d67e225a7bd04",
18
17
  "GUID:15fc0a57446b3144c949da3e2b9737a9",
@@ -20,7 +19,15 @@
20
19
  "GUID:ec266f293c0b4f6c9d06847488a52a0c",
21
20
  "GUID:325984b52e4128546bc7558552f8b1d2",
22
21
  "GUID:72872094b21c16e48b631b2224833d49",
23
- "GUID:befe48b9a36afc04ea625c93daad910e"
22
+ "GUID:befe48b9a36afc04ea625c93daad910e",
23
+ "GUID:5966039ae77c64b44bc04472c1ae63bb",
24
+ "GUID:f87ecb857e752164ab814a3de8eb0262",
25
+ "GUID:51ab30dfa13781d45931a9650979d997",
26
+ "GUID:28801137de0f73c4d834f29b158b80a7",
27
+ "GUID:6b289bb677194eb40b60db3a566aab7b",
28
+ "GUID:bdc05fc3964826a4a87a7a1f462f46e7",
29
+ "GUID:34b86c7776fb64479aa6cc8114a663f0",
30
+ "GUID:18e5109d897e1b244ab2dfeaf5482c7b"
24
31
  ],
25
32
  "includePlatforms": [],
26
33
  "excludePlatforms": [],
@@ -7,7 +7,9 @@
7
7
  "GUID:47a57257b08841e9a7b6a61ce7119d42",
8
8
  "GUID:1d82bdf40e2465b44b34adf79595e74c",
9
9
  "GameKit.Utilities",
10
- "GUID:894a6cc6ed5cd2645bb542978cbed6a9"
10
+ "GUID:894a6cc6ed5cd2645bb542978cbed6a9",
11
+ "GUID:30817c1a0e6d646d99c048fc403f5979",
12
+ "GUID:325984b52e4128546bc7558552f8b1d2"
11
13
  ],
12
14
  "includePlatforms": [],
13
15
  "excludePlatforms": [],
@@ -49,7 +49,9 @@ public class GameObjectReferences : MonoBehaviour {
49
49
 
50
50
  private void Awake() {
51
51
  if (isStaticInstance) {
52
- AllReferences.Add(staticBundleId, this);
52
+ if (!AllReferences.TryAdd(staticBundleId, this)) {
53
+ Debug.LogError($"Duplicate instance of static GameObjectReferences for key {staticBundleId}", this.gameObject);
54
+ }
53
55
  }
54
56
 
55
57
  PackBundles();