Various helper functions. More...

Inheritance diagram for Crosstales.TPS.Util.Helper:
Crosstales.Common.EditorUtil.BaseEditorHelper Crosstales.Common.Util.BaseHelper

Static Public Member Functions

static bool SwitchPlatform (BuildTarget target, MobileTextureSubtarget subTarget=MobileTextureSubtarget.Generic)
 Switches the current platform to the target (legacy implementation). More...
 
static bool SwitchPlatformNew (BuildTarget target, MobileTextureSubtarget subTarget=MobileTextureSubtarget.Generic)
 Switches the current platform to the target. More...
 
static bool isCached (BuildTarget target, MobileTextureSubtarget subTarget=MobileTextureSubtarget.Generic)
 Checks if a platform is already cached. More...
 
static void DeleteCacheFromTarget (BuildTarget target, MobileTextureSubtarget subTarget=MobileTextureSubtarget.Generic)
 Deletes a cache for a target platform. More...
 
static void DeleteCache ()
 Delete the cache for all platforms. More...
 
static void SetAndroidTexture ()
 Sets the texture format under Android. More...
 
static void SetAndroidTexture ()
 
- Static Public Member Functions inherited from Crosstales.Common.EditorUtil.BaseEditorHelper
static void RestartUnity (string executeMethod="")
 Restart Unity. More...
 
static void SeparatorUI (int space=12)
 Shows a separator-UI. More...
 
static void ReadOnlyTextField (string label, string text)
 Generates a read-only text field with a label. More...
 
static void RefreshAssetDatabase (ImportAssetOptions options=ImportAssetOptions.Default)
 Refreshes the asset database. More...
 
static bool isValidBuildTarget (BuildTarget target)
 Returns the true if the BuildTarget is installed in Unity. More...
 
static BuildTarget GetBuildTargetForBuildName (string build)
 Returns the BuildTarget for a build name, like 'win64'. More...
 
static string GetBuildNameFromBuildTarget (BuildTarget build)
 Returns the build name for a BuildTarget. More...
 
static System.Collections.Generic.List< T > FindAssetsByType< T > ()
 Returns assets for a certain type. More...
 
static T CreateAsset< T > (string name, bool showSaveFileBrowser=true)
 Create and return a new asset in a smart location based on the current selection and then select it. More...
 
static void InstantiatePrefab (string prefabName, string path)
 Instantiates a prefab. More...
 
- Static Public Member Functions inherited from Crosstales.Common.Util.BaseHelper
static string CreateString (string generateChars, int stringLength)
 Creates a string of characters with a given length. More...
 
static System.Collections.Generic.List< string > SplitStringToLines (string text, bool ignoreCommentedLines=true, int skipHeaderLines=0, int skipFooterLines=0)
 Split the given text to lines and return it as list. More...
 
static string FormatBytesToHRF (long bytes, bool useSI=false)
 Format byte-value to Human-Readable-Form. More...
 
static string FormatSecondsToHRF (double seconds)
 Format seconds to Human-Readable-Form. More...
 
static Color HSVToRGB (float h, float s, float v, float a=1f)
 Generate nice HSV colors. Based on https://gist.github.com/rje/6206099 More...
 
static string GenerateLoremIpsum (int length, int minSentences=1, int maxSentences=int.MaxValue, int minWords=1, int maxWords=15)
 Generates a "Lorem Ipsum" based on various parameters. More...
 
static string LanguageToISO639 (SystemLanguage language)
 Converts a SystemLanguage to an ISO639-1 code. Returns "en" if the SystemLanguage could not be converted. More...
 
static SystemLanguage ISO639ToLanguage (string isoCode)
 Converts an ISO639-1 code to a SystemLanguage. Returns SystemLanguage.English if the code could not be converted. More...
 
static object InvokeMethod (string className, string methodName, System.Reflection.BindingFlags flags=System.Reflection.BindingFlags.Static|System.Reflection.BindingFlags.Public, params object[] parameters)
 Invokes a method on a full qualified class. More...
 
static string GetArgument (string name)
 Returns an argument for a name from the url or command line. More...
 
static string[] GetArguments ()
 Returns all arguments from the url or command line. More...
 
static System.Collections.Generic.Dictionary< string, System.Collections.Generic.List< string > > ParseJSON (string json)
 Parses a given JSON into a dictionary with key and values Note: this is a very basic implementation for simple JSON-strings - don't expect it to work with complex (e.g. nested) JSONs More...
 

Static Public Attributes

static Texture2D Logo_Asset => loadImage(ref logo_asset, "logo_asset_pro.png")
 
static Texture2D Logo_Asset_Small => loadImage(ref logo_asset_small, "logo_asset_small_pro.png")
 
static Texture2D Icon_Show => loadImage(ref icon_show, "icon_show.png")
 
static Texture2D Icon_Delete_Big => loadImage(ref icon_delete_big, "icon_delete_big.png")
 
static Texture2D Logo_Windows => loadImage(ref logo_windows, "logo_windows.png")
 
static Texture2D Logo_Mac => loadImage(ref logo_mac, "logo_mac.png")
 
static Texture2D Logo_Linux => loadImage(ref logo_linux, "logo_linux.png")
 
static Texture2D Logo_Ios => loadImage(ref logo_ios, "logo_ios.png")
 
static Texture2D Logo_Android => loadImage(ref logo_android, "logo_android.png")
 
static Texture2D Logo_Wsa => loadImage(ref logo_wsa, "logo_wsa.png")
 
static Texture2D Logo_Webgl => loadImage(ref logo_webgl, "logo_webgl.png")
 
static Texture2D Logo_Tvos => loadImage(ref logo_tvos, "logo_tvos.png")
 
static Texture2D Logo_Ps4 => loadImage(ref logo_ps4, "logo_ps4.png")
 
static Texture2D Logo_Xboxone => loadImage(ref logo_xboxone, "logo_xboxone.png")
 
static Texture2D Logo_Switch => loadImage(ref logo_switch, "logo_switch.png")
 
static Texture2D Icon_Cachefull => loadImage(ref icon_cachefull, "icon_cachefull.png")
 
static Texture2D Icon_Cacheempty => loadImage(ref icon_cacheempty, "icon_cacheempty.png")
 
static bool hasActiveArchitecturePlatforms => Config.PLATFORM_WINDOWS
 Checks if the user has selected any architecture platforms. More...
 
static bool hasActiveTexturePlatforms => Config.PLATFORM_ANDROID
 Checks if the user has selected any texture platforms. More...
 
static bool hasCache => Crosstales.Common.Util.FileHelper.ExistsDirectory(Config.PATH_CACHE)
 Checks if a cache for the project exists. More...
 
static bool hasActivePlatforms
 Returns true if there is a platform enabled. More...
 
- Static Public Attributes inherited from Crosstales.Common.EditorUtil.BaseEditorHelper
static Texture2D Logo_Asset_BWF => loadImage(ref logo_asset_bwf, "logo_asset_bwf.png")
 
static Texture2D Logo_Asset_DJ => loadImage(ref logo_asset_dj, "logo_asset_dj.png")
 
static Texture2D Logo_Asset_FB => loadImage(ref logo_asset_fb, "logo_asset_fb.png")
 
static Texture2D Logo_Asset_OC => loadImage(ref logo_asset_oc, "logo_asset_oc.png")
 
static Texture2D Logo_Asset_Radio => loadImage(ref logo_asset_radio, "logo_asset_radio.png")
 
static Texture2D Logo_Asset_RTV => loadImage(ref logo_asset_rtv, "logo_asset_rtv.png")
 
static Texture2D Logo_Asset_TB => loadImage(ref logo_asset_tb, "logo_asset_tb.png")
 
static Texture2D Logo_Asset_TPB => loadImage(ref logo_asset_tpb, "logo_asset_tpb.png")
 
static Texture2D Logo_Asset_TPS => loadImage(ref logo_asset_tps, "logo_asset_tps.png")
 
static Texture2D Logo_Asset_TR => loadImage(ref logo_asset_tr, "logo_asset_tr.png")
 
static Texture2D Logo_CT => loadImage(ref logo_ct, "logo_ct.png")
 
static Texture2D Logo_Unity => loadImage(ref logo_unity, "logo_unity.png")
 
static Texture2D Icon_Save => loadImage(ref icon_save, "icon_save.png")
 
static Texture2D Icon_Reset => loadImage(ref icon_reset, "icon_reset.png")
 
static Texture2D Icon_Refresh => loadImage(ref icon_refresh, "icon_refresh.png")
 
static Texture2D Icon_Delete => loadImage(ref icon_delete, "icon_delete.png")
 
static Texture2D Icon_Folder => loadImage(ref icon_folder, "icon_folder.png")
 
static Texture2D Icon_Plus => loadImage(ref icon_plus, "icon_plus.png")
 
static Texture2D Icon_Minus => loadImage(ref icon_minus, "icon_minus.png")
 
static Texture2D Icon_Manual => loadImage(ref icon_manual, "icon_manual.png")
 
static Texture2D Icon_API => loadImage(ref icon_api, "icon_api.png")
 
static Texture2D Icon_Forum => loadImage(ref icon_forum, "icon_forum.png")
 
static Texture2D Icon_Product => loadImage(ref icon_product, "icon_product.png")
 
static Texture2D Icon_Check => loadImage(ref icon_check, "icon_check.png")
 
static Texture2D Social_Discord => loadImage(ref social_Discord, "social_Discord.png")
 
static Texture2D Social_Facebook => loadImage(ref social_Facebook, "social_Facebook.png")
 
static Texture2D Social_Twitter => loadImage(ref social_Twitter, "social_Twitter.png")
 
static Texture2D Social_Youtube => loadImage(ref social_Youtube, "social_Youtube.png")
 
static Texture2D Social_Linkedin => loadImage(ref social_Linkedin, "social_Linkedin.png")
 
static Texture2D Video_Promo => loadImage(ref video_promo, "video_promo.png")
 
static Texture2D Video_Tutorial => loadImage(ref video_tutorial, "video_tutorial.png")
 
static Texture2D Icon_Videos => loadImage(ref icon_videos, "icon_videos.png")
 
static Texture2D Icon_3p_Assets => loadImage(ref icon_3p_assets, "icon_3p_assets.png")
 
static Texture2D Asset_PlayMaker => loadImage(ref asset_PlayMaker, "asset_PlayMaker.png")
 
static Texture2D Asset_VolumetricAudio => loadImage(ref asset_VolumetricAudio, "asset_VolumetricAudio.png")
 
static Texture2D Asset_RockTomate => loadImage(ref asset_rocktomate, "asset_rocktomate.png")
 
static Texture2D Asset_RTFB => loadImage(ref asset_RTFB, "asset_RTFB.png")
 
- Static Public Attributes inherited from Crosstales.Common.Util.BaseHelper
static bool ApplicationIsPlaying = Application.isPlaying
 
static bool isEditorMode => isEditor && !ApplicationIsPlaying
 Checks if we are in Editor mode. More...
 
static bool isStandalonePlatform => isWindowsPlatform || isMacOSPlatform || isLinuxPlatform
 Checks if the current platform is standalone (Windows, macOS or Linux). More...
 
static bool isWebPlatform => isWebGLPlatform
 Checks if the current platform is Web (WebPlayer or WebGL). More...
 
static bool isWindowsBasedPlatform => isWindowsPlatform || isWSAPlatform || isXboxOnePlatform
 Checks if the current platform is Windows-based (Windows standalone, WSA or XboxOne). More...
 
static bool isWSABasedPlatform => isWSAPlatform || isXboxOnePlatform
 Checks if the current platform is WSA-based (WSA or XboxOne). More...
 
static bool isAppleBasedPlatform => isMacOSPlatform || isIOSPlatform || isTvOSPlatform
 Checks if the current platform is Apple-based (macOS standalone, iOS or tvOS). More...
 
static bool isIOSBasedPlatform => isIOSPlatform || isTvOSPlatform
 Checks if the current platform is iOS-based (iOS or tvOS). More...
 
static bool isMobilePlatform => isAndroidPlatform || isIOSBasedPlatform
 Checks if the current platform is mobile (Android and iOS). More...
 
static bool isEditor => isWindowsEditor || isMacOSEditor || isLinuxEditor
 Checks if we are inside the Editor. More...
 

Properties

static string?? CacheInfo [get]
 Scans the total cache usage of TPS. More...
 
static bool isDeleting [get]
 Returns true if the cache is being deleted. More...
 
static bool? isV2enabled [get]
 Returns true if V2 of the AssetDatabase is enabled. More...
 
- Properties inherited from Crosstales.Common.Util.BaseHelper
static System.Globalization.CultureInfo BaseCulture [get]
 The current culture of the application. More...
 
static bool isIL2CPP [get]
 Checks if the current build target uses IL2CPP. More...
 
static Crosstales.Common.Model.Enum.PlatformCurrentPlatform [get]
 Returns the current platform. More...
 
static int AndroidAPILevel [get]
 Returns the Android API level of the current device (Android only)". More...
 
static bool isWindowsPlatform [get]
 Checks if the current platform is Windows. More...
 
static bool isMacOSPlatform [get]
 Checks if the current platform is OSX. More...
 
static bool isLinuxPlatform [get]
 Checks if the current platform is Linux. More...
 
static bool isAndroidPlatform [get]
 Checks if the current platform is Android. More...
 
static bool isIOSPlatform [get]
 Checks if the current platform is iOS. More...
 
static bool isTvOSPlatform [get]
 Checks if the current platform is tvOS. More...
 
static bool isWSAPlatform [get]
 Checks if the current platform is WSA. More...
 
static bool isXboxOnePlatform [get]
 Checks if the current platform is XboxOne. More...
 
static bool isPS4Platform [get]
 Checks if the current platform is PS4. More...
 
static bool isWebGLPlatform [get]
 Checks if the current platform is WebGL. More...
 
static bool isWindowsEditor [get]
 Checks if we are inside the Windows Editor. More...
 
static bool isMacOSEditor [get]
 Checks if we are inside the macOS Editor. More...
 
static bool isLinuxEditor [get]
 Checks if we are inside the Linux Editor. More...
 

Additional Inherited Members

- Static Protected Attributes inherited from Crosstales.Common.Util.BaseHelper
static readonly System.Random _rnd = new System.Random()
 

Detailed Description

Various helper functions.

Member Function Documentation

◆ DeleteCache()

static void Crosstales.TPS.Util.Helper.DeleteCache ( )
static

Delete the cache for all platforms.

◆ DeleteCacheFromTarget()

static void Crosstales.TPS.Util.Helper.DeleteCacheFromTarget ( BuildTarget  target,
MobileTextureSubtarget  subTarget = MobileTextureSubtarget.Generic 
)
static

Deletes a cache for a target platform.

Parameters
targetPlatform to delete the cache
subTargetTexture format (Android, optional)

◆ isCached()

static bool Crosstales.TPS.Util.Helper.isCached ( BuildTarget  target,
MobileTextureSubtarget  subTarget = MobileTextureSubtarget.Generic 
)
static

Checks if a platform is already cached.

Parameters
targetPlatform to check
subTargetTexture format (Android, optional)
Returns
True if the platform is already cached

◆ SetAndroidTexture()

static void Crosstales.TPS.Util.Helper.SetAndroidTexture ( )
static

Sets the texture format under Android.

◆ SwitchPlatform()

static bool Crosstales.TPS.Util.Helper.SwitchPlatform ( BuildTarget  target,
MobileTextureSubtarget  subTarget = MobileTextureSubtarget.Generic 
)
static

Switches the current platform to the target (legacy implementation).

Parameters
targetTarget platform for the switch
subTargetTexture format (Android, optional)
Returns
True if the switch was successful.

◆ SwitchPlatformNew()

static bool Crosstales.TPS.Util.Helper.SwitchPlatformNew ( BuildTarget  target,
MobileTextureSubtarget  subTarget = MobileTextureSubtarget.Generic 
)
static

Switches the current platform to the target.

Parameters
targetTarget platform for the switch
subTargetTexture format (Android, optional)
Returns
True if the switch was successful.

Member Data Documentation

◆ hasActiveArchitecturePlatforms

bool Crosstales.TPS.Util.Helper.hasActiveArchitecturePlatforms => Config.PLATFORM_WINDOWS
static

Checks if the user has selected any architecture platforms.

Returns
True if the user has selected any architecture platforms.

◆ hasActivePlatforms

bool Crosstales.TPS.Util.Helper.hasActivePlatforms
static
Initial value:
=>
Config.PLATFORM_WINDOWS ||
Config.PLATFORM_MAC ||
Config.PLATFORM_LINUX ||
Config.PLATFORM_ANDROID ||
Config.PLATFORM_IOS ||
Config.PLATFORM_WSA ||
Config.PLATFORM_WEBGL ||
Config.PLATFORM_TVOS ||
Config.PLATFORM_PS4 ||
Config.PLATFORM_XBOXONE ||
Config.PLATFORM_SWITCH

Returns true if there is a platform enabled.

Returns
True if there is a platform enabled.

◆ hasActiveTexturePlatforms

bool Crosstales.TPS.Util.Helper.hasActiveTexturePlatforms => Config.PLATFORM_ANDROID
static

Checks if the user has selected any texture platforms.

Returns
True if the user has selected any texture platforms.

◆ hasCache

bool Crosstales.TPS.Util.Helper.hasCache => Crosstales.Common.Util.FileHelper.ExistsDirectory(Config.PATH_CACHE)
static

Checks if a cache for the project exists.

Returns
True if a cache for the project exists

Property Documentation

◆ CacheInfo

string?? Crosstales.TPS.Util.Helper.CacheInfo
staticget

Scans the total cache usage of TPS.

Returns
Total cache usage information.

◆ isDeleting

bool Crosstales.TPS.Util.Helper.isDeleting
staticget

Returns true if the cache is being deleted.

Returns
True if the cache is being deleted.

◆ isV2enabled

bool? Crosstales.TPS.Util.Helper.isV2enabled
staticget

Returns true if V2 of the AssetDatabase is enabled.

Returns
True if V2 of the AssetDatabase is enabled.

The documentation for this class was generated from the following file:
  • C:/Users/slaub/Unity/assets/TurboSwitch/TurboSwitch/Assets/Plugins/crosstales/TurboSwitch/Scripts/Editor/Util/Helper.cs