Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PlayModeStateChange not found in UnityEditor namespace #162

Open
mavera3 opened this issue Mar 1, 2018 · 5 comments
Open

PlayModeStateChange not found in UnityEditor namespace #162

mavera3 opened this issue Mar 1, 2018 · 5 comments

Comments

@mavera3
Copy link

mavera3 commented Mar 1, 2018

I get this error when I put the VSCode.cs File into Assets/Plugins/Editor folder

Assets/Plugins/Editor/VSCode.cs(970,56): error CS0234: The type or namespace name PlayModeStateChange' does not exist in the namespace UnityEditor'. Are you missing an assembly reference?

Unity Editor 5.6.3xf1 Linux Personal on Ubuntu 16.04 and Visual Studio Code 1.20.1

@y0n3t4n1
Copy link
Contributor

y0n3t4n1 commented Mar 6, 2018

I'm using the following modification locally for 2017.1.3

diff --git a/Assets/Editor/VSCode.cs b/Assets/Editor/VSCode.cs
index b516da6b64..68afdb6c2b 100644
--- a/Assets/Editor/VSCode.cs
+++ b/Assets/Editor/VSCode.cs
@@ -966,7 +966,11 @@ namespace dotBunny.Unity
         /// <summary>
         /// Executed when the Editor's playmode changes allowing for capture of required data
         /// </summary>
+#if UNITY_2017_2_OR_NEWER
         static void OnPlaymodeStateChanged(UnityEditor.PlayModeStateChange state)
+#else
+        static void OnPlaymodeStateChanged()
+#endif
         {
             if (UnityEngine.Application.isPlaying && EditorApplication.isPlayingOrWillChangePlaymode)
             {
@@ -980,8 +984,13 @@ namespace dotBunny.Unity
         [UnityEditor.Callbacks.DidReloadScripts()]
         static void OnScriptReload()
         {
+#if UNITY_2017_2_OR_NEWER
             EditorApplication.playModeStateChanged -= OnPlaymodeStateChanged;
             EditorApplication.playModeStateChanged += OnPlaymodeStateChanged;
+#else
+            EditorApplication.playmodeStateChanged -= OnPlaymodeStateChanged;
+            EditorApplication.playmodeStateChanged += OnPlaymodeStateChanged;
+#endif
         }
 
         /// <summary>

@almo2001
Copy link

almo2001 commented May 7, 2018

In Unity 2017.4.2 I'm getting

Assets/VSCode/Plugins/Editor/VSCode.cs(983,31): warning CS0618: UnityEditor.EditorApplication.playmodeStateChanged' is obsolete: Use EditorApplication.playModeStateChanged and/or EditorApplication.pauseStateChanged'

@y0n3t4n1
Copy link
Contributor

It's been fixed on the master branch. Maybe we need a new release?

@reapazor
Copy link
Contributor

On the asset store? shiver

@almo2001
Copy link

I was getting my unitypackage from a Github download thing that's not maintained anymore. Getting it from the asset store worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants