Odin: Possible wrong warning on invalid group path

Hello everyone,

I noticed that Rider informs me on wrong paths in my Odin Inspector groups even though they work. I tried figuring out if they work but have wrong syntax, but all other ways to use them I can come up with based on the Odin docs do not work, so I suspect this might be wrong in Rider.

I want to have a group of buttons in a horizontal alignment that is also a “show if” group.

This works but Rider complains that for the horizontal group, “Group path '_inMainMenu' is not defined” - subpath in horizontal group:

private bool _inMainMenu;

[Button(ButtonSizes.Large), ShowIfGroup("_inMainMenu"), HorizontalGroup("_inMainMenu/MainMenu", Title = "Main menu")]
   public void MainMenu() {…}

[Button(ButtonSizes.Large), ShowIfGroup("_inMainMenu"), HorizontalGroup("_inMainMenu/MainMenu")]
   public void Settings() {…}

This is correct according to Rider but does not align the buttons horizontally - subpath in if group:

[Button(ButtonSizes.Large), ShowIfGroup("MainMenu/_inMainMenu"), HorizontalGroup("MainMenu", Title = "Main menu")]
   public void MainMenu() {…}

[Button(ButtonSizes.Large), ShowIfGroup("MainMenu/_inMainMenu"), HorizontalGroup("MainMenu")]
   public void Settings() {…}

Same problem, no Rider warning but also does not align horizontally - same name for both groups:

[Button(ButtonSizes.Large), ShowIfGroup("_inMainMenu"), HorizontalGroup("_inMainMenu", Title = "Main menu")]
   public void MainMenu() {…}

[Button(ButtonSizes.Large), ShowIfGroup("_inMainMenu"), HorizontalGroup("_inMainMenu")]
   public void Settings() {…}

This is correct according to Rider but shows all buttons twice, once in a horizontal group and once in a “show if” group that is not aligned - different names for both groups:

[Button(ButtonSizes.Large), ShowIfGroup("_inMainMenu"), HorizontalGroup("MainMenu", Title = "Main menu")]
   public void MainMenu() {…}

[Button(ButtonSizes.Large), ShowIfGroup("_inMainMenu"), HorizontalGroup("MainMenu")]
   public void Settings() {…}

Note that I actually have five buttons and in the above code only showed two, with the other three being identical. There is also one button below that does not have the horizontal group on purpose.

Where it gets weird is that I can get rid of the Rider warnings by changing one of them. This works except that the “Settings” button is not in the horizontal group and Rider does not complain (full code):

private bool _inMainMenu;

[Button(ButtonSizes.Large), ShowIfGroup("_inMainMenu"), HorizontalGroup("_inMainMenu/MainMenu", Title = "Main menu")]
   public void MainMenu() {
..
   }

   [Button(ButtonSizes.Large), ShowIfGroup("_inMainMenu"), HorizontalGroup("_inMainMenu")]
   public void Settings() {
..
   }

   [Button(ButtonSizes.Large), ShowIfGroup("_inMainMenu"), HorizontalGroup("_inMainMenu/MainMenu")]
   public void Credits() {
..   }

   [Button(ButtonSizes.Large), ShowIfGroup("_inMainMenu"), HorizontalGroup("_inMainMenu/MainMenu")]
   public void Loading() {
..
   }

   [Button(ButtonSizes.Large), ShowIfGroup("_inMainMenu"), HorizontalGroup("_inMainMenu/MainMenu")]
   public void Controls() {
..
   }

   [ShowIfGroup("_inMainMenu"), Button(ButtonSizes.Large)]
   public void ResetMainMenu() {
..
   }

I suspect this is because Rider does not recognize the group path being defined by the if group, so it wants it to be defined by a horizontal group, which I do when I remove the subpath from one button, but that breaks the alignment for that button.

I'm posting here instead of a bug report because I'm unsure if I missed something or if maybe this is wrong on Odin's side.

This is on Manjaro Linux with Rider 2024.3, Unity 2021.3.39f1 and Odin 3.3.1.10.

Thank you for supporting Odin in Rider, this has already been helpful even in my small project.

0
1 comment

Hello,

Thank you for reporting this. I submitted this issue to our tracker: RIDER-121340 "Group path '_inMainMenu' is not defined". Odin Inspector. False-positive warning. We would appreciate it if you could upvote this issue to demonstrate your interest.

Unfortunately, I have no other workaround to suggest other than disabling the inspection at this time.

Have a nice day!

0

Please sign in to leave a comment.