Search Unity

UnityAds doesn't work - IOS GameId field is not exposed anymore?

Discussion in 'Unity Ads & User Acquisition' started by DTAli, Sep 16, 2017.

  1. DTAli

    DTAli

    Joined:
    Jan 22, 2016
    Posts:
    54
    We upgraded recently to Unity 2017 and we're trying to get an iOS build. First thing we noticed was Unity Ads stopped working. I looked at the xcode console and saw a message saying that the GameId that's currently configured/being used is the Android one, not the iOS one. I look everywhere to see where I could set that Id, nothing is exposed. I remember in older versions of Unity there were 2 fields that I could set in the Services window, like in this screen shot:



    Currently, it just shows this:



    I had to manually enter ProjectSettings/UnityConnectSettings.asset and modify the Id directly, which is super lame and gross.

    Why are those fields no longer exposed? How am I supposed to set those Ids now?

    PS:
    0- Ads integration is done via the editor's services window, not by any unitypackage/asset. And yes we've tried disabling/re-enabling Ads and making sure there's no lingering Ads files in the project.

    1- Same happens for both Pro and Personal licenced editors

    2- I Noticed that the UnityAds folder that Unity 5.4.3p4 generates is different from the one that Unity 2017 generates. The older one contains a UnityAds.framework file and a UnityAds.bundle file. The Unity 2017 one only contains UnityAds.framework. Copying over the old folder will yield compiler errors (cannot find UAADSMetaData.h etc)
     
    Last edited: Sep 16, 2017
  2. DTAli

    DTAli

    Joined:
    Jan 22, 2016
    Posts:
    54
    Update: Even after modifying the Id value manually in UnityConnectSettings.asset, I still get the same error message, and UnityAds doesn't work.

    "GameId X provided is configured for platform android while ads were requested for platform ios, please create own game profiles for each platform"

    Not only that, it seems that whenever I try and edit those values in the file, all the settings in the UnityServices window gets turned off, and the fields in the file just delete themselves, as if the serializer didn't load them properly and wrote default values over them. Opened via TextEdit
     
  3. rasmus-unity

    rasmus-unity

    Moderator

    Joined:
    Aug 15, 2014
    Posts:
    1,312
    Reason for removing the game id fields in Unity editor UI, was that it's in most situations not required for a game developer to know the game id, as it should be automatically fetched for the Unity cloud project.

    Did you close Unity before editing UnityConnectSettings.asset?

    You are welcome to contact support (https://unityads.unity3d.com/help/help/contact) with additional information about project/game ids, as it would be interesting to know why Unity uses the incorrect game id. Alternatively just switch to Asset Store package (https://www.assetstore.unity3d.com/en/#!/content/66123) which allows you to control the initialization of Ads SDK.

    /Rasmus
     
  4. DTAli

    DTAli

    Joined:
    Jan 22, 2016
    Posts:
    54
    Not sure what you mean by cloud project. We don't use any cloud features.

    "in most situations" (in your words it's not "all situation") is clearly not a good enough reason to eliminate a feature cause we're having to have to set the id explicitly.

    I don't want to roll back to the store version that's a different can of worms I don't want to touch.
     
  5. rasmus-unity

    rasmus-unity

    Moderator

    Joined:
    Aug 15, 2014
    Posts:
    1,312
    Technically, you do have a cloud project if you have Ads enabled for a Unity project. You can see your cloud projects on https://developer.cloud.unity3d.com/projects/

    We had the discussion internally about removing the fields from UI, and the reason for not showing was "it's confusing to the normal game developer; users who needs to control game id themselves, should use asset store package".

    But with that said, you should be able to manually update the UnityConnectSettings.asset file. I just tried here, and didn't experience that the file would get overwritten. As I understand you are on Unity 2017.1. Please note that for backwards compatibility we have game id listed multiple times in the settings file:

    Code (CSharp):
    1.   UnityAdsSettings:
    2.     m_Enabled: 1
    3.     m_InitializeOnStartup: 1
    4.     m_TestMode: 1
    5.     m_IosGameId: (here)
    6.     m_AndroidGameId: (here)
    7.     m_GameIds:
    8.       AndroidPlayer: (here)
    9.       iPhonePlayer: (here)
    10.     m_GameId: (here, seems to be for the active platform, you might not need this)
    Above is example of my UnityConnectSettings file from 2017.2. We should get it cleaned up at some point...

    If you update all those game ids listed here, does it then work?

    /Rasmus
     
  6. DTAli

    DTAli

    Joined:
    Jan 22, 2016
    Posts:
    54
    It only worked after I switched serialization to be Force Text instead of binary, seems like TextEdit was doing something to the binary file when saving it back. m_GameId is what I had to set, it was set to the Android id. Both the Ids above it were set correct.

    Downloading a separate package kind of defeats the purpose of having the Services window in the first place, it was meant to be just: ads are already integrated into Unity, just turn on/off a switch and it works. All your docs mentions that the store package is now redundant in favor of the Services window integration, now you're asking me to go back to the store package...

    I don't see any reason to hide this stuff even for a 'normal game developer'. If it's something you have to maintain internally by some internal code, and that code was bugged or didn't work for some reason (due to updates, migration, whatever...), now that 'normal game developer' is screwed with no 'obvious' way to unscrew himself.
     
  7. rasmus-unity

    rasmus-unity

    Moderator

    Joined:
    Aug 15, 2014
    Posts:
    1,312
    Ok, assumed you had "Force Text" enabled, otherwise I don't think it's possible to modify file at all. Sorry for not making sure. Having text mode asset files, will also make your version control system more happy.

    And you should be happy that we consider you an "advanced user" :)

    There are actually good reasons why we don't want regular users to change the game id, as you in practice change the project where ads revenue is sent to. I.e. when you now click the "Go to dashboard" link in Unity editor services window, it will show a zero revenue in the dashboard, because you are sending traffic to another game.

    Hope it explains. In any case, sounds like you know what you are doing, and got it working now.

    /Rasmus
     
  8. DTAli

    DTAli

    Joined:
    Jan 22, 2016
    Posts:
    54
    We always used Force Text, but for some reason it seems during the migration to Unity 2017 the setting was reset.

    OK so if we don't need to worry about that ID like you say, how are we supposed to set it? Like, is there a button somewhere that's like "Pick the right Id" or something? What was the intended behavior for this, how was it supposed to know which Id to use, and why did it use the wrong one?

    PS I'm Vexe. Don't know why but it signed me in with my work account. I was tool lazy to switch that night.
     
  9. rasmus-unity

    rasmus-unity

    Moderator

    Joined:
    Aug 15, 2014
    Posts:
    1,312
    Please send information about project and game id to unityads-support@unity3d.com, with reference to this forum post, our support team will pick it up then. I'm curious why you need to change the game id in the first place.

    Thanks,
    Rasmus
     
  10. DTAli

    DTAli

    Joined:
    Jan 22, 2016
    Posts:
    54
    I was just with them on email, I got the vaguest replies back. Telling me that now "it's complicated" and "in the future we hope it won't be" - Then she asks me "Is there anything else that I can help with?" - After... not really giving me any much help in the first place. Hands down the worst support I've ever experienced. I asked if I could speak to someone "actually" technical, still waiting for an asnwer. You understand my frustration here?
     
  11. krisventure

    krisventure

    Joined:
    Mar 24, 2016
    Posts:
    118
    @rasmus-unity I'm having the same issue with Unity 2017.2. I've added to my code Advertisement.Initialize(myIOSgameID, true); (not even sure if this should matter because I also read that from Unity 5.2 upwards it should automatically set the gameID). But it uses the android gameID nevertheless. I'm getting the same error as @kholiobungholio . As I'm implementing Unity ads for the first time I'm not sure what I'm doing wrong but from what @kholiobungholio says this may be still the same bug.

    So this means I'll have to manually edit the m_GameId in UnityConnect settings every time I switch platform between iOS and android. And there's no way to modify UnityConnect via script (unlike PlayerSettings for instance that can be modified in postprocessing script upon build).

    I agree with @kholiobungholio that this needs to be fixed. Will shoot an email to the support although the answers he got sound pretty terrible.
     
    Last edited: Dec 1, 2017
    unity_PPT2jOeEw_JErw likes this.
  12. toad02

    toad02

    Joined:
    Mar 7, 2014
    Posts:
    4
    One more to the list here.
    I also had to edit the file manually because it was trying to use the android code on my iOS build.
     
  13. gtzpower

    gtzpower

    Joined:
    Jan 23, 2011
    Posts:
    318
    I had this problem as well. Switching the platform to Android and back to iOS seemed to resolve it.
     
  14. Sievlar

    Sievlar

    Joined:
    Oct 3, 2012
    Posts:
    68
    The UnityConnectSettings file is causing merge conflicts with Collaborate feature. I develop for UWP & Android on PC and iPhone on a Mac. This particular file has to be different for Android vs iPhone, because of the m_GameId field. Why even have it? You already have the separate ones for Android and iPhone in the same file? I don't want to have to manually merge this file every time??
     
  15. srjbox

    srjbox

    Joined:
    Dec 18, 2017
    Posts:
    1
    I have the same problem as Sievlar.
    I am using a PC for Android development, and a Mac for Iphone, and my projects are synchronized via the Unity Collaborate Tool.
    The UnityConnectSettings.asset file is causing conflicts and even disables my ads in my builds if I dont manually check the m_GameId field in the UnityConnectSettings.asset before building.
    All this because the Collaborate feature sends the android id to my Iphone build environment and vice-versa.