Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Question Python Script Editor NullReferenceException

Discussion in 'Formats & External Tools Previews' started by Demkeys, Mar 27, 2022.

  1. Demkeys

    Demkeys

    Joined:
    Nov 14, 2014
    Posts:
    31
    Unity Editor version: 2022.1.0b13
    Python for Unity version: 4.0.0-pre.1

    Hello, when I type Python code into the Python Script Editor and try to run it I get a NullReferenceException in the Console. Here's the full error message:

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. UnityEditor.Scripting.Python.PythonConsoleWindow.GetSelectedCode () (at Library/PackageCache/com.unity.scripting.python@4.0.0-pre.1/Editor/PythonConsoleWindow.cs:413)
    3. UnityEditor.Scripting.Python.PythonConsoleWindow.OnExecute (UnityEngine.UIElements.KeyDownEvent e) (at Library/PackageCache/com.unity.scripting.python@4.0.0-pre.1/Editor/PythonConsoleWindow.cs:290)
    4. UnityEngine.UIElements.EventCallbackFunctor`1[TEventType].Invoke (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.PropagationPhase propagationPhase) (at <3652aa4b6cef409086f6fbb71f5dec60>:0)
    5. UnityEngine.UIElements.EventCallbackRegistry.InvokeCallbacks (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.PropagationPhase propagationPhase) (at <3652aa4b6cef409086f6fbb71f5dec60>:0)
    6. UnityEngine.UIElements.CallbackEventHandler.HandleEvent (UnityEngine.UIElements.EventBase evt) (at <3652aa4b6cef409086f6fbb71f5dec60>:0)
    7. UnityEngine.UIElements.CallbackEventHandler.HandleEventAtCurrentTargetAndPhase (UnityEngine.UIElements.EventBase evt) (at <3652aa4b6cef409086f6fbb71f5dec60>:0)
    8. UnityEngine.UIElements.CallbackEventHandler.UnityEngine.UIElements.IEventHandler.HandleEvent (UnityEngine.UIElements.EventBase evt) (at <3652aa4b6cef409086f6fbb71f5dec60>:0)
    9. UnityEngine.UIElements.EventDispatchUtilities.HandleEventAcrossPropagationPath (UnityEngine.UIElements.EventBase evt) (at <3652aa4b6cef409086f6fbb71f5dec60>:0)
    10. UnityEngine.UIElements.EventDispatchUtilities.PropagateEvent (UnityEngine.UIElements.EventBase evt) (at <3652aa4b6cef409086f6fbb71f5dec60>:0)
    11. UnityEngine.UIElements.KeyboardEventDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <3652aa4b6cef409086f6fbb71f5dec60>:0)
    12. UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, System.Boolean imguiEventIsInitiallyUsed) (at <3652aa4b6cef409086f6fbb71f5dec60>:0)
    13. UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <3652aa4b6cef409086f6fbb71f5dec60>:0)
    14. UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at <3652aa4b6cef409086f6fbb71f5dec60>:0)
    15. UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at <3652aa4b6cef409086f6fbb71f5dec60>:0)
    16. UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at <3652aa4b6cef409086f6fbb71f5dec60>:0)
    17. UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at <3652aa4b6cef409086f6fbb71f5dec60>:0)
    18. UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <3652aa4b6cef409086f6fbb71f5dec60>:0)
    19. UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at <3652aa4b6cef409086f6fbb71f5dec60>:0)
    20. UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at <7d516ef400dc4126ba8d375408620e0c>:0)
    21.  
    22.  
    Can someone help with this?