Search Unity

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

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

  1. bjarkeck

    bjarkeck

    Joined:
    Oct 26, 2014
    Posts:
    244
    Would something like this work?
    Array Resizer.PNG

    You could in the same way also change the button to accept a string paramater, and manually parse the string :)
     
  2. SpyrosUn

    SpyrosUn

    Joined:
    Nov 20, 2016
    Posts:
    82
    Thanks a lot for this example ! I was actually able to do it by adding a menuItem and then use CreateAsset on each own of my game assets via a custom editor window that I made. But i got to say, Odin parses the results really really nice :)
     
    bjarkeck likes this.
  3. mykillk

    mykillk

    Joined:
    Feb 13, 2017
    Posts:
    51
    Feature request:

    In the Inspector, for testing/troubleshooting, sometimes I need to temporarily remove an added element from a Collection. It's a bit of a hassle to remove and re-add elements as needed, so an additional per-element button or right-click option to temporary disable it (i.e. it still shows up in the Collection in the Inspector, maybe visually greyed out to make it apparent, but is not actually added as an element in the C# Collection at runtime), that would be pretty nifty.

    A related request would be a similar button or right-click option, but for making an element the only enabled one in the Collection. Basically like Mute / Solo buttons on the tracks in most audio production packages.
     
    Last edited: Nov 21, 2018
    bjarkeck likes this.
  4. SergeyGorbunov

    SergeyGorbunov

    Joined:
    Feb 12, 2014
    Posts:
    1
    Hi.

    I use [TableList(DefaultMinColumnWidth = 100)] and i get list which show not all columns and i don't see horizontal scroll bar, how get i scroll bar?

    Thanks.
     
  5. zoltanBorbas

    zoltanBorbas

    Joined:
    Nov 12, 2016
    Posts:
    77
    Hi all!

    I was wondering if someone can help me a bit, i have a SerializedMonoBehaviour script with a 2d array of MonoBehaviour scripts. I managed to show the 2d array in the editor however i cannot seam to show the public field of scripts held in the array. I only get the c# icon as shown in the picture.

    //This is the script with the 2d array
    public class GrndCmbt_Garrison : SerializedMonoBehaviour
    {
    [SerializeField] private GrndCmbt_Garrison_Slot[,] garrisonSlots;
    }

    //This is the script that is held in the 2d array and the field i want to see
    public class GrndCmbt_Garrison_Slot : MonoBehaviour
    {
    public GrndCmbt_Unit_Combat_GroupMember_Garrisonable garrisonedUnitInSlot;
    }

    I want to see that garrisonedUnitInSlot field of the scripts held in the array, i am interested to know when the field becomes empty.

    upload_2018-11-27_15-43-52.png

    Any help would be greatly appreciated, i admit i am a complete noob when it comes to Serialization.
     
  6. chanon81

    chanon81

    Joined:
    Oct 6, 2015
    Posts:
    88
    How can I hide a property defined in a base class?
     
  7. bjarkeck

    bjarkeck

    Joined:
    Oct 26, 2014
    Posts:
    244
    You can do that with Odins AttributeProcessors :) There more examples of OdinAttributeProcessors available from "tools > Odin Inspector > Getting Started"

    Code (CSharp):
    1. public class MyCustomClassAttributeProcessor<T> : OdinAttributeProcessor<T>
    2.     where T : MyCustomClass
    3. {
    4.     public override void ProcessChildMemberAttributes(InspectorProperty parentProperty, MemberInfo member, List<Attribute> attributes)
    5.     {
    6.         if (member.Name == "SomeMember")
    7.         {
    8.             attributes.Add(new HideInInspector());
    9.         }
    10.     }
    11. }
     
  8. bjarkeck

    bjarkeck

    Joined:
    Oct 26, 2014
    Posts:
    244
    Cells inside matrecies are handles a bit special in Odin as it's rarly ideal to render entire objects in each cell. But you can use the DrawElementMethod to do custom cell drawing.


    Code (CSharp):
    1.  
    2.         [TableMatrix(DrawElementMethod = "DrawGarrisonSlot")]
    3.         public GrndCmbt_Garrison_Slot[,] garrisonSlots;
    4.  
    5.         private static bool DrawGarrisonSlot(Rect rect, GrndCmbt_Garrison_Slot value)
    6.         {
    7.             // Use GUILayout, GUI etc.. to draw the cell for the given value.
    8.             return value;
    9.         }
     
  9. chanon81

    chanon81

    Joined:
    Oct 6, 2015
    Posts:
    88
    Awesome! Thanks!
     
  10. mSkull

    mSkull

    Joined:
    Apr 19, 2016
    Posts:
    10
    Hi @SergeyGorbunov,

    Yes, this is an issue with the TableList drawer currently. Basically, the TableList drawer constrains itself to the available width in the current IMGUI layout and ignores the minimum width property.

    Currently, the easiest way to solve the issue is by using the HorizontalGroup.Width property. Something like this:
    Code (CSharp):
    1. [HorizontalGroup(Width = 2000), TableList(DefaultMinColumnWidth = 100)]
    Alternatively, I also have a new Attribute + drawer that creates a new horizontal space with a horizontal scroll view. It is not perfect, but it does work.
    Code (CSharp):
    1. [HorizontalScrollArea(2000), TableList(DefaultMinColumnWidth = 100)]
    Code (CSharp):
    1. // HorizontalScrollAreaAttribute.cs
    2. public class ServiceAsset : ScriptableObject
    3. {
    4.     [HorizontalScrollArea(2000)]
    5.     [TableList(DefaultMinColumnWidth = byte.MaxValue)]
    6.     public List<Storage> Storage;
    7. }
    8.  
    9. // HorizontalScrollAreaAttributeDrawer.cs
    10. public class HorizontalScrollAreaAttributeDrawer : OdinAttributeDrawer<HorizontalScrollAreaAttribute>
    11. {
    12.     private Rect prevRect;
    13.     private Vector2 scrollPosition;
    14.  
    15.     protected override void Initialize()
    16.     {
    17.         this.prevRect.width = 100;
    18.         this.prevRect.height = EditorGUIUtility.singleLineHeight;
    19.         GUIHelper.RequestRepaint();
    20.     }
    21.  
    22.     protected override void DrawPropertyLayout(GUIContent label)
    23.     {
    24.         var rect = EditorGUILayout.GetControlRect(false, this.prevRect.height + 16);
    25.  
    26.         GUILayout.BeginArea(this.prevRect.AddYMax(16));
    27.         this.scrollPosition = GUILayout.BeginScrollView(this.scrollPosition);
    28.         GUILayout.BeginVertical(GUILayoutOptions.Width(this.Attribute.Width));
    29.  
    30.         GUIHelper.BeginLayoutMeasuring();
    31.         this.CallNextDrawer(label);
    32.         var height = GUIHelper.EndLayoutMeasuring().height;
    33.  
    34.         GUILayout.EndVertical();
    35.         GUILayout.EndScrollView();
    36.         GUILayout.EndArea();
    37.  
    38.         if (Event.current.type == EventType.Repaint)
    39.         {
    40.             this.prevRect.position = rect.position;
    41.             this.prevRect.width = rect.width;
    42.             this.prevRect.height = height;
    43.         }
    44.     }
    45. }

    I hope that helps :)
     
  11. chanon81

    chanon81

    Joined:
    Oct 6, 2015
    Posts:
    88
    So, I am extending a MaskableGraphic which has an "onCullStateChanged" property that I want to hide but can't make go away even with the custom AttributeProcessor.

    upload_2018-12-2_2-26-55.png

    Setting any attributes to it in the AttributeProcessor don't seem to do anything.
     
  12. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,225
    when i go to About under Odin in Unity. It says Version 2.0.3
    When I go to the store it says the newest version is 2.0.13?
     
  13. zKici

    zKici

    Joined:
    Feb 12, 2014
    Posts:
    208
    Hello,

    Do you guys respond to emails? I've contacted the support email: contact@devdog.io

    Unsure if I should be contacting somewhere else instead..
     
  14. zoltanBorbas

    zoltanBorbas

    Joined:
    Nov 12, 2016
    Posts:
    77
    Cool! Thank you!
     
    bjarkeck likes this.
  15. bjarkeck

    bjarkeck

    Joined:
    Oct 26, 2014
    Posts:
    244
    Yeah we do, and sorry about the confusion. DevDog is our publishers. It's actually a different company that's developing Odin (Sirenix). We try to direct our users to http:/www.sirenix.net/support but could do a better job of that.

    Discord For some rapid back and forth chat support.
    Isssue-Tracker If you have an issue that you don't want us to forget about.
    Sirenix.net/support If your question or inquiry is more suited for an email, you can reach of from there.

    And we also answer questions in here, but we're most active on the other channels.
     
  16. justtime

    justtime

    Joined:
    Oct 6, 2013
    Posts:
    240
    Hi! Is it possible to speed up scriptable objects in editor? In 2017.2 they work very slow. Or it is not related to Odin?
     
  17. bjarkeck

    bjarkeck

    Joined:
    Oct 26, 2014
    Posts:
    244
    Is it maybe because you are storing a lot of data in them? Unity objects are serialized each frame in the inspector, so the more data they serialize the laggier they become. You can get around this by manually saving and loading the data to a file, and use Odin to inspect the data. One of our users on Discord made this thing which helps with just that: https://pastebin.com/FGXVGXfY maybe you kind find some inspiration there.
     
  18. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,225
    when I do
    Code (csharp):
    1.  Vector3[] myVector = new Vector3[10];
    It creates a reordering capable list in the editor. Which is awesome but I have a situation where Id rather it not be possible to reorder. Is there something I can do to remove reordering on it?
     
  19. banksazero

    banksazero

    Joined:
    May 8, 2015
    Posts:
    65
    Do you have any tutorial or sample code for ODIN EDITOR WINDOWS (from asset's page)?
    Like how you create new window and put details.
     
  20. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,225
    @banksazero
    Try this link out man. It shows examples at the bottom.
    This is what I would do. Create a new cs script. Then copy that example into it
    That will instantly get you started with seeing how it works with creating editor windows.

    Code (csharp):
    1.  
    2. public class SomeWindow : OdinEditorWindow
    3. {
    4.    [MenuItem("My Game/Some Window")]
    5.    private static void OpenWindow()
    6.    {
    7.        GetWindow<SomeWindow>().Show();
    8.    }
    9.  
    10.    [Button(ButtonSizes.Large)]
    11.    public void SomeButton() { }
    12.  
    13.    [TableList]
    14.    public SomeType[] SomeTableData;
    15. }
    16.  
    17.  
    Think you need using Sirenix.OdinInspector at the top.
    Its been a long time since i was messing around with this so I kinda forgot.

    http://sirenix.net/odininspector/documentation/sirenix/odininspector/editor/odineditorwindow
     
  21. Carpe-Denius

    Carpe-Denius

    Joined:
    May 17, 2013
    Posts:
    804
    Do you possibly have an Odin build without unityengine.networking for 2019?
     
    Japec and mewlist like this.
  22. Amitloaf

    Amitloaf

    Joined:
    Jan 30, 2012
    Posts:
    83
    Is there a way to not show the odin drawer for a list and use unity's native list inspector? Unity's list have an option to add several items at once by dragging and I need that.
     
  23. Matanpjelly

    Matanpjelly

    Joined:
    Feb 6, 2018
    Posts:
    2
    hi, i have a 2d array of a custom class - that class has an 2 enum properties (enum ArmyType & enum UnitType) of
    i want in the inspector to have a grid for my array where each box in the grid uses the armyType property to draw the background of the entire grid cell. and the other enum type to draw a normal enum button in the middle of the grid cell.
    how can i achieve this with Odin? (i saw in the examples how i can use the Draw rect to color the cell - but i cant manage to put a button over that Rect)
     
  24. Shudrum

    Shudrum

    Joined:
    Apr 3, 2011
    Posts:
    53
    Hello and thank you for this very useful plugin! Can we ask for some improvements? :p

    I think of the AssetList, who may need some fields and properties of the ListDrawerSettings. Particularly the HideAddButton and HideRemoveButton, because we get unwanted prefab added to our target asset folder on each click on the wrong list :(

    Thank you again!
     
  25. Slimmper

    Slimmper

    Joined:
    Aug 18, 2016
    Posts:
    1
    Hi
    I have problems getting an InspectorProperty.Children items.
    When I remove an Item from the list, property after removed lost children. In the resolver I see all the fields, but the number of children remains empty. When I add any item to the collection (after remove), the problem is solved and i can get all children.
    How i can fix it?
    Thanks

    Screenshot_1.png Screenshot_2.png
     
  26. jiangPeng206

    jiangPeng206

    Joined:
    Jan 18, 2017
    Posts:
    2
    how can i Serialized protobuf dataformat? please help me
     
  27. evilack

    evilack

    Joined:
    Nov 13, 2015
    Posts:
    1
    enum's LabelText does not apply to EnumPaging, EnumToggleButtons.

    Code (CSharp):
    1. public class EnumToggleButtonsExamples : MonoBehaviour
    2. {
    3.     [Title("Default")]
    4.     public SomeBitmaskEnum DefaultEnumBitmask;
    5.  
    6.     [EnumPaging]
    7.     public SomeEnum SomeEnumPagingField;
    8.  
    9.     [Title("Standard Enum")]
    10.     [EnumToggleButtons]
    11.     public SomeEnum SomeEnumField;
    12.  
    13.     [EnumToggleButtons, HideLabel]
    14.     public SomeEnum WideEnumField;
    15.  
    16.     [Title("Bitmask Enum")]
    17.     [EnumToggleButtons]
    18.     public SomeBitmaskEnum BitmaskEnumField;
    19.  
    20.     [EnumToggleButtons, HideLabel]
    21.     public SomeBitmaskEnum EnumFieldWide;
    22.  
    23.     public enum SomeEnum
    24.     {
    25.         [LabelText("First:1")]
    26.         First,
    27.  
    28.         [LabelText("Second:2")]
    29.         Second,
    30.  
    31.         [LabelText("Third:3")]
    32.         Third,
    33.  
    34.         [LabelText("Fourth")]
    35.         Fourth,
    36.  
    37.         [LabelText("AndSoOn:5")]
    38.         AndSoOn
    39.     }
    40.  
    41.     [System.Flags]
    42.     public enum SomeBitmaskEnum
    43.     {
    44.         [LabelText("A:1")]
    45.         A = 1 << 1,
    46.         [LabelText("B:2")]
    47.         B = 1 << 2,
    48.         [LabelText("C:3")]
    49.         C = 1 << 3,
    50.         [LabelText("All:4")]
    51.         All = A | B | C
    52.     }
    53. }
    out.png
     
    Thermos likes this.
  28. hungrybelome

    hungrybelome

    Joined:
    Dec 31, 2014
    Posts:
    249
    Hi, is there an attribute to prevent certain serialized fields from being folded/hidden by default?
     
  29. Dizy

    Dizy

    Joined:
    Aug 22, 2015
    Posts:
    13
    Hi, i'm using a dictionary with a custom type as value, something like Dictionary<string, MyType> but i cannot make it display MyType content as columns like a TableList.

    Basic display with [DictionaryDrawerSettings(DisplayMode = DictionaryDisplayOptions.OneLine)] :


    Display with [HorizontalGroup] on fields :


    Is there a feature that i'm missing or do i have to make it using HorizontalGroup ? If the last is true how do i use label as column header ?
     

    Attached Files:

  30. Odls

    Odls

    Joined:
    Oct 21, 2015
    Posts:
    2
    Hi, I used Odin for a few weeks. It work almost perfect, saved me a lot of time.
    here is a small question.

    When the class don't have "color", Inspector is good.
    only "showColor" and "v4" in a HorizontalGroup.
    Code (CSharp):
    1. //Case A
    2. public class HorizontalGroupTest : MonoBehaviour {
    3.     [HorizontalGroup]    [HideLabel]
    4.     public bool showColor;
    5.  
    6.     [HorizontalGroup]    [HideLabel]
    7.     public Vector4 v4 = Vector4.zero;
    8.  
    9.     //[ShowIf("showColor")]
    10.     //[HorizontalGroup]    [HideLabel]
    11.     //public Color color;
    12. }
    But when I try to show "color" control by "showColor".
    It look weird.
    Code (CSharp):
    1. //Case B
    2. public class HorizontalGroupTest : MonoBehaviour {
    3.     [HorizontalGroup]    [HideLabel]
    4.     public bool showColor;
    5.  
    6.     [HorizontalGroup]    [HideLabel]
    7.     public Vector4 v4 = Vector4.zero;
    8.  
    9.     [ShowIf("showColor")]
    10.     [HorizontalGroup]    [HideLabel]
    11.     public Color color;
    12. }
    13.  
    Even "showColor" is false, it still create a small empty space there.

    HorizontalGroupTest.png

    When a class has many hide member in a [HorizontalGroup], all of than make a small space.
    The other member has no space and show vary small.

    How can I remove the empty space?
     
  31. Odls

    Odls

    Joined:
    Oct 21, 2015
    Posts:
    2
    Oh, not many hide member.
    It happened when a field and a sub field( in a data class) in the same HorizontalGroup.
    Code (CSharp):
    1. public class HorizontalGroupTest : MonoBehaviour {
    2.     [HideLabel]
    3.     public HorizontalGroupTestGoodItem itemA;
    4.  
    5.     [HideLabel]
    6.     public HorizontalGroupTestBadItem itemB;
    7.  
    8.     [HorizontalGroup(100)]    [HideLabel]
    9.     public GameObject gameObject;
    10.  
    11.     [HorizontalGroup]    [HideLabel]
    12.     public HorizontalGroupTestBadItem itemC;
    13. }
    14.  
    15. [System.Serializable]
    16. public class HorizontalGroupTestGoodItem {  // A
    17.     [HorizontalGroup(20)]
    18.     [HideLabel]
    19.     public bool showColor;
    20.  
    21.     [HorizontalGroup(LabelWidth = 1)]
    22.     [HideLabel]
    23.     public Vector4 v4 = Vector4.zero;
    24.  
    25.     //[ShowIf("showColor")]
    26.     //[HorizontalGroup(LabelWidth = 1)]
    27.     //[HideLabel]
    28.     //public Color color1;
    29. }
    30.  
    31. [System.Serializable]
    32. public class HorizontalGroupTestBadItem {    // B C
    33.     [HorizontalGroup(20)]    [HideLabel]
    34.     public bool showColor;
    35.  
    36.     [HorizontalGroup(LabelWidth = 1)]    [HideLabel]
    37.     public Vector4 v4 = Vector4.zero;
    38.  
    39.     [ShowIf("showColor")]
    40.     [HorizontalGroup(LabelWidth = 1)]    [HideLabel]
    41.     public Color color1;
    42. }
    HorizontalGroupTest.png
    A is good.
    B just a little bit weird.
    C is main problem.
     
  32. GamerXP

    GamerXP

    Joined:
    Mar 22, 2014
    Posts:
    15
    Hello. I'm trying to copy one object's properties to other partially. At first I used Unity's SerializedObject, but now I had to switch to PropertyTree so it will support Properties as well.
    After that I encountered one Issue - how can I change size of array/list/collection from InspectorProperty similiar to SerializedProperty.arraySize?
    I tried getting SerializedProperty from within loop and modifying it, but I have to call Apply PropertyTree first, change array size, apply serialized object, Update PropertyTree. That's really slow. Is there any convinient way to do so?
     
  33. jwvanderbeck

    jwvanderbeck

    Joined:
    Dec 4, 2014
    Posts:
    530
    Hi,

    I am picking up work on a project that hasn't been touched in quite some time. This project uses Odin and was originally created in an earlier version of Unity. I don't recall which version but it is probably about two years old.

    I updated the project to Unity 2018.3, and updated all assets used including Odin.

    However, I am having trouble with code that used to work fine but no longer does. This code involved the serialization and deserialization of a SerializedScriptableObject instance to JSON using JsonUtil.and asset bundle data.

    Code (CSharp):
    1. HardwareComponent loadedComponent = JsonUtility.FromJson<HardwareComponent>(bundleAsset.text);
    HardwareComponent is a SerializedSriptableObject

    Code (CSharp):
    1.     [Serializable]
    2.     [CreateAssetMenu(menuName="Hardware/Hardware Component")]
    3.     public class HardwareComponent : SerializedScriptableObject
    4.  
    The error I am getting is: ArgumentException: Cannot deserialize JSON to new instances of type 'HardwareComponent.'

    Now as I said this code used to work fine, so I am a bit confused as to what has changed. Has there been a change in Odin's SerializedScriptableObject that makes this not work anymore?
     
  34. LazyOnion

    LazyOnion

    Joined:
    Mar 6, 2018
    Posts:
    13
    Hello I am trying to serialize an instance of a serializedscriptableobject, send it over the network and overwrite the instance there, but I 'm receiving an error when deserializing


    Code (CSharp):
    1.     void SaveState(string url, GameState Data)
    2.     {
    3.         var data = SerializationUtility.SerializeValue<GameState>(Data, DataFormat.JSON);
    4.         Task.Run(async () =>
    5.         {
    6.  
    7.             await SaveStateAsync(url, data);
    8.         });
    9.     }
    10.  
    11. //Deserializing after receiving the bytes
    12. var state = SerializationUtility.DeserializeValue<GameState>(data, DataFormat.JSON);
    13.  
    14.  
    This is working fine with serializable classes/ structs but fails for scriptableobjects, is there something that I am missing? I could have the scriptable classes hold a serializable class but this seemed straight forward :(
     
  35. dave_thrive

    dave_thrive

    Joined:
    Jan 30, 2019
    Posts:
    22
    Hi. I asked this in Discord but as it maybe needs a more detailed answer, I'll post it in here.
    I'm looking to create a dropdown menu like this one where each item has a label and a colour. How can I create this in Odin (or indeed in Unity!). I was suggested to look at OdinMenuTree and OdinMenuItem but I can't find any good examples of how to use that for this purpose.

     
  36. bjarkeck

    bjarkeck

    Joined:
    Oct 26, 2014
    Posts:
    244
    Hi Dave, Yes OdinMenuTrees with the help from OdinSelector is a really good candidate for a dropdown like that.

    There are simpler ways of making them but this polished solution ;)

    Code (CSharp):
    1. private void InSomeIMGUIContext()
    2. {
    3.     myColor = MyColorSelector.DrawColorDropdown(new GUIContent("Select Color"), myColor);
    4. }
    5.  
    6. public class MyColorSelector : OdinSelector<Color>
    7. {
    8.     private static Dictionary<Color, string> colorNameLookup = new Dictionary<Color, string>()
    9.         {
    10.             { Color.red, "Red" },
    11.             { Color.green, "Green" },
    12.         };
    13.  
    14.     protected override void BuildSelectionTree(OdinMenuTree tree)
    15.     {
    16.         tree.DefaultMenuStyle = OdinMenuStyle.TreeViewStyle;
    17.         tree.DefaultMenuStyle.IndentAmount += 20; // Room for the color preview.
    18.  
    19.         foreach (var item in colorNameLookup.OrderByDescending(x => x.Value))
    20.         {
    21.             var name = item.Value;
    22.             var color = item.Key;
    23.             var menuItem = tree.AddObjectAtPath(name, color).First();
    24.             menuItem.OnDrawItem += (m) =>
    25.             {
    26.                 var rect = m.LabelRect.Padding(2);
    27.                 rect.x -= 18;
    28.                 rect.Padding(2);
    29.                 rect.width = 16;
    30.                 EditorGUI.DrawRect(rect, color);
    31.                 SirenixEditorGUI.DrawBorders(rect, 1);
    32.             };
    33.         }
    34.     }
    35.  
    36.     public static Color DrawColorDropdown(GUIContent label, Color color)
    37.     {
    38.         string name;
    39.         if (!colorNameLookup.TryGetValue(color, out name))
    40.         {
    41.             name = color.ToString();
    42.         }
    43.  
    44.         var selector = new TypeSelector(AssemblyTypeFlags.All, false);
    45.         var selection = DrawSelectorDropdown(label, name, CreateAndShowSelector);
    46.         if (selection != null && selection.Any())
    47.         {
    48.             color = selection.FirstOrDefault();
    49.         }
    50.  
    51.         return color;
    52.     }
    53.  
    54.     private static OdinSelector<Color> CreateAndShowSelector(Rect rect)
    55.     {
    56.         var selector = new ColorSelector();
    57.         selector.ShowInPopup(rect);
    58.         selector.EnableSingleClickToSelect();
    59.         return selector;
    60.     }
    61. }
    If you need further help with it, let me know!

    The following is just a reminder to everyone who also finds this forum page, don't take the big title personally hehe, just making sure people see it.

    For support come join us on Discord!

    Our support is primarily going on Discord, our Issue-Tracker or from our contact page: So go find us there :)

    Cheers!
     
    Last edited: Apr 1, 2019
  37. dave_thrive

    dave_thrive

    Joined:
    Jan 30, 2019
    Posts:
    22
    Thanks very much for that! There is a missing method and a missing class in that sample
    DrawSelectorDropdown and
    new ColorSelector()
     
  38. bjarkeck

    bjarkeck

    Joined:
    Oct 26, 2014
    Posts:
    244
    Ah sorry about that. ColorSelector should be MyColorSelector, but DrawSelectorDropdown should be available? It's a static method inside the base class (OdinSelector) What version of Odin are you on?
     
  39. dave_thrive

    dave_thrive

    Joined:
    Jan 30, 2019
    Posts:
    22
    Thanks. I thought I had the latest version but I didn't. That's working perfectly now. Thank you so much for your help!
     
    bjarkeck likes this.
  40. zKici

    zKici

    Joined:
    Feb 12, 2014
    Posts:
    208
    Is this only for a specific Unity?

    I tried using it but:

    error CS1061: Type `System.Collections.Generic.Dictionary<UnityEngine.Color,string>' does not contain a definition for `OrderByDescending' and no extension method `OrderByDescending' of type `System.Collections.Generic.Dictionary<UnityEngine.Color,string>' could be found. Are you missing `System.Linq' using directive?

    With a few other errors
     
  41. Flavelius

    Flavelius

    Joined:
    Jul 8, 2012
    Posts:
    619
    If you read what the error tells you, you'll know that you have to add the System.Linq using statement to the top of your script.
     
  42. mybreeze

    mybreeze

    Joined:
    Nov 12, 2016
    Posts:
    16
    I made a simple database like in the example RPG editor, but I added a delete function. But when the delete function is pressed an error occurs. How to handle it? Thanks
    upload_2019-4-3_13-17-15.png

    upload_2019-4-3_13-17-39.png

    upload_2019-4-3_13-17-59.png
     
  43. bjarkeck

    bjarkeck

    Joined:
    Oct 26, 2014
    Posts:
    244
    You just need to add the missing using statements at the top of your script file. "using System.Linq;"
     
  44. bjarkeck

    bjarkeck

    Joined:
    Oct 26, 2014
    Posts:
    244
    Hmm try doing it in a delayed call and see if that makes a difference: EditorApplication.delayedCall +=() => delete();
     
  45. mybreeze

    mybreeze

    Joined:
    Nov 12, 2016
    Posts:
    16
    Thanks, it works
     
  46. mybreeze

    mybreeze

    Joined:
    Nov 12, 2016
    Posts:
    16
    I have a little problem with renaming assets in this simple database. When I press the rename button, the editor window loses focus on the selected item.How to rename assets not lose the focus of the selected item?

    upload_2019-4-4_11-1-55.png

    upload_2019-4-4_11-2-31.png

    upload_2019-4-4_11-2-57.png
     
  47. mahdiii

    mahdiii

    Joined:
    Oct 30, 2014
    Posts:
    799
    Odin inspector can not serialize classes like below?

    Code (CSharp):
    1. public class ClassA: MonoBehaviour,IInterface{}
    2. public class ClassA:ScriptableObject,IInterface{}
    3.  
    4. public class ClassB:SerializedMonoBehaviour{
    5.    public IInterface Sample;
    6. }
    7.  
    8.  
    If I can drag gameObjects or scriptableObject assets and drop them in the inspector, It will be awesome.
     
  48. f0ff886f

    f0ff886f

    Joined:
    Nov 1, 2015
    Posts:
    155
    Hi, I've been trying to understand why my Enter Play mode is taking so long in the Unity edtir, and I see that OdinEditor.OnDisable() is a huge portion of the "ReloadAssembly" time:

    upload_2019-4-14_12-57-42.png

    Do you have any idea why this might be happening?

    Thanks!
     
  49. chanon81

    chanon81

    Joined:
    Oct 6, 2015
    Posts:
    88
    Hello, I'm having trouble reverting values in a prefab that are overriding values in another nested prefab which are using Odin inspectors.
     
  50. vonSchlank

    vonSchlank

    Joined:
    Jan 5, 2017
    Posts:
    2
    Hello, I have a list, set to show 1 item per page. Is there a way to control which page to show by a slider? Or by any script?
     
    Last edited: Apr 28, 2019