Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
2
Question by charmi212121 · Feb 09, 2016 at 12:53 PM · c#editorjsonmissingmethodexceptioneditorutility

Missing Method Exception when trying to access EditorJsonUtility class methods

Hi, I want to convert unity game object to json object , So I used the EditorJsonUtility class for this purpose, but it seems that editor isn't able to find the methods of that class . I reinstalled unity(5.3.2f1) but, the problem still persists.

I have attached this script to a simple 2D game object which i want to convert to json object:

     using UnityEngine;
     using UnityEditor;
     
     public class MyObjectManager : MonoBehaviour {
     
     
         public string jsonObject;
     
     
         void Start()
         {
             jsonObject = EditorJsonUtility.ToJson(gameObject);
             Debug.Log(jsonObject);
         }
     }

Here's a snippet of the error :

alt text

Any help will be appreciated!!

capture.png (20.4 kB)
Comment
Add comment · Show 6
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Adam-Buckner ♦♦ · Feb 09, 2016 at 01:10 PM 0
Share

@charmi212121 I've approved your post. I've contacted an agent in support, as I'm unclear about the EditorJasonUtility.

Are you aware that this is an EDITOR utility and is not meant to be used at Runtime, as far as I know? What was your intended use for this Class?

In either case, I'm not sure it should be throwing an error at run-time, so I'll have someone look into it.

avatar image charmi212121 Adam-Buckner ♦♦ · Feb 09, 2016 at 02:01 PM 0
Share

Yes @$$anonymous$$I'm aware about it being used in editor scripts. Originally I've used the EditorJsonUtility class methods in a custom inspector script extending the editor class, the same error followed there.

$$anonymous$$y intended use was to serialize the game object into a file, but the unity game object couldn't be serialized by using serializable so i found that EditorJsonUtility class had just the right functions that served my purpose.

avatar image danijmn · Feb 15, 2016 at 12:10 PM 0
Share

Can confirm the existence of this problem. Have attempted to generate a JSON representation of multiple types of objects deriving from UnityEngine.Object to no avail. Yes, I am aware that this is an editor utility.

Also, it doesn't help that, apparently, this functionality was removed from JsonUtility in 5.3.0, at least judging from the beta release notes.

avatar image elenzil · Feb 15, 2016 at 07:53 PM 0
Share

PList document support also seems to have been removed in 5.3. $$anonymous$$y work-around was to include the source myself.

avatar image meat5000 ♦ · Feb 15, 2016 at 08:53 PM 0
Share

How about using the regular version?

http://docs.unity3d.com/ScriptReference/JsonUtility.html

Then adding the ExecuteInEdit$$anonymous$$ode attribute?

avatar image danijmn meat5000 ♦ · Feb 16, 2016 at 10:31 AM 0
Share

I see what you mean but you can't make it work like that. To be clear it is perfectly possible to use JsonUtility, even in the editor, the problem is that somewhere within the C++ side of things Unity decided to prevent serializing "non-user-defined UnityEngine.Object types".

Presumably there must have been a good reason for that (I hope), anyway the problem is that EditorJsonUtility is broken because...well...it's missing from 5.3.2, even though it is listed in the docs as having been added to the API in 5.3.2!

4 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by RichardFine · Feb 22, 2016 at 02:57 PM

This is a bug in Unity 5.3. I've just fixed it (and written tests to ensure it does not happen again) and will get the fix into a patch release ASAP.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image jorgenpt · Feb 24, 2016 at 07:40 PM 0
Share

Not included in 5.3.3p1? :(

avatar image
0

Answer by Neodrop · Mar 17, 2016 at 05:57 AM

@RichardFine Still no fixes in 5.3.4. But mentioned in beta 5.4.b9 What's wrong with current stable releases?

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image superpig ♦♦ · Jul 27, 2016 at 01:55 AM 0
Share

The fix should have landed in 5.3.4p1.

avatar image
0

Answer by ZXCZXCZXZXC · Nov 25, 2016 at 06:54 AM

It's fixed in 5.3.5f1,

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by unity_Tt-zftHUdh007w · Aug 19, 2020 at 11:32 AM

@RichardFine If you patched it, then why is it still happening in the 2020 version? Here is the error: "MissingMethodException: Attempted to access a missing method. UnityEditor.MenuUtils.ExtractMenuItemWithPath (System.String menuString, UnityEditor.GenericMenu menu, System.String replacementMenuString, UnityEngine.Object[] temporaryContext, System.Int32 userData, System.Action`3[T1,T2,T3] onBeforeExecuteCallback, System.Action`3[T1,T2,T3] onAfterExecuteCallback) (at :0) UnityEditor.SceneHierarchy.AddCreateGameObjectItemsToMenu (UnityEditor.GenericMenu menu, UnityEngine.Object[] context, System.Boolean includeCreateEmptyChild, System.Boolean includeGameObjectInPath, System.Int32 targetSceneHandle) (at :0) UnityEditor.SceneHierarchy.CreateGameObjectContextClick (UnityEditor.GenericMenu menu, System.Int32 contextClickedItemID) (at :0) UnityEditor.SceneHierarchy.ContextClickOutsideItems () (at :0) UnityEditor.IMGUI.Controls.TreeViewController.HandleUnusedEvents () (at :0) UnityEditor.IMGUI.Controls.TreeViewController.OnGUI (UnityEngine.Rect rect, System.Int32 keyboardControlID) (at :0) UnityEditor.SceneHierarchy.DoTreeView (System.Single searchPathHeight) (at :0) UnityEditor.SceneHierarchy.OnGUI (UnityEngine.Rect rect) (at :0) UnityEditor.SceneHierarchyWindow.DoSceneHierarchy () (at :0) UnityEditor.SceneHierarchyWindow.OnGUI () (at :0) UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition, UnityEngine.Rect viewRect) (at :0) UnityEditor.DockArea.DrawView (UnityEngine.Rect viewRect, UnityEngine.Rect dockAreaRect) (at :0) UnityEditor.DockArea.OldOnGUI () (at :0) UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize, System.Action onGUIHandler, System.Boolean canAffectFocus) (at :0) UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Action onGUIHandler, System.Boolean canAffectFocus) (at :0) UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Action onGUIHandler, System.Boolean canAffectFocus) (at :0) UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Boolean canAffectFocus) (at :0) UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUIRaw (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) (at :0) UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUI (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) (at :0) UnityEngine.UIElements.IMGUIContainer.HandleEvent (UnityEngine.UIElements.EventBase evt) (at :0) UnityEngine.UIElements.EventDispatchUtilities.PropagateEvent (UnityEngine.UIElements.EventBase evt) (at :0) UnityEngine.UIElements.MouseEventDispatchingStrategy.SendEventToRegularTarget (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel) (at :0) UnityEngine.UIElements.MouseEventDispatchingStrategy.SendEventToTarget (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel) (at :0) UnityEngine.UIElements.MouseEventDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel iPanel) (at :0) UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, System.Boolean imguiEventIsInitiallyUsed) (at :0) UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at :0) UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at :0) UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at :0) UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at :0) UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at :0) UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at :0) UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at :0) UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at :0) "

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image bonfacemuriithitszela · Apr 15, 2021 at 12:24 PM 0
Share

did you find a solution to the 2020 version?

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

14 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Distribute terrain in zones 3 Answers

Initialising List array for use in a custom Editor 1 Answer

Multiple Cars not working 1 Answer

Stop a MonoBehavior from being addable as a script? 0 Answers

EditorApplication.projectWindowItemOnGUI and sub assets 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges