-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #440 from umasteeringgroup/Feature-13
Feature 13
- Loading branch information
Showing
19 changed files
with
8,218 additions
and
7,037 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
...MA/Content/ShaderPackages/ShaderPackager-main/Scripts/Editor/Shaderpackager-editor.asmdef
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "Shaderpackager-editor", | ||
"rootNamespace": "", | ||
"references": [], | ||
"includePlatforms": [ | ||
"Editor" | ||
], | ||
"excludePlatforms": [], | ||
"allowUnsafeCode": false, | ||
"overrideReferences": false, | ||
"precompiledReferences": [], | ||
"autoReferenced": true, | ||
"defineConstraints": [], | ||
"versionDefines": [], | ||
"noEngineReferences": false | ||
} |
7 changes: 7 additions & 0 deletions
7
...ntent/ShaderPackages/ShaderPackager-main/Scripts/Editor/Shaderpackager-editor.asmdef.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
1,623 changes: 835 additions & 788 deletions
1,623
.../Assets/UMA/Core/Editor/Extensions/DynamicCharacterSystem/DynamicCharacterAvatarEditor.cs
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
122 changes: 122 additions & 0 deletions
122
UMAProject/Assets/UMA/Core/Editor/Scripts/UMAAddressablesBuildSample.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
using UMA; | ||
using System; | ||
using UnityEditor.Build.Reporting; | ||
using UnityEditor; | ||
using System.Linq; | ||
using System.IO; | ||
|
||
#if UMA_ADDRESSABLES | ||
public class UMAAddressablesBuildSample | ||
{ | ||
public static void Build(string destFolder, bool dev, string appName) | ||
{ | ||
// Generate the addressables for UMA, and cleanup after it | ||
GenerateUMAAddressables(); | ||
UnityEditor.AddressableAssets.Settings.AddressableAssetSettings.BuildPlayerContent(out var result); | ||
UMAPostBuildMaterialUpdate(); | ||
// Addressable bundles are built at this point, so we can build the player | ||
|
||
|
||
BuildReport buildReport = null; | ||
try | ||
{ | ||
// Build the player | ||
buildReport = BuildPlayer(destFolder, dev, appName); | ||
if (buildReport == null) | ||
{ | ||
Debug.LogError($"UMABuildScript.BuildPlayer Failed"); | ||
return; | ||
} | ||
} | ||
catch (Exception e) | ||
{ | ||
Debug.LogError($"UMABuildScript.BuildPlayer Failed: {e.Message}"); | ||
return; | ||
} | ||
} | ||
|
||
private static BuildReport BuildPlayer(string path, bool dev, string AppName) | ||
{ | ||
Debug.Log($"Building player to {path}"); | ||
// The default is development build with debugging enabled | ||
var buildOptions = BuildOptions.Development | BuildOptions.AllowDebugging; | ||
|
||
// if we don't pass true, wea are building a release build | ||
if (!dev) | ||
{ | ||
buildOptions = BuildOptions.None; | ||
} | ||
|
||
// Include the scenes speicified in the build settings | ||
// and write output to the path chosen by the user | ||
|
||
string pathName = $"{path}/{AppName}"; | ||
if (!Directory.Exists(path)) | ||
{ | ||
Directory.CreateDirectory(path); | ||
} | ||
var buildPlayerOptions = new BuildPlayerOptions() | ||
{ | ||
scenes = EditorBuildSettings.scenes.Select(scene => scene.path.ToString()).ToArray(), | ||
locationPathName = pathName, | ||
target = EditorUserBuildSettings.activeBuildTarget, | ||
options = buildOptions | ||
}; | ||
|
||
if (!dev) | ||
{ | ||
Debug.Log("Building Development Player"); | ||
} | ||
else | ||
{ | ||
Debug.Log("Building Release Player"); | ||
} | ||
|
||
return BuildPipeline.BuildPlayer(buildPlayerOptions); | ||
} | ||
|
||
public static void UMAPostBuildMaterialUpdate() | ||
{ | ||
Debug.Log($"UMAPostProcessBuild - Adding UMA resource references"); | ||
try | ||
{ | ||
UMAAssetIndexer.Instance.PostBuildMaterialFixup(); | ||
} | ||
catch (Exception ex) | ||
{ | ||
Debug.Log($"UMAPostProcessBuild - Adding UMA resource references failed with exception {ex.Message}"); | ||
} | ||
} | ||
|
||
public static void GenerateUMAAddressables() | ||
{ | ||
// Clear the index, rebuild the type arrays, and then query to project for the indexed types, and | ||
// add everything to the index. Do not add the text assets (only needed if loading characters from resources) | ||
Debug.Log("UMABuildScript - Rebuilding asset index."); | ||
UMA.UMAAssetIndexer assetIndex = UMAAssetIndexer.Instance; | ||
try | ||
{ | ||
assetIndex.PrepareBuild(); | ||
} | ||
catch (Exception ex) | ||
{ | ||
Debug.LogException(ex); | ||
} | ||
|
||
// Generate all UMA addressable labels by recipe. Every recipe gets a unique label, so when that | ||
// recipe needs to be loaded, all bundles that contain that item are demand loaded into memory. | ||
// they are unloaded when there is no active character using any of the assets. | ||
Debug.Log($"UMABuildScript - Generating UMA addressable labels."); | ||
UMAAddressablesSupport.Instance.GenerateAddressables(new SingleGroupGenerator { ClearMaterials = true }); | ||
|
||
// Make sure that the global library has a reference to every item that is not addressable. | ||
// This ensures that they item is included in resources. (Since the items are built dynamically, | ||
// they must be able to be loaded at runtime either through addressable bundles or resources). | ||
Debug.Log($"UMABuildScript - Adding UMA resource references"); | ||
assetIndex.AddReferences(); | ||
} | ||
} | ||
#endif |
11 changes: 11 additions & 0 deletions
11
UMAProject/Assets/UMA/Core/Editor/Scripts/UMAAddressablesBuildSample.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
63 changes: 63 additions & 0 deletions
63
UMAProject/Assets/UMA/Core/Editor/Scripts/UMAAddressablesBuildWindow.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
using UnityEditor; | ||
|
||
#if UMA_ADDRESSABLES | ||
public class UMAAddressablesBuildWindow : EditorWindow | ||
{ | ||
[MenuItem("UMA/Sample Addressables Build")] | ||
public static void OpenWindow() | ||
{ | ||
CreateWindow<UMAAddressablesBuildWindow>() | ||
.Init() | ||
.Show(); | ||
} | ||
|
||
private static bool dev = true; | ||
private static string appName = "UMASample.exe"; | ||
|
||
private static string DestinationFolder | ||
{ | ||
get => EditorPrefs.GetString("UMABuildPath", $"{Application.dataPath.TrimEnd("/Assets".ToCharArray())}/UMATestBuild"); | ||
set => EditorPrefs.SetString("UMABuildPath", value); | ||
} | ||
|
||
private static string AppName | ||
{ | ||
get => EditorPrefs.GetString("UMAAppName", appName); | ||
set => EditorPrefs.SetString("UMAAppName", value); | ||
} | ||
|
||
private UMAAddressablesBuildWindow Init() | ||
{ | ||
titleContent = new GUIContent("UMA Build Sample"); | ||
return this; | ||
} | ||
|
||
private void OnGUI() | ||
{ | ||
EditorGUILayout.LabelField("UMA Addressables Build Sample"); | ||
EditorGUILayout.Space(20); | ||
dev = EditorGUILayout.Toggle("Development Build", dev); | ||
AppName = EditorGUILayout.TextField("App Name", AppName); | ||
EditorGUILayout.BeginHorizontal(); | ||
|
||
DestinationFolder = EditorGUILayout.TextField("Build Path", DestinationFolder); | ||
if (GUILayout.Button("Browse")) | ||
{ | ||
DestinationFolder = EditorUtility.OpenFolderPanel("Output Folder", DestinationFolder, ""); | ||
} | ||
EditorGUILayout.EndHorizontal(); | ||
|
||
EditorGUILayout.Space(20); | ||
if (GUILayout.Button("Build Addressables")) | ||
{ | ||
UMAAddressablesBuildSample.Build(DestinationFolder,dev, AppName); | ||
} | ||
} | ||
} | ||
|
||
|
||
|
||
#endif |
11 changes: 11 additions & 0 deletions
11
UMAProject/Assets/UMA/Core/Editor/Scripts/UMAAddressablesBuildWindow.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.