Windows Phone 8 deployment pros here?

Heyo,

So I've got a huge issue with my Unity game that crashes. It used to work perfectly in the last 4 months of development
but now for some reason it crashes on every second scene load. Only on WP8. Works great on Android...
I've debugged and went through everything for the last 48 hours but I just can seem to fix it.

Anyone have some good experience in deploying to WP8 that might be able provide some assistance?

Thanks!
Phillip

Comments

  • What does your log file look like?
  • @tbulford is likely your man! I think @TheFuntastic is also well versed in the perils of Unity for WP8...
  • PM @tbulford maybe he can help.
  • I had an issue with 512MB versions of Windows Phones, that was battling to open up my larger textures.
    Not sure if it could be the same issue, but I solved mine by reducing my texture sizes.
  • Ugh! Yeah I've had bunch of problems with WP8. There are (were) some gaping holes between the RT .net flavour in WP8 and the mono runtime. That was a while ago, so I hoped they would have patched that by now. (I filed bug reports at the very least).

    First place to start is check you are within memory. If it was working and now suddenly isn't that's probably a good place to start. My memory is hazy, but WP8 has partitioned memory per app, meaning there is always a hard limit on how much memory you can use, that has nothing to do with amount of memory on device. As you can see 150mb per is not a lot!
    http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj681682(v=vs.105).aspx

    If it's not that it possibly means something is dying deep in the internals of Unity and you have almost no recourse for finding the bug. In my case one crash literally traced back to a cached transform (eg var trans = this.transform) that would cause the whole game to vanish in a puff of smoke. I only managed to find this through painful line by line commenting. I seem to remember we also had issues with crashing on launch, have you tried compiling from Visual Studio? I seem to remember compiling from unity was a no go but VS on Master seemed okay. Been a long time so I really can't remember so well...

  • Thanks guys for all the feedback!
    @dislekcia Not very good. No crash logged from what I can see. When I get a proper log I will post it.
    @duncanbellsa I tested removing all textures but wasn't that, thanks.

    @TheFuntastic I think your right about memory, gonna profile and see what usage I'm doing. 150MB WTF Microsoft!
    And yes, MASTER setting to rule them all, took me a while to figure that one out.

    I've really had the worst experience publishing for WP8 & W8. Issues with plugins, native calls etc.
    But if can get this sorted all should be good.

    Thanks again everyone! I will get back to you guys.
  • @dreampunchboy yip memory is the first port of call for not loading. Strip it down and see if there is a problem. We found both game data models and texture memory could cause a problem.

    Also make sure you do clean up of any references between (Remember a reference to a script is a reference to the gameObject and therefore a reference to the material etc.). We had an issue where we would load a new scene but we had not done clean up of any references before hand. So just during loading our memory was doubled. The garbage collector would do a clean up after the load cycle but that was too late. By manually removing the references to game objects and the like before the load the problem went away (Thankfully).

    We literally go through a list that had object handles and do the destroy and then change the reference to null. That may have been overkill but it worked.

    Oh also should mention we do the following two things after all the objects are destroyed and the references cleared.

    Resources.UnloadUnusedAssets();
    System.GC.Collect();
  • tbulford said:
    @dreampunchboy yip memory is the first port of call for not loading. Strip it down and see if there is a problem. We found both game data models and texture memory could cause a problem.
    Ok I'm only using a measly 20MB - 40MB from what I see in profiler. Will investigate further.
    tbulford said:
    Also make sure you do clean up of any references between (Remember a reference to a script is a reference to the gameObject and therefore a reference to the material etc.).
    That makes so much sense, this might actually be my proble.
    tbulford said:
    We had an issue where we would load a new scene but we had not done clean up of any references before hand. So just during loading our memory was doubled. The garbage collector would do a clean up after the load cycle but that was too late.
    To work around this I've got an empty "Loading..." scene before loading the next scene. That should work right?
    tbulford said:

    We literally go through a list that had object handles and do the destroy and then change the reference to null. That may have been overkill but it worked.
    Def gonna try this.
    tbulford said:
    Oh also should mention we do the following two things after all the objects are destroyed and the references cleared.

    Resources.UnloadUnusedAssets();
    System.GC.Collect();
    Tip of the day! Thanks for the help, will let you know what happens.
  • Your idea with the intermediate scene might work so long as none of your references are static and you force the unload and gc.
  • Also bear in mind on mobile you need to sum both your runtime memory and all your gpu texture memory as they generally share memory on device.
  • After a few nights of removing code, removing singletons, blah blah and a whole lot more...
    I was able to fix it! And I am surprised on what caused it. Well sort of.

    I have a LevelManager class/gameobject.
    The class has a public List<Sections> with a List<Level> inside that.
    And obviously it's [Serializable]. That's the damn issue. Passing around this object with serialized data broke everything.
    I don't know why. Does it try to get the data again and again?

    So to fix it on this object's start I Instanciate a new object with the same class(blank no data class without serialized data)
    and just assign the values from this one to that one. So now level data is in memory only I guess.

    So don't really know why this happens.
    Thanks to everyone who gave me some epic assistance. @TheFuntastic @tbulford
  • That sounds like an ideal situation for using a scriptable object.
  • Squidcor said:
    That sounds like an ideal situation for using a scriptable object.
    Yes I realized that near the end but honestly didn't feel like copying over all that data. My bad.

  • Pleased to hear you solved the issue hope you don't mind a few questions. I still not sure the root cause was and the inspector Clouseau in me really wants to try figure it out.
    I have a LevelManager class/gameobject.
    The class has a public List<Sections> with a List<Level> inside that.
    And obviously it's [Serializable]. That's the damn issue. Passing around this object with serialized data broke everything.
    I don't know why. Does it try to get the data again and again?
    Not sure why its obviously [Serializable] and when you speak of passing it around are you suggesting you pass a reference or you are serializing and deserializing it all over the place?
  • tbulford said:
    Not sure why its obviously [Serializable] and when you speak of passing it around are you suggesting you pass a reference or you are serializing and deserializing it all over the place?
    Ok so for the List<ClassType> to become visible to maintain in the editor I made it [Serializable].
    And no I wasn't doing anything crazy. It was just set: DontDestroyOnLoad(this.gameObject);

    That is it, but the data was a List<> of 6 with each one having a child List<> of +- 10 each. So not that big.
  • I know it's a bit of admin, but could you file a bug report to unity? Sounds like something internal is broken, and if ever I go back to WP8 I don't wanna have to deal with that ;)
  • I know it's a bit of admin, but could you file a bug report to unity? Sounds like something internal is broken, and if ever I go back to WP8 I don't wanna have to deal with that ;)
    Good idea! I will do that. But tbh I never want to do WP8 again... Ever!

Sign In or Register to comment.