diff --git a/Assets/AWSIM/Scripts/AssetBundleBuilder/Editor/AWSIMBuildTargets.cs b/Assets/AWSIM/Scripts/AssetBundleBuilder/Editor/AWSIMBuildTargets.cs
new file mode 100644
index 000000000..05f7772dc
--- /dev/null
+++ b/Assets/AWSIM/Scripts/AssetBundleBuilder/Editor/AWSIMBuildTargets.cs
@@ -0,0 +1,22 @@
+using UnityEditor;
+
+namespace AWSIM.Scripts.AssetBundleBuilder.Editor
+{
+ public static class AWSIMBuildTargets
+ {
+ ///
+ /// Build targets used for building the bundles for AWSIM Labs.
+ ///
+ public enum SupportedBuildTargets
+ {
+ StandaloneLinux64 = 19,
+ StandaloneWindows64 = 24
+ }
+
+ public static readonly BuildTarget[] TargetValues =
+ {
+ BuildTarget.StandaloneLinux64,
+ BuildTarget.StandaloneWindows64
+ };
+ }
+}
diff --git a/Assets/AWSIM/Scripts/AssetBundleBuilder/Editor/AWSIMBuildTargets.cs.meta b/Assets/AWSIM/Scripts/AssetBundleBuilder/Editor/AWSIMBuildTargets.cs.meta
new file mode 100644
index 000000000..9e4517e5c
--- /dev/null
+++ b/Assets/AWSIM/Scripts/AssetBundleBuilder/Editor/AWSIMBuildTargets.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: a89512c3c5c1a35458df338aad4a8760
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/AWSIM/Scripts/AssetBundleBuilder/Editor/AssetBundleBuilder.cs b/Assets/AWSIM/Scripts/AssetBundleBuilder/Editor/AssetBundleBuilder.cs
index 2e1971ead..660517c5b 100644
--- a/Assets/AWSIM/Scripts/AssetBundleBuilder/Editor/AssetBundleBuilder.cs
+++ b/Assets/AWSIM/Scripts/AssetBundleBuilder/Editor/AssetBundleBuilder.cs
@@ -16,15 +16,13 @@ public class AssetBundleBuilder : EditorWindow
private bool _doBuildVehicle;
private bool _doBuildEnvironment;
- private readonly BuildAssetBundleOptions[] _buildOptionsValues =
- (BuildAssetBundleOptions[])System.Enum.GetValues(typeof(BuildAssetBundleOptions));
+ private const BuildAssetBundleOptions BuildOption =
+ BuildAssetBundleOptions.None | BuildAssetBundleOptions.ForceRebuildAssetBundle;
- private readonly BuildTarget[] _buildTargetsValues = (BuildTarget[])System.Enum.GetValues(typeof(BuildTarget));
-
- private string[] _buildOptionsNames;
- private string[] _buildTargetsNames;
-
- private int _selectedBuildOptionIndex;
+ private readonly BuildTarget[] _buildTargetValues = AWSIMBuildTargets.TargetValues;
+
+ private string[] _buildTargetNames;
+
private int _selectedBuildTargetIndex;
// Default locations to build the bundles
@@ -49,8 +47,7 @@ private static void ShowWindow()
private void OnEnable()
{
- _buildOptionsNames = System.Enum.GetNames(typeof(BuildAssetBundleOptions));
- _buildTargetsNames = System.Enum.GetNames(typeof(BuildTarget));
+ _buildTargetNames = System.Enum.GetNames(typeof(AWSIMBuildTargets.SupportedBuildTargets));
// Initialize bundles
_vehicleBundleInfo = InitializeBundleInfo(VehicleOutputPath);
@@ -73,11 +70,9 @@ private void OnGUI()
GUILayout.Space(5);
- // Shared options for bundles
- _selectedBuildOptionIndex =
- EditorGUILayout.Popup("Build Options", _selectedBuildOptionIndex, _buildOptionsNames);
+ // Build Target
_selectedBuildTargetIndex =
- EditorGUILayout.Popup("Build Target", _selectedBuildTargetIndex, _buildTargetsNames);
+ EditorGUILayout.Popup("Build Target", _selectedBuildTargetIndex, _buildTargetNames);
GUILayout.Space(10);
@@ -104,13 +99,12 @@ private static void DrawBundleSettings(BundleInfo bundleInfo, string label)
private void Build()
{
- var selectedBuildOption = _buildOptionsValues[_selectedBuildOptionIndex];
- var selectedBuildTarget = _buildTargetsValues[_selectedBuildTargetIndex];
-
+ var selectedBuildTarget = _buildTargetValues[_selectedBuildTargetIndex];
+
if (_doBuildVehicle && _vehicleBundleInfo.Prefab != null)
- BuildAssetBundle(_vehicleBundleInfo, selectedBuildOption, selectedBuildTarget);
+ BuildAssetBundle(_vehicleBundleInfo, BuildOption, selectedBuildTarget);
if (_doBuildEnvironment && _environmentBundleInfo.Prefab != null)
- BuildAssetBundle(_environmentBundleInfo, selectedBuildOption, selectedBuildTarget);
+ BuildAssetBundle(_environmentBundleInfo, BuildOption, selectedBuildTarget);
}
private static void BuildAssetBundle(BundleInfo bundleInfo, BuildAssetBundleOptions options, BuildTarget target)
@@ -128,36 +122,14 @@ private static void BuildAssetBundle(BundleInfo bundleInfo, BuildAssetBundleOpti
}
EnsureDirectoryExists(bundleInfo.OutputPath);
-
- // Get the lightmaps for the scene/prefab
- LightmapData[] lightmaps = LightmapSettings.lightmaps;
- if (lightmaps != null && lightmaps.Length > 0)
- {
- foreach (var lightmapData in lightmaps)
- {
- if (lightmapData.lightmapColor != null)
- {
- var lightmapPath = AssetDatabase.GetAssetPath(lightmapData.lightmapColor);
- var lightmapImporter = AssetImporter.GetAtPath(lightmapPath);
- lightmapImporter.assetBundleName = bundleInfo.AssetBundleName;
- }
-
- if (lightmapData.lightmapDir!=null)
- {
- var lightmapPath = AssetDatabase.GetAssetPath(lightmapData.lightmapDir);
- var lightmapImporter = AssetImporter.GetAtPath(lightmapPath);
- lightmapImporter.assetBundleName = bundleInfo.AssetBundleName;
- }
- }
- }
// Create a PrefabInfo asset with the prefab name
// var combinedPrefabName = bundleInfo.Prefab.name.Replace(" ", "_");
var prefabInfo = CreateInstance();
-
- Debug.Log("bundleinfo prefab name: "+ bundleInfo.Prefab.name);
- Debug.Log("combined prefab name: "+ bundleInfo.Prefab.name);
-
+
+ Debug.Log("bundleinfo prefab name: " + bundleInfo.Prefab.name);
+ Debug.Log("combined prefab name: " + bundleInfo.Prefab.name);
+
prefabInfo.prefabName = bundleInfo.Prefab.name;
// bundleInfo.AssetBundleName = combinedPrefabName;
@@ -215,5 +187,10 @@ private static void EnsureDirectoryExists(string path)
Directory.CreateDirectory(path);
}
}
+
+ private BuildTarget GetBuildTarget(AWSIMBuildTargets.SupportedBuildTargets supportedBuildTargets)
+ {
+ return (BuildTarget)supportedBuildTargets;
+ }
}
-}
+}
\ No newline at end of file