Chipmunk
372c794a84
* Refactored the assetbundle building script (and added a temporary workaround because for some reason the filenames are now lowercase). * Changed the style used for preprocessor directives. * Fixed PlayFab, and as such cake race should now work. * Refactored NetworkManager * Fixed integer overflows in `TimeManager.ConvertDateTime2Seconds(DateTime)` and `Spine.AnimationState.Update(Single)`. This fixes the instant crashes on development builds. * Fixed `AnimationCurve`s in levels by telling unity not to strip the `AnimationCurve` class using a `link.xml` file. This should fix crashes in levels such as Little Pig Adventure. * Updated README.md
35 lines
No EOL
1.3 KiB
C#
35 lines
No EOL
1.3 KiB
C#
using UnityEditor;
|
|
using System.IO;
|
|
|
|
public class CreateAssetBundles
|
|
{
|
|
[MenuItem("Assets/Build AssetBundles")]
|
|
static void BuildAllAssetBundles()
|
|
{
|
|
string outputDirectory = "Assets/AssetBundles";
|
|
BuildTarget buildTarget = EditorUserBuildSettings.activeBuildTarget;
|
|
BuildAssetBundleOptions flags = BuildAssetBundleOptions.None;
|
|
if (buildTarget == BuildTarget.WebGL) flags |= BuildAssetBundleOptions.ChunkBasedCompression;
|
|
|
|
if (!Directory.Exists(outputDirectory)) Directory.CreateDirectory(outputDirectory);
|
|
|
|
BuildPipeline.BuildAssetBundles(outputDirectory, flags, buildTarget);
|
|
|
|
// HACK: Rename asset bundles to have the correct casing (temporary solution for until I know why the filenames are lowercase)
|
|
foreach (string filepath in Directory.EnumerateFiles(outputDirectory))
|
|
{
|
|
|
|
string extension = Path.GetExtension(filepath);
|
|
if (extension != ".unity3d") continue;
|
|
string name = Path.GetFileNameWithoutExtension(filepath);
|
|
string[] parts = name.Split('_');
|
|
for (int i = 0; i < parts.Length; i++) parts[i] = char.ToUpperInvariant(parts[i][0]) + parts[i].Substring(1).ToLowerInvariant();
|
|
string fixedName = string.Join("_", parts);
|
|
if (name != fixedName)
|
|
{
|
|
string dirpath = Path.GetDirectoryName(filepath);
|
|
File.Move(filepath, dirpath + "/" + fixedName + extension);
|
|
}
|
|
}
|
|
}
|
|
} |