Search Unity

[RELEASED] Odin Inspector & Serializer - The Ultimate Workflow Tool ★★★★★

Discussion in 'Assets and Asset Store' started by jorisshh, Jun 15, 2017.

  1. NS24

    NS24

    Joined:
    Feb 21, 2018
    Posts:
    15
  2. totsboy

    totsboy

    Joined:
    Jul 12, 2013
    Posts:
    253
    I am having an issue where the unity editor stops responding and I have to force close it when I use
    Code (CSharp):
    1. byte[] bytes = SerializationUtility.SerializeValue(data, DataFormat.Binary);
    It used to work normally before, not sure what could have affected it now. The weird thing is it still works nomally when I have a build of the game, the issue is only in the editor.
     
  3. smada-luap

    smada-luap

    Joined:
    Aug 22, 2013
    Posts:
    945
    Apologies if the solution is mentioned somewhere and if so, can you please point me in the direction of it? Thanks.

    What I'm wondering is that is it possible for Odin to specifically ignore a certain c# script and not change the inspector view for it. I have a couple of scripts with custom inspector editor files and having Odin installed it overrides what I have designed for those scripts.

    Thanks.
     
  4. jacwilso

    jacwilso

    Joined:
    Dec 24, 2016
    Posts:
    1
    I was wondering if someone could help me, I'm relatively new to Odin so this might be relatively simple, but what I want is to only use reference types for a field. I am using `Copy Reference` right now, but I don't want to have to go through menus to get that reference, I want the field to only accept reference types (and not be able to create new types). Is that possible?
     
  5. wheee09

    wheee09

    Joined:
    May 21, 2018
    Posts:
    68
    Quick question - are there any future plans to switch to UIElements?

    I hoping yes... and if that's the case, you know when? Asking mainly because my use case is for Editor Only mode.
     
  6. twiddle87

    twiddle87

    Joined:
    May 16, 2019
    Posts:
    1
    Any chance we can have TypeDrawer/TypeSelector implement filtering support?
    Long-term, I'd like to be able to do something like the following:

    Code (CSharp):
    1.  
    2. [SubclassOf(typeof(GameplayAttribute))]
    3. public Type ModifiedAttribute;
    4.  
    Your current TypeFilter attribute only works on instances rather than variables of type Type, which means I can't use it.

    TypeDrawer does most of what I want, but it has no way to restrict the types shown that I can see.

    Ideally there'd be an AttributeValueDrawer based TypeDrawer that can query its attribute for a base class, then forward that onto a new TypeSelector constructor that can then filter the list of types itself. Alternatively the attribute could specify a predicate method that the TypeSelector could defer filtering to.

    I can extend TypeDrawer such that it fetches an explicit list of types and passes that through to the selector, but at the moment that requires me to reimplement DrawPropertyLayout just to change which constructor is used when you create `TypeSelector selector` (TypeDrawer.cs:70).
     
    tylor_sunblink and Neiist like this.
  7. pdyatlov

    pdyatlov

    Joined:
    May 9, 2019
    Posts:
    5
    Odin does not compile its assemblies. Any help ?

    upload_2019-5-25_22-26-12.png
     
    luispedrofonseca and Nyphur like this.
  8. justtime

    justtime

    Joined:
    Oct 6, 2013
    Posts:
    424
    Hi there!
    I have public enum TrackKey in [System.Serializable] public class Track. Here the settings screen

    "Track" i've added manually, because wasn't added anything after scan.I also tried to add "Track.TrackKey"

    Here my error on il2cpp build
    Code (CSharp):
    1. No AOT serializer was pre-generated for the type 'Track.TrackKey'. Please use Odin's AOT generation feature to generate an AOT dll before building, and ensure that 'Track.TrackKey' is in the list of supported types after a scan. If it is not, please report an issue and add it to the list manually.
     
    Last edited: May 25, 2019
  9. Feldruebe

    Feldruebe

    Joined:
    Jun 11, 2015
    Posts:
    5
    Hi,

    im using Odin to use properties in Unity and its editor.
    Until now all worked greate. But if i want to use it for a list of a custom class i cannot add items with the + button.



    Code (CSharp):
    1. [SerializeField, HideInInspector] private List<TestClass> test;
    2.  
    3. [ShowInInspector]
    4. public List<TestClass> Test
    5. {
    6.     get => this.test;
    7.     set => this.test = value;
    8. }
    9.  
    10. [Serializable]
    11. public class TestClass
    12. {
    13.     public int t;
    14. }
    Strangely i can add items by right click and use "Set collection size".
    Do i miss something?
     
  10. tempbuffer

    tempbuffer

    Joined:
    Dec 6, 2012
    Posts:
    14
    Hi,

    I'm new to Odin inspector but I've used Full Inspector in one of my project. I found that 'fiValue' of FullInspector is very useful if I only want to use a non-unity serializer for some specific fields rather than whole MonoBehaviour or ScriptableObject.

    In a nutshell, Is there a similar solution for Odin inspector as fiValue for FullInspector to only use custom serializer for specific fields?
     
  11. sarebots2

    sarebots2

    Joined:
    Jul 4, 2016
    Posts:
    34
    Hi,

    New to Odin, I saw a video about Odin that showed an object placement demo scene. That looked really useful and I figured I can probably use it for some level design in my project, but I can't seem to be able to find it in v2.0.20. Can you let me know how to import it?

    Thanks

    P.S. Video Showing the object placement scene:
     
  12. Nyphur

    Nyphur

    Joined:
    Jan 29, 2016
    Posts:
    98
    Same happening here. I assume that it's just not compatible yet with 2019.2?
     
    luispedrofonseca likes this.
  13. ktest112233

    ktest112233

    Joined:
    Jan 7, 2019
    Posts:
    37
    Hi,

    Does the serializer work on Animation Curves?
    I would like to serialize and save to file.. possible to do it?
     
  14. Waz

    Waz

    Joined:
    May 1, 2010
    Posts:
    287
    Odin 2.1 beta is looking awesome. Hanging for the release... $property looks game-changing (but it's not in the beta, right?)
     
  15. Waz

    Waz

    Joined:
    May 1, 2010
    Posts:
    287
    The 2.1 beta seems to be working reasonably well with 2019.2, just a few fails.
     
  16. vampir26

    vampir26

    Joined:
    Mar 29, 2010
    Posts:
    108
    Same problem here.
     
  17. wesley_unity341

    wesley_unity341

    Joined:
    Dec 14, 2018
    Posts:
    9
    Is there a way to filter objects by monobehaviour when selection a new object in a PreviewField? For example, a GameObject with some MonoBehaviour (TestClass for example) and it exists in the project.
     
  18. Deleted User

    Deleted User

    Guest

    Hi, I have encountered bug with the CustomValueDrawer attribute, it seems that polymorphic fields aren't handled properly:

    Code (CSharp):
    1. class A {}
    2. class B : A {}
    3.  
    4. class C
    5. {
    6.      [CustomValueDrawer("DrawSelector")
    7.      A _myA;
    8.  
    9.      private A DrawSelector(A value, GUIContent label)
    10.      {
    11.          return (A)EditorGUILayout.ObjectField(label, value, typeof(A), false);
    12.      }
    13. }
    When assigning an object of type B, the drawer fails and shows an error: "... must have the following parameters: B, GUIContent"

    It looks like your validation is missing a check if the parameter is assignable from the actual type.

    Similar issue with AssetList(CustomFilterMethod)
     
    Last edited by a moderator: Aug 12, 2019
    Prodigga likes this.
  19. hungrybelome

    hungrybelome

    Joined:
    Dec 31, 2014
    Posts:
    336
    Hi, [ShowInInspector] on Getter/Setters causes the property to be listed last after all fields. Is there a way to make it maintain its order in the class declaration?
     
  20. vkalaikkovan

    vkalaikkovan

    Joined:
    Jul 31, 2018
    Posts:
    2
    I attached the editor script to a prefab component and due to that, its giving this error, "A selected object is serialized by odin, is a prefab, and contains nested prefab data. This is NOT CURRENTLY SUPPORTED by odin - therefore, modification of all Odin-serialized values has been disabled for this object". How to resolve this error.
     
  21. bjarkeck

    bjarkeck

    Joined:
    Oct 26, 2014
    Posts:
    301
    Hey there :) What do you mean by "I attached the editor script?" This is just a guess, but you don't need to inherit from SerializedMonoBehaviour to use Odin's editor capabilities in components. If you can jump in on our Discord server and reach out to me there then I'm sure I can help you out quickly. I'm online now! :p

    And to everyone else. We're not activly maintaining this thread, all support has moved to Discord and our issue-tracker primarily, but you can also reach by mail if you prefer. https://odininspector.com/support
     
  22. Alex_Heizenrader

    Alex_Heizenrader

    Joined:
    May 16, 2019
    Posts:
    95
    Any way to use the ValueDropDown as reference types? It seems like I just get copies when I would like to keep references instead
     
  23. Zillus

    Zillus

    Joined:
    May 31, 2017
    Posts:
    24
    EDIT: I worked it out. Odin appears to automatically change the appearance of all collections unless there is a custom inspector taking over. I really don't like this behaviour. In the Preferences there are options to tweak this feature but no way to disable it. How do I stop Odin from putting all collections in FoldoutGroups? I really don't like it inserting itself like that.
     
    Last edited: Nov 12, 2019
  24. atariboy

    atariboy

    Joined:
    Aug 21, 2013
    Posts:
    12
    Hi, I'm trying to serialize an interface field, but it seems to work only if this field belongs to a SerializedMonobehaviour/SerializadScriptableObject. I need it to be nested inside another class, but it just doesn't appear in the inspector. Am I doing it wrong or is it just impossible for some reason?
     
  25. bac9-flcl

    bac9-flcl

    Joined:
    Dec 5, 2012
    Posts:
    829
    Is the class hosting that field marked with System.Serializable attribute?
     
  26. atariboy

    atariboy

    Joined:
    Aug 21, 2013
    Posts:
    12
    Yeah, sure. Here's the code and the inspector:
    Code (CSharp):
    1. public class ActionTrigger : SerializedMonoBehaviour
    2. {
    3.  
    4.     public List<Condition> conditions;
    5.     public List<IGameAction> actions;
    6.     public Test testField;
    7. }
    Code (CSharp):
    1. [Serializable]
    2. public class Test
    3. {
    4.     [SerializeField] int blabla;
    5.     [SerializeField] public IGameAction action;
    6. }

     
  27. Flavelius

    Flavelius

    Joined:
    Jul 8, 2012
    Posts:
    945
  28. atariboy

    atariboy

    Joined:
    Aug 21, 2013
    Posts:
    12
  29. atariboy

    atariboy

    Joined:
    Aug 21, 2013
    Posts:
    12
  30. pojoih

    pojoih

    Joined:
    Mar 30, 2013
    Posts:
    226
    Can I get an info (via event or something) when a list is reordered via drag and drop and which list element was affected?
     
  31. kburkhart84

    kburkhart84

    Joined:
    Apr 28, 2012
    Posts:
    910
    It seems that Odin is not ready for 2019.3.0f6. I get constant errors of "argumentnullexception value cannot be null" and it also makes the public variables not show at all in the inspector on scripts. Deleting the Sirenix folder from my plugins folder instantly makes the problem go away. No rush or anything, as version 2019.3.0 is still pretty fresh. Just more of an FYI.

    EDIT********

    I apologize...I forgot to do the whole delete, update, reimport process. Doing this fixes the problems I was having. I'll leave the post here in case someone else runs across the same issue.
     
    Tor-Vestergaard likes this.
  32. MKrohn

    MKrohn

    Joined:
    Apr 5, 2018
    Posts:
    23
    Is it in any way possible to disallow the user to add/remove values from a serialized array/list/dictionary?
    A pretty common use case with us would be mapping values in the Unity inspector. For example, I dynamically create and serialize a dictionary from code using a number of strings or an enum. Now, level-designers should be able to assign a GameObject for each string/enum-value of the dictionary inside the inspector.
    This works well, but sometimes someone accidentally deletes one of the dynamically created entries by clicking the "x"-button next to it. This then results in either errors or the designer needing to ask me what the deleted entry's key was.

    Is it possible to prevent this by locking the number of entries in a serialized list/dictionary, somehow?
     
  33. chanon81

    chanon81

    Joined:
    Oct 6, 2015
    Posts:
    168
    The ListDrawerSettings attribute has parameters such as IsReadOnly and HideRemoveButton

    Code (CSharp):
    1. [InfoBox("Lists can be made read-only in different ways.")]
    2. [ListDrawerSettings(IsReadOnly = true)]
    3. public int[] ReadOnlyArray1 = new int[] { 1, 2, 3 };
     
  34. MKrohn

    MKrohn

    Joined:
    Apr 5, 2018
    Posts:
    23
    Ah, I didn't notice HideRemoveButton. This obviously looks like exactly what I was missing. I will try it out asap. Thank you!
     
  35. mSkull

    mSkull

    Joined:
    Apr 19, 2016
    Posts:
    11
    Hi everybody!

    I noticed there's a bunch of new questions in here, so I'd like to remind everyone that we are no longer answering questions in this thread.
    If you need help with Odin or have questions you can reach out to us on our Discord here: https://discord.gg/WTYJEra or you can reach to us through https://odininspector.com/support

    Regards,
    Mikkel
     
  36. Crossway

    Crossway

    Joined:
    May 24, 2016
    Posts:
    507
    I need to set password for some of inspector windows in my project (To avoid other group members change parameters suddenly) is that possible achieve such a thing with this?
     
  37. Imperatoss

    Imperatoss

    Joined:
    Mar 24, 2018
    Posts:
    51
    Hi,

    i have the RPG Editor tutorial, but i cant access the CharacterOverview Global Config from outside. Can anyone help me with that?
     
  38. NanushTol

    NanushTol

    Joined:
    Jan 9, 2018
    Posts:
    131
    Hi
    I'm trying to create BoxGroup inside a TabGroup but I cant succeed, is this possible? how can I do that?
     
  39. vonSchlank

    vonSchlank

    Joined:
    Jan 5, 2017
    Posts:
    36
    I think this forum is pretty dead...
     
  40. Havokki

    Havokki

    Joined:
    Jun 28, 2015
    Posts:
    118
    They said they are not answering here anymore:

     
  41. vonSchlank

    vonSchlank

    Joined:
    Jan 5, 2017
    Posts:
    36
    Thanks!
    Too bad... Their support page is just a Discord chat... And that’s really not adequate for a support solution.
     
  42. rrahim

    rrahim

    Joined:
    Nov 30, 2015
    Posts:
    206
    That's not true. Their support page has a ticket / bug tracker which you can use to submit bugs. The discord is simply for immediate assistance from the community, or a dev if available.
     
  43. Neiist

    Neiist

    Joined:
    Sep 18, 2012
    Posts:
    31
    Same problem here.
     
  44. emrys90

    emrys90

    Joined:
    Oct 14, 2013
    Posts:
    755
    Is there any way to use the ValidateInput attribute with code that needs to be ran async? I'd like to validate prefab references using AssetReference, but Unity's API only allows those to be loaded async.

    EDIT:
    I have a class that's serialized through Odin as a list of elements on a ScriptableObject. When I add a new field to this class, the inspector defaults the value to the fields default value rather than the initialized value. IE I add a new "int _myField = 1;", and the field in the inspector will be 0 for existing references rather than 1. How can I resolve this?
     
    Last edited: Aug 9, 2020
  45. illinar

    illinar

    Joined:
    Apr 6, 2011
    Posts:
    863
    Can I serialize a 2D array of references?
    upload_2020-9-28_16-16-6.png

    Paths contain waypoints (class Waypoint) and I need references to them in waypointGrid 2D array.

    Thank you.

    EDIT: I'm using wrappers for references with [SerializeReference] now but idk if [SerializeReference] works in Odin
     
    Last edited: Oct 2, 2020
  46. jingray

    jingray

    Joined:
    Feb 6, 2015
    Posts:
    53
    You can post class Waypoint ?!
     
  47. illinar

    illinar

    Joined:
    Apr 6, 2011
    Posts:
    863
    It's just a simple serializable class, but I don't need to serialize it in the 2D array, I need to serialize references to it. As long as Odin can serialize 2D arrays and supports [SerializeReference] this will work with a wrapper. So it's a 2D array of WaypointContainer that just have one field
    [SerializeReference] public Waypoint waypoint;


     
  48. blastproofgames

    blastproofgames

    Joined:
    Apr 3, 2014
    Posts:
    18
    Guys, I have a question
    I'm porting a game to Universal Windows Platform.
    I NEED to use .NET scripting backend due to some problems with IL2CPP.
    Is there any way I can get access to the source code of ODIN? - I've done plenty of UWP porting, I think I can help get your plugin work on WSA, too.
    Please let me know at alex@blastproofgames.com

    Cheers,
    Alex Miron
     
  49. shawnblais

    shawnblais

    Joined:
    Oct 11, 2012
    Posts:
    324
    Do I really have to put up with this in my Editor now?


    I have some [Button] and [OnValueChanged] handlers, that's it. I think I'm ok without this 150px of wasted vertical space? If a script is going to try and be smart, then it should be smart enough to actually check if something was serialized or not.

    I appreciate the humour, but we're in production and this productivity annoyance is not really appreciated from that perspective :p
     
    Last edited: Oct 14, 2020
  50. Hosnkobf

    Hosnkobf

    Joined:
    Aug 23, 2016
    Posts:
    1,096
    @shawnblais you can disable this in the preferences: upload_2020-10-19_10-9-46.png