gg.easy.airship 0.1.2167 → 0.1.2169

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 (28) hide show
  1. package/Editor/Accessories/Clothing/PlatformGearBundleManifestEditor.cs +1 -1
  2. package/Editor/AirAsset/AirAssetBundleEditor.cs +1 -1
  3. package/Editor/AirshipComponentDropdown.cs +1 -1
  4. package/Editor/AirshipComponentEditor.cs +24 -0
  5. package/Editor/Artifacts/AirshipReconciliationService.cs +100 -1
  6. package/Editor/CreateAssetBundles.cs +3 -3
  7. package/Editor/EditorIntegrationsConfig.cs +0 -2
  8. package/Editor/GameConfig/GameConfigEditor.cs +8 -0
  9. package/Editor/Packages/AirshipPackagesWindow.cs +1 -1
  10. package/Editor/Settings/AirshipSettingsProvider.cs +1 -2
  11. package/Editor/TypescriptCompiler~/utsc.js +113 -113
  12. package/LICENSE +21 -0
  13. package/Runtime/Code/GameConfig/GameConfig.cs +3 -0
  14. package/Runtime/Code/Luau/LuauBuffer.cs +17 -0
  15. package/Runtime/Code/Luau/LuauBuffer.cs.meta +3 -0
  16. package/Runtime/Code/Luau/LuauCore.cs +3 -1
  17. package/Runtime/Code/Luau/LuauCoreCallbacks.cs +13 -0
  18. package/Runtime/Code/Luau/LuauCoreReflection.cs +23 -0
  19. package/Runtime/Code/Luau/LuauMetadata.cs +6 -6
  20. package/Runtime/Code/Player/Character/MovementSystems/Character/CharacterMovement.cs +3 -2
  21. package/Runtime/Code/TSCodeGen/Editor/CsToTs/TypeScript/Helper.cs +5 -0
  22. package/Runtime/Plugins/Android/libLuauPlugin.so +0 -0
  23. package/Runtime/Plugins/Linux/libLuauPlugin.so +0 -0
  24. package/Runtime/Plugins/Mac/LuauPlugin.bundle/Contents/MacOS/LuauPlugin +0 -0
  25. package/Runtime/Plugins/Windows/x64/LuauPlugin.dll +0 -0
  26. package/Runtime/Plugins/Windows/x64/LuauPlugin.pdb +0 -0
  27. package/Runtime/Plugins/iOS/LuauPluginIos.a +0 -0
  28. package/package.json +1 -1
@@ -285,7 +285,7 @@ namespace Editor.Accessories.Clothing {
285
285
  var buildOutputFile = $"bundles/gear/{airId}_{AirshipPlatformUtil.GetStringName(platform)}.bundle";
286
286
  var sourceFolderPath = Path.GetRelativePath(".", Directory.GetParent(AssetDatabase.GetAssetPath(manifest))!.FullName);
287
287
 
288
- List<AssetBundleBuild> builds = CreateAssetBundles.GetPackageAssetBundleBuilds();
288
+ List<AssetBundleBuild> builds = CreateAssetBundles.GetPackageAssetBundleBuilds(false);
289
289
 
290
290
  var assetGuids = AssetDatabase.FindAssets("*", new string[] {sourceFolderPath}).ToList();
291
291
  var assetPaths = assetGuids
@@ -158,7 +158,7 @@ namespace Editor.AirAsset {
158
158
  var buildOutputFile = $"bundles/airassetbundle/{airId}_{AirshipPlatformUtil.GetStringName(platform)}.bundle";
159
159
  var sourceFolderPath = Path.GetRelativePath(".", Directory.GetParent(AssetDatabase.GetAssetPath(airAssetBundle))!.FullName);
160
160
 
161
- List<AssetBundleBuild> builds = CreateAssetBundles.GetPackageAssetBundleBuilds();
161
+ List<AssetBundleBuild> builds = CreateAssetBundles.GetPackageAssetBundleBuilds(false);
162
162
 
163
163
  var assetGuids = AssetDatabase.FindAssets("*", new string[] {sourceFolderPath}).ToList();
164
164
  var assetPaths = assetGuids
@@ -176,7 +176,7 @@ public class AirshipComponentDropdown : AdvancedDropdown {
176
176
  foreach (var binaryFile in binaryFiles) {
177
177
  if (binaryFile.m_metadata == null) continue;
178
178
 
179
- var airshipComponentMenu = binaryFile.m_metadata.GetDecorators().Find(f => f.name == "AirshipComponentMenu");
179
+ var airshipComponentMenu = binaryFile.m_metadata.decorators.Find(f => f.name == "AirshipComponentMenu");
180
180
  if (airshipComponentMenu != null && airshipComponentMenu.parameters[0].TryGetString(out var customPath)) {
181
181
  if (customPath == "") continue; // ignore empty names :)
182
182
 
@@ -218,6 +218,30 @@ public class ScriptBindingEditor : UnityEditor.Editor {
218
218
 
219
219
  var metadata = serializedObject.FindProperty("metadata");
220
220
 
221
+ var originalMetadata = binding.script.m_metadata;
222
+
223
+ var originalDecorators = originalMetadata.decorators;
224
+ var serializedDecorators = binding.metadata.decorators;
225
+
226
+ if (serializedDecorators.Count != originalDecorators.Count) {
227
+ return true;
228
+ }
229
+
230
+ foreach (var serializedDecorator in serializedDecorators)
231
+ {
232
+ var decoratorName = serializedDecorator.name;
233
+ var originalDecorator = originalDecorators.Find(d => d.name == decoratorName);
234
+
235
+ if (originalDecorator == null) {
236
+ return true;
237
+ }
238
+
239
+ var serializedParameters = serializedDecorator.parameters;
240
+ if (serializedParameters.Count != originalDecorator.parameters.Count) {
241
+ return true;
242
+ }
243
+ }
244
+
221
245
  var metadataProperties = metadata.FindPropertyRelative("properties");
222
246
  var originalMetadataProperties = binding.script.m_metadata?.properties;
223
247
 
@@ -125,6 +125,7 @@ namespace Airship.Editor {
125
125
 
126
126
  if (scriptMetadata == null) return false;
127
127
  componentMetadata.name = scriptMetadata.name;
128
+ componentMetadata.decorators = new List<LuauMetadataDecoratorElement>(scriptMetadata.decorators);
128
129
 
129
130
  // Add missing properties
130
131
  foreach (var scriptProperty in scriptMetadata.properties) {
@@ -193,10 +194,108 @@ namespace Airship.Editor {
193
194
  }
194
195
  }
195
196
  #endif
197
+
198
+ // Add required components
199
+ var requireComponents = scriptMetadata.FindClassDecorators("RequireComponent");
200
+ foreach (var requireComponent in requireComponents) {
201
+ var parameter = requireComponent.parameters.FirstOrDefault();
202
+ if (parameter == null) continue;
203
+
204
+ var requiredComponentTypeName = parameter.value?.ToString();
205
+ if (string.IsNullOrEmpty(requiredComponentTypeName)) continue;
206
+
207
+ var gameObject = component.gameObject;
208
+ if (gameObject == null) continue;
209
+
210
+ var parameterType = parameter.type;
211
+
212
+ switch (parameterType)
213
+ {
214
+ case "object":
215
+ {
216
+ EnsureUnityComponent(gameObject, requiredComponentTypeName);
217
+ break;
218
+ }
219
+ case "AirshipBehaviour":
220
+ {
221
+ EnsureAirshipComponent(gameObject, requiredComponentTypeName, component.context);
222
+ break;
223
+ }
224
+ }
225
+ }
226
+
196
227
  // component.componentHash = component.script.sourceFileHash;
197
228
  return true;
198
229
  }
230
+
231
+ /// <summary>
232
+ /// Ensures that a Unity component is present on the GameObject, adding it if necessary
233
+ /// </summary>
234
+ /// <param name="gameObject">The GameObject to check</param>
235
+ /// <param name="componentTypeName">The name of the Unity component type</param>
236
+ private static void EnsureUnityComponent(GameObject gameObject, string componentTypeName) {
237
+ try {
238
+ var componentType = GetComponentTypeByName(componentTypeName);
239
+ if (componentType == null) {
240
+ Debug.LogWarning($"[RequireComponent] Could not find Unity component type: {componentTypeName}.", gameObject);
241
+ return;
242
+ }
243
+
244
+ var existingComponent = gameObject.GetComponent(componentType);
245
+ if (existingComponent != null) {
246
+ return;
247
+ }
248
+
249
+ gameObject.AddComponent(componentType);
250
+ #if AIRSHIP_DEBUG
251
+ Debug.Log($"[RequireComponent] Added Unity component '{componentTypeName}' to GameObject '{gameObject.name}'", gameObject);
252
+ #endif
253
+ }
254
+ catch (Exception ex) {
255
+ Debug.LogException(ex);
256
+ }
257
+ }
258
+
259
+ /// <summary>
260
+ /// Ensures that an AirshipComponent is present on the GameObject, adding it if necessary
261
+ /// </summary>
262
+ /// <param name="gameObject">The GameObject to check</param>
263
+ /// <param name="componentTypeName">The name of the AirshipComponent type</param>
264
+ /// <param name="context">The Luau context to use when creating the component</param>
265
+ private static void EnsureAirshipComponent(GameObject gameObject, string componentTypeName, LuauContext context) {
266
+ try {
267
+ var existingComponents = gameObject.GetComponents<AirshipComponent>();
268
+ foreach (var existingComponent in existingComponents) {
269
+ if (existingComponent.script == null || existingComponent.script.m_metadata == null) continue;
270
+
271
+ if (existingComponent.script.m_metadata.name != componentTypeName) continue;
272
+
273
+ return;
274
+ }
275
+
276
+ var buildInfo = AirshipBuildInfo.Instance;
277
+ if (buildInfo == null || !buildInfo.HasAirshipBehaviourClass(componentTypeName)) {
278
+ Debug.LogWarning($"[RequireComponent] AirshipComponent '{componentTypeName}' not found in build info", gameObject);
279
+ return;
280
+ }
281
+
282
+ var scriptPath = buildInfo.GetScriptPath(componentTypeName);
283
+ AirshipComponent.Create(gameObject, $"Assets/{scriptPath}", context);
284
+
285
+ #if AIRSHIP_DEBUG
286
+ Debug.Log($"[RequireComponent] Added AirshipComponent '{componentTypeName}' to GameObject '{gameObject.name}'", gameObject);
287
+ #endif
288
+ }
289
+ catch (Exception ex) {
290
+ Debug.LogException(ex);
291
+ }
292
+ }
199
293
 
294
+ private static Type GetComponentTypeByName(string name) {
295
+ var types = TypeCache.GetTypesDerivedFrom<Component>();
296
+ return types.FirstOrDefault(type => type.Name == name);
297
+ }
298
+
200
299
  /// <summary>
201
300
  /// Reconciles all queued components for the given script
202
301
  /// </summary>
@@ -381,4 +480,4 @@ namespace Airship.Editor {
381
480
  }
382
481
  }
383
482
  }
384
- #endif
483
+ #endif
@@ -173,7 +173,7 @@ public static class CreateAssetBundles {
173
173
  /// Creates an AssetBundleBuild for every AirshipPackage in the project.
174
174
  /// </summary>
175
175
  /// <returns></returns>
176
- public static List<AssetBundleBuild> GetPackageAssetBundleBuilds() {
176
+ public static List<AssetBundleBuild> GetPackageAssetBundleBuilds(bool compileURPShaders) {
177
177
  List<AssetBundleBuild> builds = new();
178
178
 
179
179
  if (!Directory.Exists(Path.Join("Assets", "AirshipPackages"))) {
@@ -197,7 +197,7 @@ public static class CreateAssetBundles {
197
197
  assetGuids.AddRange(urpGuids);
198
198
  });
199
199
 
200
- if (!EditorIntegrationsConfig.instance.selfCompileAllShaders) {
200
+ if (!compileURPShaders) {
201
201
  Debug.Log("Adding URP assets to CoreMaterials bundle.");
202
202
  addUrpFiles("Packages/com.unity.render-pipelines.universal/Shaders");
203
203
  addUrpFiles("Packages/com.unity.render-pipelines.universal/ShaderLibrary");
@@ -297,7 +297,7 @@ public static class CreateAssetBundles {
297
297
  // Act as if we are building all asset bundles (including CoreMaterials).
298
298
  // This is so our current build target will have references to those asset bundles.
299
299
  // This is paired with changes to Scriptable Build Pipeline that prevent these bundles from actually being built.
300
- List<AssetBundleBuild> builds = GetPackageAssetBundleBuilds();
300
+ List<AssetBundleBuild> builds = GetPackageAssetBundleBuilds(gameConfig.compileURPShaders);
301
301
 
302
302
  // Make a fake asset bundle with all package content. This makes the build have the correct dependency data.
303
303
  // {
@@ -39,8 +39,6 @@ public class EditorIntegrationsConfig : ScriptableSingleton<EditorIntegrationsCo
39
39
  [SerializeField]
40
40
  public bool safeguardBundleModification = true;
41
41
 
42
- [SerializeField] public bool selfCompileAllShaders = false;
43
-
44
42
  [SerializeField] internal bool useProjectReconcileOption = false;
45
43
  [FormerlySerializedAs("reconcilerVersion")] [SerializeField] internal ReconcilerVersion projectReconcilerVersion = ReconcilerVersion.Default;
46
44
 
@@ -18,6 +18,7 @@ public class GameConfigEditor : UnityEditor.Editor {
18
18
  private Action requestRefresh;
19
19
 
20
20
  private SerializedProperty supportsMobile;
21
+ private SerializedProperty compileURPShaders;
21
22
 
22
23
  Rect buttonRect;
23
24
  public override void OnInspectorGUI() {
@@ -51,6 +52,12 @@ public class GameConfigEditor : UnityEditor.Editor {
51
52
  EditorGUILayout.PropertyField(this.supportsMobile, new GUIContent("Mobile"));
52
53
  GUILayout.Space(20);
53
54
 
55
+ EditorGUILayout.LabelField("Shaders", EditorStyles.boldLabel);
56
+ EditorGUILayout.PropertyField(this.compileURPShaders, new GUIContent("Compile URP Shaders") {
57
+ tooltip = "By default, your game will use a precompiled set of URP shaders for basic usage. Checking this box will compile URP shaders specifically for your game. If you have any advanced URP materials (or notice invisible materials on published games), you should check this box."
58
+ });
59
+ GUILayout.Space(20);
60
+
54
61
  foreach (var field in typeof(GameConfig).GetFields()) {
55
62
  if (field.Name is "gameId" or "gameLayers" || Attribute.IsDefined(field, typeof(HideInInspector))) continue; // Rendered above
56
63
 
@@ -107,6 +114,7 @@ public class GameConfigEditor : UnityEditor.Editor {
107
114
  }
108
115
 
109
116
  this.supportsMobile = serializedObject.FindProperty("supportsMobile");
117
+ this.compileURPShaders = serializedObject.FindProperty("compileURPShaders");
110
118
 
111
119
  updateSelectedGame += (update) => {
112
120
  var gameId = update.gameId;
@@ -416,7 +416,7 @@ namespace Editor.Packages {
416
416
  // Act as if we are building all asset bundles (including CoreMaterials).
417
417
  // This is so our current build target will have references to those asset bundles.
418
418
  // This is paired with changes to Scriptable Build Pipeline that prevent these bundles from actually being built.
419
- List<AssetBundleBuild> builds = CreateAssetBundles.GetPackageAssetBundleBuilds();
419
+ List<AssetBundleBuild> builds = CreateAssetBundles.GetPackageAssetBundleBuilds(true);
420
420
 
421
421
  foreach (var platform in platforms) {
422
422
  var st = Stopwatch.StartNew();
@@ -153,8 +153,7 @@ public class AirshipSettingsProvider : SettingsProvider
153
153
  EditorIntegrationsConfig.instance.autoUpdatePackages = EditorGUILayout.Toggle(new GUIContent("Auto Update Packages", "Airship Packages will automatically update whenever a new update is available."), EditorIntegrationsConfig.instance.autoUpdatePackages);
154
154
  EditorIntegrationsConfig.instance.enableMainMenu = EditorGUILayout.Toggle(new GUIContent("Enable Main Menu", "When true, the main menu will show when pressing [Escape]."), EditorIntegrationsConfig.instance.enableMainMenu);
155
155
  EditorIntegrationsConfig.instance.buildWithoutUpload = EditorGUILayout.Toggle(new GUIContent("Build Without Upload", "When publishing, this will build the asset bundles but won't upload them to Airship. This is useful for testing file sizes with AssetBundle Browser."), EditorIntegrationsConfig.instance.buildWithoutUpload);
156
- EditorIntegrationsConfig.instance.selfCompileAllShaders = EditorGUILayout.Toggle(new GUIContent("Self Compile All Shaders", "Instead of using pre-compiled shaders from CoreMaterials, you will compile all needed URP shaders when publishing. This makes publishing take significantly longer but reduces shader stripping issues."), EditorIntegrationsConfig.instance.selfCompileAllShaders);
157
-
156
+
158
157
  // EditorIntegrationsConfig.instance.manageTypescriptProject = EditorGUILayout.Toggle(new GUIContent("Manage Typescript Projects", "Automatically update Typescript configuration files. (package.json, tsconfig.json)"), EditorIntegrationsConfig.instance.manageTypescriptProject);
159
158
 
160
159
  // EditorIntegrationsConfig.instance.typescriptAutostartCompiler = EditorGUILayout.Toggle(