Hello,

Whenever I try to add a Responsive Container component in an empty GameObject (UI of course), the console throws at me:
NullReferenceException: Object reference not set to an instance of an object
Exoa.Responsive.ResponsiveContainer.CalculateSpaceBetweenItemsY (System.Boolean includeMargins, System.Boolean includeSpacing, System.Single& totalFlexiblePercent, System.Single& minContainerHeightNeeded) (at Assets/_Game/Tools/ResponsiveUI/Scripts/ResponsiveContainer.cs:664)
Exoa.Responsive.ResponsiveContainer.Update () (at Assets/_Game/Tools/ResponsiveUI/Scripts/ResponsiveContainer.cs:135)

This same error pops up again and is added to the console every X seconds or when it decides to refresh itself I guess.

I don't have this error on another Scene which was already using Response Container.

Now I'm worrying about this asset's liability. It was helpful though but maybe it is a mistake on my part.
I tried to compare GameObjects in the "correct" scene and the one where this error is thrown and I do not see any difference.

Thanks

    MajinDev Thanks for the feedback. I just sent you an update by email. Please try and let me know if that solves the issue?
    Thanks!

      Hello,
      I imported the .unitypackage you sent me and now I have this error when I try to add a Responsive Container component:
      NullReferenceException: Object reference not set to an instance of an object
      Exoa.Responsive.ResponsiveContainer.CalculateSpaceBetweenItemsY (System.Boolean includeMargins, System.Boolean includeSpacing, System.Single& totalFlexiblePercent, System.Single& minContainerHeightNeeded) (at Assets/_Game/Tools/ResponsiveUI/Scripts/ResponsiveContainer.cs:670)
      Exoa.Responsive.ResponsiveContainer.Update () (at Assets/_Game/Tools/ResponsiveUI/Scripts/ResponsiveContainer.cs:135)

      It seems to be the same.

      To add further details:
      I used ReponsiveUI on my project until last summer. It was working fine (at least no error).
      Then I worked on server code and didn't touch Unity until recently. Before working on a new UI again, I updated Responsive UI because my version was still the same since I purchased it in the first half of 2022.

      It is since the update I have this issue. Because I use this asset in the same manner than before and I didn't have this error before. If I'm not mistaken, my ResponsiveUI version was the "original" one, from January 2022.

      As I said in my first post maybe I'm doing something wrong. But I added the responsive container to a GameObject (in my UI Canvas) which didn't have any children GameObject yet. I also tried adding it to a GameObject which already had children GameObjects. The error pops up either way.

      I hope this is enough information for you to help solve the issue.

      For now I stopped using ResponsiveUI in new UIs, but still use it in scenes already done with it. They doesn't throw errors and according to tests it seems to work so I don't touch them.
      All this to say that I'm not in a rush so if you need time to solve this issue it doesn't matter to me.

      Thanks,

        MajinDev No problem, we are going to figure this out.
        Line 670, the only thing that could be null is the "margins" variable which is serialized and public, so it should appear on your inspector, can you check and tell me if you see it ?
        Image description

        I'm sending you another update by email.

          So I've installed the second .unitypackage you sent me and it doesn't throw any error now. All good.

          However, before doing this, I created an empty GameObject and added a Responsive Container component to check for the margins values and they are all set to 0 by default. (Like it is not empty, it seems to have values, which are 0).

          Screenshot 2023-01-16 at 15.44.03.png
          EDIT: don't understand how pictures works here so here is the link of the screenshot: https://imgur.com/a/TRhlo34

            MajinDev Yes all good, values are at 0 by default.
            Glad to here the patch did the trick. Let me know if there's anything else.

              Write a Reply...