Unity-UI-Extensions/com.unity.uiextensions

BUG: Re-OrderableList script missing when creating prefab, instance, or using Add Component.

Closed this issue · 5 comments

There are 3 issues likely related to a single error.

#############
1 - If creating a component that contains a Reorderable list, when instance is created, the script is removed and you get a missing script error.

To reproduce 1

  • Create a UI element that contains a reorderable list.
  • Drag element to the project window into your prefabs location
  • Open the prefab
  • Examine the reorderable list to see the missing script, or try and save the component one opened and you will receive the missing script error.

#############
2 - If creating a clone of a component with a Reorderable list, the new instance produced will have the missing scripts error.

To reproduce 2

  • Use the broken prefab from issue 1. Remove the lists with the missing scripts.
  • Use the menu to add new Reorderable Horizontal list inside component.
  • Save and close component. (you will not get a missing script this time).
  • Create a script that will reference the prefab, create an instance and parent it to the display.
  • Run project and make sure instance is attached to display.
  • See console for missing script error.

#############
3 - When clicking "Add Component" in the inspector on a UI object, Reorderable List is not an available as a script option.

To reproduce 3

  • Create a canvas and add an empty child object.
  • Select the empty object
  • In the inspector, click the 'Add Component' button.
  • Begin typing 'Reorderable'. The ReorderableList component will not show/display as an option.

Mac OS X 13.4.1

  • Unity Version: 2022.3.5f1
  • Unity UI Extensions Version 2.3.0

Thanks for the report @Gohloum , that sounds VERY odd and I've not come across this behaviour before.

I've been unable to replicate this issue @Gohloum.

I've tried:

  • Testing all the Reorderable list components using the latest dev release 2.3.2-pre.3
  • Testing all the Reorderable list components using the latest 2.3.0 release from OpenUPM
  • Testing all the Reorderable list components using the latest 2.3.0 release using the asset package from the releases tab.

In all tests, I'm unable to replicate the missing script issue on either Windows or Mac

Which is what I expect because of how Unity handles prefabs and their creation, the only thing to my knowledge that "could" cause this is if there were script compilation issues in the project already, which prevents Unity from compiling scripts and verifying their ID's (but would affect more than just the UI Extensions)

Can you please try recreating it in a new project and see if you can get the same results. (love the detail in the issue log)

Hi @SimonDarksideJ ,

I tried with a new project and yes, I am NOT getting the same error. The project I am having the issue with has been a working codebase since 2018, so it's been through quite a few library upgrades. I did a little searching in the code with the find all tool in Rider and I am seeing some other references to a ReorderableList class in Naughty Attributes, MK Toon, and another package. My morning is pretty stacked, but I should be able to add libraries to my test project later today or early tomorrow and see if I can reproduce this result.

Also, as a workaround, I was able to create a unity script class which I named TPReorderableList and inherited your reorderable list class. This did allow me to add the script from the menu onto my component and it does work as expected and I can now get through all the conditions I mentioned in my original post with no problems. I don't know a whole lot about things under the hood of the Unity IDE, but maybe this process of a workaround might give you an idea of what could be happening. If you have any suggestions, I will certainly give them a try.

Since all the code in the Unity UI Extensions is contained within the UnityEngine.UI.Extensions namespace, there should NOT be any conflicts with any other ReorderableList classes anywhere else in the project.

The only way I can think of, is if there are any instances of the ReorderableList class that are not contained within a namespace, in that case Unity will use that as a default, which sadly there is nothing that can be done (other than your workaround) as Unity will override with the default.

So if you can, deprecate any asset that has a ReorderableList definition that is not contained in a namespace (which Unity stipulates as a mandatory requirement for the asset store these days) if you can, else your workaround is the only possible solution I'm afraid.

Hope that helps.

Closed due to lack of response, resolution is to check other assets do not collide with the Unity.UI.Extensions namespace