-
Notifications
You must be signed in to change notification settings - Fork 168
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 #737 from leapmotion/ie-devx-patch-fix
Add Various DevX warnings when Importing the Interaction Engine to a Fresh Project
- Loading branch information
Showing
4 changed files
with
128 additions
and
23 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
61 changes: 61 additions & 0 deletions
61
Assets/LeapMotion/Modules/InteractionEngine/Scripts/Internal/InteractionPreferences.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,61 @@ | ||
using UnityEngine; | ||
#if UNITY_EDITOR | ||
using UnityEditor; | ||
#endif | ||
|
||
namespace Leap.Unity.Interaction.Internal { | ||
|
||
#if UNITY_EDITOR | ||
public static class InteractionPreferences { | ||
public const float MAX_GRAVITY_MAGNITUDE = 4.905f; | ||
|
||
#if UNITY_ANDROID | ||
public const float MAX_TIMESTEP = 1.0f / 60.0f; | ||
#else | ||
public const float MAX_TIMESTEP = 1.0f / 90.0f; | ||
#endif | ||
|
||
public const string PROMPT_FOR_GRAVITY_KEY = "InteractionEngine_ShouldPrompForGravity"; | ||
public const string PROMPT_FOR_PHYSICS_TIMESTEP = "InteractionEngine_ShouldPrompForTimestep"; | ||
|
||
private static GUIContent _gravityPrompContent; | ||
private static GUIContent _timestepPrompContent; | ||
|
||
static InteractionPreferences() { | ||
_gravityPrompContent = new GUIContent("Validate Gravity Magnitude", "Should prompt the user if the magnitude of the gravity vector is higher than the recommended amount?"); | ||
_timestepPrompContent = new GUIContent("Validate Physics Timestep", "Should prompt the user if the physics timestep is larger then the recommended value?"); | ||
} | ||
|
||
public static bool shouldPrompForGravity { | ||
get { | ||
return EditorPrefs.GetBool(PROMPT_FOR_GRAVITY_KEY, defaultValue: true); | ||
} | ||
set { | ||
EditorPrefs.SetBool(PROMPT_FOR_GRAVITY_KEY, value); | ||
} | ||
} | ||
|
||
public static bool shouldPrompForPhysicsTimestep { | ||
get { | ||
return EditorPrefs.GetBool(PROMPT_FOR_PHYSICS_TIMESTEP, defaultValue: true); | ||
} | ||
set { | ||
EditorPrefs.SetBool(PROMPT_FOR_PHYSICS_TIMESTEP, value); | ||
} | ||
} | ||
|
||
[PreferenceItem("Leap Interaction")] | ||
private static void preferencesGUI() { | ||
bool newGravityValue = EditorGUILayout.Toggle(_gravityPrompContent, shouldPrompForGravity); | ||
if (newGravityValue != shouldPrompForGravity) { | ||
shouldPrompForGravity = newGravityValue; | ||
} | ||
|
||
bool newTimestepValue = EditorGUILayout.Toggle(_timestepPrompContent, shouldPrompForPhysicsTimestep); | ||
if (newTimestepValue != shouldPrompForPhysicsTimestep) { | ||
shouldPrompForPhysicsTimestep = newTimestepValue; | ||
} | ||
} | ||
} | ||
#endif | ||
} |
12 changes: 12 additions & 0 deletions
12
Assets/LeapMotion/Modules/InteractionEngine/Scripts/Internal/InteractionPreferences.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.