Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Freezing Game with 2d extra package

Discussion in '2D Experimental Preview' started by noobogami, Nov 28, 2021.

  1. noobogami

    noobogami

    Joined:
    Jul 24, 2021
    Posts:
    44
    in my game I have a map that handle with a system similar to tilemap that I wrote myself. some part of map are cloud that can be removed during playing and I handle them temporary with some hardcode style algorithm,
    now for refactoring I changed that part to 2D tilemap extra and it worked very good but I noticed an issue; app freeze after period of time! first I thought it's a problem with a shader I used on clouds but when I disabled my shader and used "sprite default" material problem stayed.
    it happens randomly and just happens when tilemap object is active (when I change a view in my game that disables tilemap object game works without problem), all unity cycles stop (every updates stop calling) but every time I touch screen logcat show this log:
    2021/11/20 12:41:28.121 4815 4815 Debug ViewRootImpl@53d11aa[UnityPlayerActivity] ViewPostIme pointer 0

    and "Game Analytics" cycle works and looking for new events to send every 20 or 30 seconds with this log:
    2021/11/20 12:43:13.660 4815 5535 Info GameAnalytics Info/GameAnalytics: Event queue: No events to send

    I use a custom ruletile for my cloud so 3 different tiles connect to eachother, here's my code:

    public class MultiTextureTile : RuleTile<MultiTextureTile.Neighbor> {
    public TileBase[] tilesToConnect;

    public class Neighbor : RuleTile.TilingRule.Neighbor { }

    public override bool RuleMatch(int neighbor, TileBase tile) {
    switch (neighbor) {
    case Neighbor.This: return tile == this || tilesToConnect.Contains(tile);
    case Neighbor.NotThis: return tile != this && !tilesToConnect.Contains(tile);;
    }
    return base.RuleMatch(neighbor, tile);
    }
    }

    when I tried to use profiler it didn't happened in first build but in another build it frizzed with profiler and at the time of freeze profiler graph stopped moving! there was no spike in cpu or render or memory.
    I tested on two different devices a Samsung Galaxy A10 that freezes almost every time and a Xiaomi Redmi Note 8 that rarely freezes (I just saw two or three times)
    freezing time is different. sometimes it wait 2 minutes, and sometimes it freeze in less than a minute.
    I'm using Unity 2019.4.18
    I filled a bug report but it canceled every time I tried to send it after deleting most of heavy assets I finally could send it but as it said in final info message I didn't received an email about sent report.
     
  2. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    915
    Hello @noobogami,
    If you remove your rule tile script, does the apk run without any issues? And have you been able to get any similar failures on your development machine?

    My advice here would be to:
    - See if you can narrow down the cause of the freeze, by disabling and re-enabling parts of your code.
    - Upgrade your project to the latest Unity 2019.4 (Unity 2019.4.33 at the time of writing). Every release comes with bug fixes for our supported platforms, so there is a chance the issue you are seeing is fixed in a newer editor version.
    - Try to re-submit the bug report. Let me know if it doesn't work with the updated Unity version and we can give it a try together.