Class ShareUtils
A collection of utility methods used by the Share Package
Namespace: Unity.Connect.Share.Editor
Syntax
public static class ShareUtils
Fields
DefaultGameName
the default name of every uploaded game
Declaration
public const string DefaultGameName = "Untitled"
Field Value
Type | Description |
---|---|
String |
MaxDisplayedBuilds
The max number of builds that can be displayed in the UI at the same time
Declaration
public const int MaxDisplayedBuilds = 10
Field Value
Type | Description |
---|---|
Int32 |
Methods
AddBuildDirectory(String)
Adds a directory to the list of tracked builds
Declaration
public static void AddBuildDirectory(string buildPath)
Parameters
Type | Name | Description |
---|---|---|
String | buildPath | The path to a build |
BuildIsCompatibleFor2019_3(String, String)
Determines whether a build is valid or not, according to Unity 2019.3 WebGL build standard output
Declaration
public static bool BuildIsCompatibleFor2019_3(string buildPath, string descriptorFileName)
Parameters
Type | Name | Description |
---|---|---|
String | buildPath | The path to a build |
String | descriptorFileName |
Returns
Type | Description |
---|---|
Boolean | True if the build follows the standard for a supported Unity version, false otherwise |
BuildIsCompatibleFor2020_2(String, String)
Determines whether a build is valid or not, according to Unity 2020.2 WebGL build standard output
Declaration
public static bool BuildIsCompatibleFor2020_2(string buildPath, string descriptorFileName)
Parameters
Type | Name | Description |
---|---|---|
String | buildPath | The path to a build |
String | descriptorFileName |
Returns
Type | Description |
---|---|
Boolean | True if the build follows the standard for a supported Unity version, false otherwise |
BuildIsValid(String)
Determines whether a build is valid or not
Declaration
public static bool BuildIsValid(string buildPath)
Parameters
Type | Name | Description |
---|---|---|
String | buildPath | The path to a build |
Returns
Type | Description |
---|---|
Boolean | True if the build follows the standard for a supported Unity version, false otherwise |
FormatBytes(UInt64)
Supports GB, MB, KB, or B
Declaration
public static string FormatBytes(ulong bytes)
Parameters
Type | Name | Description |
---|---|---|
UInt64 | bytes |
Returns
Type | Description |
---|---|
String | xB with two decimals, B with zero decimals |
GetAllBuildsDirectories()
Returns a list of MaxDisplayedBuilds build directiories, filling the gaps with empty paths
Declaration
public static List<string> GetAllBuildsDirectories()
Returns
Type | Description |
---|---|
List<String> | A list of MaxDisplayedBuilds build directiories, filling the gaps with empty paths |
GetEditorPreference(String)
Gets an editor preference for the project
Declaration
public static string GetEditorPreference(string key)
Parameters
Type | Name | Description |
---|---|---|
String | key | ID of the preference |
Returns
Type | Description |
---|---|
String | the value of the preference |
GetFilteredGameTitle(String)
Filters the name of the game, removing all spaces.
Declaration
public static string GetFilteredGameTitle(string currentGameTitle)
Parameters
Type | Name | Description |
---|---|---|
String | currentGameTitle | The original name of the game |
Returns
Type | Description |
---|---|
String | The name of the game without spaces, or a default name if the result would be invalid. |
GetFirstValidBuildPath()
Returns the first valid build path among all builds tracked
Declaration
public static string GetFirstValidBuildPath()
Returns
Type | Description |
---|---|
String |
GetSizeFolderSize(String)
Gets the size of a folder, in bytes
Declaration
public static ulong GetSizeFolderSize(string folder)
Parameters
Type | Name | Description |
---|---|---|
String | folder | The folder to analyze |
Returns
Type | Description |
---|---|
UInt64 | The size of the folder, in bytes |
GetUnityVersionOfBuild(String)
Gets the Unity version with which a WebGL build was made
Declaration
public static string GetUnityVersionOfBuild(string buildPath)
Parameters
Type | Name | Description |
---|---|---|
String | buildPath | The path to a build |
Returns
Type | Description |
---|---|
String |
RemoveBuildDirectory(String)
Removes a directory from the list of tracked builds
Declaration
public static void RemoveBuildDirectory(string buildPath)
Parameters
Type | Name | Description |
---|---|---|
String | buildPath | The path to a build |
SetEditorPreference(String, String)
Sets an editor preference for the project
Declaration
public static void SetEditorPreference(string key, string value)
Parameters
Type | Name | Description |
---|---|---|
String | key | ID of the preference |
String | value | New value |
ValidBuildExists()
Is a valid build tracked?
Declaration
public static bool ValidBuildExists()
Returns
Type | Description |
---|---|
Boolean |