Class CoreEditorUtility
Provides a set of various utility functions for the AlchemyBow.Core editor windows.
Namespace: AlchemyBow.Core.Editor.Utilities
Assembly: AlchemyBow.Core.Editor.dll
Syntax
public static class CoreEditorUtility
Methods
AssetsPathToSystemPath(string, out string)
Converts a project local path (starting with "Assets") to an absolute system path.
Declaration
public static bool AssetsPathToSystemPath(string assetsPath, out string systemPath)
Parameters
| Type | Name | Description |
|---|---|---|
| string | assetsPath | A project local path (starting with "Assets"). |
| string | systemPath | The result absolute system path. |
Returns
| Type | Description |
|---|---|
| bool |
|
CheckIfCanCreateFilesInFolderAndLogErrors(string, params string[])
Checks if files with the specified names can be created in the specified folder (inside the 'Assets' folder) and logs errors to the console.
Declaration
public static bool CheckIfCanCreateFilesInFolderAndLogErrors(string folder, params string[] fileNames)
Parameters
| Type | Name | Description |
|---|---|---|
| string | folder | The folder (inside the 'Assets' folder). |
| string[] | fileNames | The file names. |
Returns
| Type | Description |
|---|---|
| bool |
|
EnsureOnlyForwardSlashes(string)
Replaces all backslashes with forward slashes.
Declaration
public static string EnsureOnlyForwardSlashes(string value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | value | The initial value. |
Returns
| Type | Description |
|---|---|
| string | A value with all backslashes replaced by forward slashes. |
FindAllCoreControllerTypes(Type)
Finds the types of all non-abstract CoreController subclasses for the specified CoreProjectContext type.
Declaration
public static Type[] FindAllCoreControllerTypes(Type projectContextType)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | projectContextType | The project context type used to filter the result. |
Returns
| Type | Description |
|---|---|
| Type[] | The types of all non-abstract |
FindAllCoreProjectContextTypes()
Finds the types of all non-abstract CoreProjectContext subclasses.
Declaration
public static Type[] FindAllCoreProjectContextTypes()
Returns
| Type | Description |
|---|---|
| Type[] | The types of all non-abstract |
FocusProjectWindowAndPingObject(Object)
Focuses the project window and pings the specified object.
Declaration
public static void FocusProjectWindowAndPingObject(Object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| Object | obj | The object to ping. |
FolderField(string, string)
Makes a field for selecting folders inside the 'Assets' folder.
Declaration
public static string FolderField(string label, string currentFolder)
Parameters
| Type | Name | Description |
|---|---|---|
| string | label | The label to display in front of the field. |
| string | currentFolder | The current folder. |
Returns
| Type | Description |
|---|---|
| string | The folder selected by user if modified and valid; Otherwise, the current folder. |
GetAllCoreFolders()
Gets all 'Assets/.../Resources/Core' folders in the project.
Declaration
public static string[] GetAllCoreFolders()
Returns
| Type | Description |
|---|---|
| string[] | An array of 'Assets/.../Resources/Core' folders. |
GetAllResourcesFolders()
Gets all 'Assets/.../Resources' folders in the project.
Declaration
public static string[] GetAllResourcesFolders()
Returns
| Type | Description |
|---|---|
| string[] | An array of 'Assets/.../Resources' folders. |
GetCoreProjectContextResourcesPath(Type)
Gets the resource path for the specified core project context type.
Declaration
public static string GetCoreProjectContextResourcesPath(Type coreProjectContextType)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | coreProjectContextType | The core project context type. |
Returns
| Type | Description |
|---|---|
| string | The resource path for the specified core project context type. |
GetProjectName()
Determines the name of the Unity project.
Declaration
public static string GetProjectName()
Returns
| Type | Description |
|---|---|
| string | The name of the Unity project. |
IsValidClassName(string)
Validates the class name according to the (English) identifier naming rules.
Declaration
public static bool IsValidClassName(string className)
Parameters
| Type | Name | Description |
|---|---|---|
| string | className | The class name. |
Returns
| Type | Description |
|---|---|
| bool |
|
IsValidNamespaceName(string)
Validates the namespace name according to the (English) identifier naming rules.
Declaration
public static bool IsValidNamespaceName(string namespaceName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | namespaceName | The namespace name. |
Returns
| Type | Description |
|---|---|
| bool |
|
LoadCoreProjectContextFromResources(Type)
Loads the prefab for the specified core project context type from resources.
Declaration
public static GameObject LoadCoreProjectContextFromResources(Type coreProjectContextType)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | coreProjectContextType | The core project context type. |
Returns
| Type | Description |
|---|---|
| GameObject | The prefab if it exists; Otherwise, |
SystemPathToAssetsPath(string, out string)
Converts an absolute system path to a project local path (starting with "Assets").
Declaration
public static bool SystemPathToAssetsPath(string systemPath, out string assetsPath)
Parameters
| Type | Name | Description |
|---|---|---|
| string | systemPath | An absolute system path. |
| string | assetsPath | The result project local path (starting with "Assets"). |
Returns
| Type | Description |
|---|---|
| bool |
|
TryGetCoreFolderAt(string)
Attempts to find or create the best match for '.../Resources/Core' in the specified folder.
Declaration
public static string TryGetCoreFolderAt(string parentFolder)
Parameters
| Type | Name | Description |
|---|---|---|
| string | parentFolder | The parent folder for '.../Resources/Core'. |
Returns
| Type | Description |
|---|---|
| string | The folder if succeeded; Otherwise, |
TryPingScript(Type)
Attempts to ping a mono script for the specified type.
Declaration
public static bool TryPingScript(Type type)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | type | The type. |
Returns
| Type | Description |
|---|---|
| bool |
|