question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PlayModeStateChange not found in UnityEditor namespace

See original GitHub issue

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

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
y0n3t4n1commented, 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>
0reactions
almo2001commented, May 11, 2018

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unity build error: The type or namespace name 'Editor' ...
Assets\Inventory\Items.cs(30,5): error CS0246: The type or namespace name 'CustomEditor' could not be found (are you missing a using directive ...
Read more >
Resolved - Eroor in code Unity 5.6.7f1
... The type or namespace name `PlayModeStateChange' does not exist in the namespace `UnityEditor'. Are you missing an assembly reference?
Read more >
UnityEditor&#34; namespace not found...
The problem is: The namespace “UnityEditor” can only be used if you are in the Unity Editor program. I have the same Problem,...
Read more >
Error when trying to build - Forums | Moodkie Interactive
Assets\Plugins\Easy Save 3\Editor\ES3Postprocessor.cs(64,45): error CS0246: The type or namespace name 'PlayModeStateChange' could not be found (are you missing ...
Read more >
Scripting API: UnityEditor
Represents a managed reference object that has a missing type. MediaRational, Rational number useful for expressing fractions precisely. MediaTime, Time ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found