gg.easy.airship 0.1.2165 → 0.1.2167

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.
@@ -294,6 +294,9 @@ public static class CreateAssetBundles {
294
294
  Debug.Log($"[Editor]: Building {platform} asset bundles...");
295
295
  Debug.Log("[Editor]: Build path: " + buildPath);
296
296
 
297
+ // Act as if we are building all asset bundles (including CoreMaterials).
298
+ // This is so our current build target will have references to those asset bundles.
299
+ // This is paired with changes to Scriptable Build Pipeline that prevent these bundles from actually being built.
297
300
  List<AssetBundleBuild> builds = GetPackageAssetBundleBuilds();
298
301
 
299
302
  // Make a fake asset bundle with all package content. This makes the build have the correct dependency data.
@@ -396,8 +396,8 @@ namespace Editor.Packages {
396
396
  // Uncomment to just build iOS
397
397
  if (isCoreMaterials) {
398
398
  platforms.Clear();
399
- // platforms.Add(AirshipPlatform.iOS);
400
- platforms.Add(AirshipPlatform.Android);
399
+ platforms.Add(AirshipPlatform.iOS);
400
+ // platforms.Add(AirshipPlatform.Android);
401
401
  // platforms.Add(AirshipPlatform.Windows);
402
402
  // platforms.Add(AirshipPlatform.Mac);
403
403
  }
@@ -413,6 +413,9 @@ namespace Editor.Packages {
413
413
  Repaint();
414
414
  yield return null; // give time to repaint
415
415
 
416
+ // Act as if we are building all asset bundles (including CoreMaterials).
417
+ // This is so our current build target will have references to those asset bundles.
418
+ // This is paired with changes to Scriptable Build Pipeline that prevent these bundles from actually being built.
416
419
  List<AssetBundleBuild> builds = CreateAssetBundles.GetPackageAssetBundleBuilds();
417
420
 
418
421
  foreach (var platform in platforms) {
@@ -8,6 +8,8 @@ using UnityEngine;
8
8
  /// </summary>
9
9
  public class AirshipEntryPoint : Singleton<AirshipEntryPoint> {
10
10
  private void Start() {
11
+ #if AIRSHIP_PLAYER
11
12
  Debug.unityLogger.logHandler = new AirshipLogHandler();
13
+ #endif
12
14
  }
13
15
  }
@@ -200,6 +200,9 @@ public class SystemRoot : Singleton<SystemRoot> {
200
200
  enums.Add(this.UnloadBundleAsync(loadedBundle, keepCodeZip));
201
201
  }
202
202
  yield return this.WaitAll(enums.ToArray());
203
+ var unloadSW = Stopwatch.StartNew();
204
+ yield return Resources.UnloadUnusedAssets();
205
+ print("Unloaded unused assets in " + unloadSW.ElapsedMilliseconds + " ms.");
203
206
 
204
207
  // code.zip
205
208
  bool openCodeZips = RunCore.IsServer() || compileLuaOnClient;
@@ -14,29 +14,23 @@ namespace Code.Network.Simulation
14
14
  * This component is used to allow lag compensation, prediction, and other networked state systems to
15
15
  * work with a networked object controlled by the server.
16
16
  *
17
- * When this component is placed on a object being networked with Mirror, the server can include it
17
+ * When this component is placed on a object, the server can include it
18
18
  * in lag compensation and clients can resimulate their predictions more accurately.
19
19
  */
20
- public class AirshipNetworkedObject : NetworkBehaviour
21
- {
20
+ public class AirshipNetworkedObject : MonoBehaviour {
21
+
22
+ [Tooltip("Adjusts the lag compensation timing by this amount in seconds. Useful to add or remove additional delay on the lag compensation request. Ex. Removing observer buffer delay for non-buffered entities.")]
23
+ [Range(-1, 1)]
24
+ public float bufferAdjustment = 0;
25
+
22
26
  private History<TransformSnapshot> history;
23
27
 
24
28
  private void Start()
25
29
  {
26
- if (isServer && authority)
27
- {
28
- history = new History<TransformSnapshot>(NetworkServer.sendRate);
29
- AirshipSimulationManager.Instance.OnCaptureSnapshot += this.CaptureSnapshot;
30
- AirshipSimulationManager.Instance.OnSetSnapshot += this.SetSnapshot;
31
- AirshipSimulationManager.Instance.OnLagCompensationCheck += this.LagCompensationCheck;
32
- }
33
-
34
- if (isClient && !authority)
35
- {
36
- history = new History<TransformSnapshot>(NetworkClient.sendRate);
37
- AirshipSimulationManager.Instance.OnCaptureSnapshot += this.CaptureSnapshot;
38
- AirshipSimulationManager.Instance.OnSetSnapshot += this.SetSnapshot;
39
- }
30
+ history = new History<TransformSnapshot>(1);
31
+ AirshipSimulationManager.Instance.OnCaptureSnapshot += this.CaptureSnapshot;
32
+ AirshipSimulationManager.Instance.OnSetSnapshot += this.SetSnapshot;
33
+ AirshipSimulationManager.Instance.OnLagCompensationCheck += this.LagCompensationCheck;
40
34
  }
41
35
 
42
36
  private void OnDestroy() {
@@ -74,10 +68,14 @@ namespace Code.Network.Simulation
74
68
  }
75
69
  }
76
70
 
77
- private void LagCompensationCheck(int clientId, int tick, double time, double latency, double buffer)
71
+ private void LagCompensationCheck(int clientId, int tick, double time, double latency, double bufferTime)
78
72
  {
79
- var bufferedTicks = Math.Round((latency - NetworkClient.bufferTime - Time.fixedDeltaTime) / Time.fixedDeltaTime);
80
- this.SetSnapshot(tick - bufferedTicks);
73
+ var commandBufferTime = (NetworkServer.sendInterval * (NetworkClient.bufferTimeMultiplier / 2f));
74
+
75
+ var totalBuffer = (latency * 2) + bufferTime + commandBufferTime;
76
+ var lagCompensatedTime = time - (totalBuffer + bufferAdjustment);
77
+ var lagCompensatedTick = AirshipSimulationManager.Instance.GetNearestTickForUnscaledTime(lagCompensatedTime);
78
+ this.SetSnapshot(lagCompensatedTick);
81
79
  }
82
80
  }
83
81
  }
@@ -2053,133 +2053,8 @@ namespace Airship.DevConsole
2053
2053
 
2054
2054
  #endregion
2055
2055
 
2056
- #region Camera commands
2057
-
2058
- AddCommand(Command.Create<bool?>(
2059
- "cam_ortho",
2060
- "",
2061
- "Query or set whether the main camera is orthographic",
2062
- Parameter.Create("enabled", "Whether the main camera is orthographic (use \"NULL\" to toggle)"),
2063
- b =>
2064
- {
2065
- if (Camera.main == null)
2066
- {
2067
- LogError("Could not find the main camera.");
2068
- return;
2069
- }
2070
-
2071
- if (!b.HasValue)
2072
- {
2073
- b = !Camera.main.orthographic;
2074
- }
2075
-
2076
- Camera.main.orthographic = b.Value;
2077
- LogSuccess($"{(b.Value ? "Enabled" : "Disabled")} orthographic mode on the main camera.");
2078
- },
2079
- () =>
2080
- {
2081
- if (Camera.main == null)
2082
- {
2083
- LogError("Could not find the main camera.");
2084
- return;
2085
- }
2086
-
2087
- LogVariable("Orthographic", Camera.main.orthographic);
2088
- }
2089
- ));
2090
-
2091
- AddCommand(Command.Create<int>(
2092
- "cam_fov",
2093
- "",
2094
- "Query or set the main camera field of view",
2095
- Parameter.Create("fieldOfView", "Field of view"),
2096
- f =>
2097
- {
2098
- if (Camera.main == null)
2099
- {
2100
- LogError("Could not find the main camera.");
2101
- return;
2102
- }
2103
-
2104
- Camera.main.fieldOfView = f;
2105
- LogSuccess($"Main camera's field of view set to {f}.");
2106
- },
2107
- () =>
2108
- {
2109
- if (Camera.main == null)
2110
- {
2111
- LogError("Could not find the main camera.");
2112
- return;
2113
- }
2114
-
2115
- LogVariable("Field of view", Camera.main.fieldOfView);
2116
- }
2117
- ));
2118
-
2119
- #endregion
2120
-
2121
2056
  #region Scene commands
2122
2057
 
2123
- AddCommand(Command.Create<int>(
2124
- "scene_load",
2125
- "",
2126
- "Load the scene at the specified build index",
2127
- Parameter.Create(
2128
- "buildIndex",
2129
- "Build index of the scene to load, specified in the Unity build settings"
2130
- ),
2131
- i =>
2132
- {
2133
- if (i >= SceneManager.sceneCountInBuildSettings)
2134
- {
2135
- LogError($"Invalid build index specified: \"{i}\". Check the Unity build settings.");
2136
- return;
2137
- }
2138
-
2139
- SceneManager.LoadScene(i);
2140
- LogSuccess($"Loaded scene at build index {i}.");
2141
- }
2142
- ), true);
2143
-
2144
- AddCommand(Command.Create<int>(
2145
- "scene_info",
2146
- "",
2147
- "Display information about the current scene",
2148
- Parameter.Create("sceneIndex", "Index of the scene in the currently loaded scenes"),
2149
- i =>
2150
- {
2151
- if (i >= SceneManager.sceneCount)
2152
- {
2153
- LogError($"Could not find active scene at index: {i}.");
2154
- return;
2155
- }
2156
-
2157
- Scene scene = SceneManager.GetSceneAt(i);
2158
- LogSeperator(scene.name);
2159
- Log($"Scene index: {i}.");
2160
- Log($"Build index: {scene.buildIndex}.");
2161
- Log($"Path: {scene.path}.");
2162
- LogSeperator();
2163
- },
2164
- () =>
2165
- {
2166
- if (SceneManager.sceneCount == 0)
2167
- {
2168
- Log("Could not find any active scenes.");
2169
- return;
2170
- }
2171
-
2172
- LogSeperator("Active scenes");
2173
- for (int i = 0; i < SceneManager.sceneCount; i++)
2174
- {
2175
- Scene scene = SceneManager.GetSceneAt(i);
2176
- Log($" {i}) {scene.name}, build index: {scene.buildIndex}.");
2177
- }
2178
- LogCommand();
2179
- LogSeperator();
2180
- }
2181
- ));
2182
-
2183
2058
  AddCommand(Command.Create<string>(
2184
2059
  "obj_info",
2185
2060
  "",
@@ -2379,216 +2254,6 @@ namespace Airship.DevConsole
2379
2254
 
2380
2255
  #endregion
2381
2256
 
2382
- #region Reflection commands
2383
-
2384
- AddCommand(Command.Create<string>(
2385
- "cs_evaluate",
2386
- "cs_eval,evaluate,eval",
2387
- "Evaluate a C# expression or statement and display the result",
2388
- Parameter.Create("expression", "The expression to evaluate"),
2389
- input =>
2390
- {
2391
- if (_monoEvaluator == null)
2392
- {
2393
- DevConsole.LogError(MonoNotSupportedText);
2394
- return;
2395
- }
2396
-
2397
- try
2398
- {
2399
- if (!input.EndsWith(";"))
2400
- {
2401
- input += ";";
2402
- }
2403
-
2404
- object result = _monoEvaluator.Evaluate(input);
2405
-
2406
- if (result == null)
2407
- {
2408
- Log($"Null.");
2409
- return;
2410
- }
2411
-
2412
- if (result.GetType() != typeof(string) && typeof(IEnumerable).IsAssignableFrom(result.GetType()))
2413
- {
2414
- Log($"{{ {string.Join(", ", ((IEnumerable)result).Cast<object>())} }}");
2415
- return;
2416
- }
2417
-
2418
- Log($"{result}.");
2419
- }
2420
- catch (Exception e)
2421
- {
2422
- LogError($"An exception was thrown whilst evaluating the C# expression or statement: {e.Message}.");
2423
- }
2424
- }
2425
- ));
2426
-
2427
- AddCommand(Command.Create<string>(
2428
- "cs_run",
2429
- "run",
2430
- "Execute a C# expression or statement",
2431
- Parameter.Create("statement", "The statement to execute"),
2432
- input =>
2433
- {
2434
- if (_monoEvaluator == null)
2435
- {
2436
- DevConsole.LogError(MonoNotSupportedText);
2437
- return;
2438
- }
2439
-
2440
- try
2441
- {
2442
- if (!input.EndsWith(";"))
2443
- {
2444
- input += ";";
2445
- }
2446
-
2447
- if (_monoEvaluator.Run(input))
2448
- {
2449
- LogSuccess("Successfully executed the C# expression or statement.");
2450
- }
2451
- else
2452
- {
2453
- LogError("Failed to parse the C# expression or statement.");
2454
- }
2455
- }
2456
- catch (Exception e)
2457
- {
2458
- LogError($"An exception was thrown whilst executing the C# expression or statement: {e.Message}.");
2459
- }
2460
- }
2461
- ));
2462
-
2463
- AddCommand(Command.Create(
2464
- "cs_usings",
2465
- "",
2466
- "Display a list of all active using statements",
2467
- () =>
2468
- {
2469
- if (_monoEvaluator == null)
2470
- {
2471
- DevConsole.LogError(MonoNotSupportedText);
2472
- return;
2473
- }
2474
-
2475
- string usings = _monoEvaluator.GetUsing();
2476
-
2477
- if (string.IsNullOrEmpty(usings))
2478
- {
2479
- Log("There are no active using statements.");
2480
- return;
2481
- }
2482
-
2483
- LogSeperator("Usings");
2484
- Log(usings.TrimEnd('\n'));
2485
- LogSeperator();
2486
- }
2487
- ));
2488
-
2489
- AddCommand(Command.Create(
2490
- "cs_variables",
2491
- "cs_vars",
2492
- "Display a list of all local variables defined",
2493
- () =>
2494
- {
2495
- if (_monoEvaluator == null)
2496
- {
2497
- DevConsole.LogError(MonoNotSupportedText);
2498
- return;
2499
- }
2500
-
2501
- string vars = _monoEvaluator.GetVars();
2502
-
2503
- if (string.IsNullOrEmpty(vars))
2504
- {
2505
- Log("There are no local variables defined.");
2506
- return;
2507
- }
2508
-
2509
- LogSeperator("Local variables");
2510
- Log(vars.TrimEnd('\n'));
2511
- LogSeperator();
2512
- }
2513
- ));
2514
-
2515
- AddCommand(Command.Create<string, bool>(
2516
- "cs_setusing",
2517
- "",
2518
- "Set whether a using statement is included automatically when starting the developer console",
2519
- Parameter.Create("namespace", "Namespace to use as the using statement (e.g. \"System.Collections\""),
2520
- Parameter.Create("enabled", "Whether the using statement is automatically included upon starting the developer console"),
2521
- (usingName, enabled) =>
2522
- {
2523
- if (enabled)
2524
- {
2525
- if (_includedUsings.Contains(usingName))
2526
- {
2527
- LogError($"The specifed using statement is already enabled: \"{usingName}\".");
2528
- return;
2529
- }
2530
-
2531
- _includedUsings.Add(usingName);
2532
- LogSuccess($"Enabled \"{usingName}\" as an automatically included using statement.");
2533
- }
2534
- else
2535
- {
2536
- if (!_includedUsings.Contains(usingName))
2537
- {
2538
- LogError($"The specified using statement is already disabled: \"{usingName}\".");
2539
- return;
2540
- }
2541
-
2542
- _includedUsings.Remove(usingName);
2543
- LogSuccess($"Disabled \"{usingName}\" as an automatically included using statement.");
2544
- }
2545
- }
2546
- ));
2547
-
2548
- AddCommand(Command.Create(
2549
- "cs_autousings",
2550
- "",
2551
- "Display a list of all user-defined using statements that are included automatically when starting the developer console",
2552
- () =>
2553
- {
2554
- if (_includedUsings.Count == 0)
2555
- {
2556
- Log("There are no user-defined using statements.");
2557
- return;
2558
- }
2559
-
2560
- LogSeperator("User-defined usings");
2561
- LogCollection(_includedUsings);
2562
- LogSeperator();
2563
- }
2564
- ));
2565
-
2566
- AddCommand(Command.Create(
2567
- "cs_help",
2568
- "",
2569
- "Display information about the reflection commands",
2570
- () =>
2571
- {
2572
- Command evaluateCmd = GetCommand("cs_evaluate");
2573
- Command runCmd = GetCommand("cs_run");
2574
- Command usingsCmd = GetCommand("cs_usings");
2575
- Command varsCmd = GetCommand("cs_vars");
2576
- Command setUsingCmd = GetCommand("cs_setusing");
2577
- Command autoUsingsCmd = GetCommand("cs_autousings");
2578
-
2579
- LogSeperator("Reflection commands help");
2580
- LogVariable(evaluateCmd.ToFormattedString(), evaluateCmd.HelpText);
2581
- LogVariable(runCmd.ToFormattedString(), runCmd.HelpText);
2582
- LogVariable(usingsCmd.ToFormattedString(), usingsCmd.HelpText);
2583
- LogVariable(varsCmd.ToFormattedString(), varsCmd.HelpText);
2584
- LogVariable(setUsingCmd.ToFormattedString(), setUsingCmd.HelpText);
2585
- LogVariable(autoUsingsCmd.ToFormattedString(), autoUsingsCmd.HelpText);
2586
- LogSeperator();
2587
- }
2588
- ));
2589
-
2590
- #endregion
2591
-
2592
2257
  #region Stat display commands
2593
2258
 
2594
2259
  AddCommand(Command.Create(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gg.easy.airship",
3
- "version": "0.1.2165",
3
+ "version": "0.1.2167",
4
4
  "displayName": "Airship",
5
5
  "unity": "2021.3",
6
6
  "unityRelease": "12f1",