forked from ExtendRealityLtd/VRTK
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(Editor): prevent crash on build due to UnityEditor
The method used for generating the labels in the Unity Custom Editors was located in the `Utilities` script which is included in the main build, however this script included the `UnityEditor` package which doesn't get included at build time and therefore would crash any builds. The solution is to have an Editor Utilities script within the Editor directory as that doesn't get included in the build and keeps the build files clean.
- Loading branch information
1 parent
695a33c
commit ff74eae
Showing
5 changed files
with
39 additions
and
20 deletions.
There are no files selected for viewing
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
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,17 @@ | ||
namespace VRTK | ||
{ | ||
using UnityEngine; | ||
using UnityEditor; | ||
using System; | ||
|
||
public class VRTK_EditorUtilities : MonoBehaviour | ||
{ | ||
public static GUIContent BuildGUIContent<T>(string fieldName, string displayOverride = null) | ||
{ | ||
var displayName = (displayOverride != null ? displayOverride : ObjectNames.NicifyVariableName(fieldName)); | ||
var fieldInfo = typeof(T).GetField(fieldName); | ||
var tooltipAttribute = (TooltipAttribute)Attribute.GetCustomAttribute(fieldInfo, typeof(TooltipAttribute)); | ||
return (tooltipAttribute == null ? new GUIContent(displayName) : new GUIContent(displayName, tooltipAttribute.tooltip)); | ||
} | ||
} | ||
} |
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
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