Search Unity

Bug NameSpace Error When using Purchasing Package

Discussion in 'Unity Mediation' started by Lathanoboy, Oct 7, 2022.

  1. Lathanoboy

    Lathanoboy

    Joined:
    Oct 3, 2022
    Posts:
    4
    Hello,

    I run into the following errors due to the In App Purchasing package.

    First Error message:
    'VisualElement' does not contain a definition for 'AddStyleSheetPath' and no accessible extension method 'AddStyleSheetPath' accepting a first argument of type 'VisualElement' could be found (are you missing a using directive or an assembly reference?)

    When double clicking on the error the following script opens:


    using UnityEngine.UIElements;

    namespace UnityEditor.Purchasing
    {
    internal class AnalyticsWarningSettingsBlock : IPurchasingSettingsUIBlock
    {
    VisualElement m_CatalogBlock;

    public VisualElement GetUIBlockElement()
    {
    m_CatalogBlock = SettingsUIUtils.CloneUIFromTemplate(UIResourceUtils.analyticsWarningUxmlPath);
    SetupStyleSheets();
    return m_CatalogBlock;
    }

    void SetupStyleSheets()
    {
    m_CatalogBlock.AddStyleSheetPath(UIResourceUtils.purchasingCommonUssPath);
    m_CatalogBlock.AddStyleSheetPath(EditorGUIUtility.isProSkin ? UIResourceUtils.purchasingDarkUssPath : UIResourceUtils.purchasingLightUssPath);
    }
    }
    }

    The error does not always show up in the console. Only when I for example use debugging. Download a certain package (for example unity ads).

    The error seems to stem from In App Purchasing. What should I do?

    I have In App Purchasing Version 4.4.1 and Unity 2020.3.7f1.

    Greetings
     
  2. jcGrenier

    jcGrenier

    Unity Technologies

    Joined:
    Feb 23, 2021
    Posts:
    145
    Hi @Lathanoboy , this error is not related to Mediation, so this may not be the best forum to ask :) I would rather not guess at a solution as I do not work with this package, but it may be an incompatible package/ editor version issue.

    best of luck!
     
  3. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    @Lathanoboy IAP is my area. You might try closing Unity, back up the project then delete the /Library folder and open the project again. Otherwise, if you could please, try to reproduce the issue with a new/empty project with the minimum steps and provide them here, I will take a look. Also, for recent versions of IAP like you are using, you also need to sign up for UGS Analytics which is a dependency https://docs.unity.com/analytics/GetStarted.html Again, test with a new project to confirm.
     
  4. Lathanoboy

    Lathanoboy

    Joined:
    Oct 3, 2022
    Posts:
    4
    Hello,

    I created a project and reproduced the error. This project contains in app purchasing. When you enter debugging mode with visual studio or reload a package (like IAP) you run into the described error above.

    https://rwth-aachen.sciebo.de/s/gE1kwSCL0MPkDf2

    The reason for the bug is probably UI Builder/ UI Toolkit (preview package). What can I do. I have used these packages quite a lot.

    greetings
     
  5. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Please provide steps to reproduce, no external links please. Either describe specific steps, or attach the project here (remove the /Library folder before zipping and attaching)