Not exactly a bug, but asserts can be jerks at times

Hi guys. I’m aware that the Tile Map is an experimental feature so I’m not surprised that some crashing is occurring (Even if it is due to my own idiocy.). Just thought I’d throw this up here on the off chance that it’d help out. Here’s what happens:

  1. I create a new C++ project (Empty)

  2. I create a new Actor in C++

  3. I add Paper 2D into the build.cs file

  4. I go to my uproject file and
    “Generate visual studio project
    files” so that I can use the Paper 2D
    headers

  5. I create a
    TileMapComponent variable. At this
    point the project builds fine.

  6. I
    set TileMapComponent to be the root
    component for the actor

  7. I use the TileMapComponent function CreateNewTileMap:



    AGenerated2DMap::AGenerated2DMap()
       {
        	PrimaryActorTick.bCanEverTick = true;
        
        	RootComponent = TileMapComponent;
        
        	TileMapComponent->CreateNewTileMap(this->MapWidth, this->MapHeight, this->TileWidth, this->TileHeight);
        }

Where MapWidth etc. are int32’s that are for the different attributes of the tile map.
8) At this point, when I compile in the editor, the editor crashes. I also can no longer open up the project as the editor crashes when loading the project.

Things I’ve tried:
Admittedly not a great amount. I’ve tried regenerating the visual studio files on the off chance that helped, which it doesn’t. I’ve just checked through the log file which points to there being an unknown function in the Paper2D dll I assume:


[2017.11.12-22.43.11:043][  0]LogWindows: Error: === Critical error: ===
[2017.11.12-22.43.11:043][  0]LogWindows: Error: 
[2017.11.12-22.43.11:044][  0]LogWindows: Error: Fatal error!
[2017.11.12-22.43.11:044][  0]LogWindows: Error: 
[2017.11.12-22.43.11:044][  0]LogWindows: Error: Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x000001de
[2017.11.12-22.43.11:044][  0]LogWindows: Error: 
[2017.11.12-22.43.11:044][  0]LogWindows: Error: [Callstack] 0x00000000DA661ACB UE4Editor-Paper2D.dll!UnknownFunction []
[2017.11.12-22.43.11:044][  0]LogWindows: Error: [Callstack] 0x00000000D9B31840 UE4Editor-TestStuff-3692.dll!AGenerated2DMap::AGenerated2DMap() [c:\users\richard\documents\unreal projects\teststuff\source\teststuff\generated2dmap.cpp:14]
[2017.11.12-22.43.11:044][  0]LogWindows: Error: [Callstack] 0x0000000001ED058D UE4Editor-CoreUObject.dll!UnknownFunction []
[2017.11.12-22.43.11:044][  0]LogWindows: Error: [Callstack] 0x0000000002148D20 UE4Editor-CoreUObject.dll!UnknownFunction []
[2017.11.12-22.43.11:044][  0]LogWindows: Error: [Callstack] 0x000000000212AF8F UE4Editor-CoreUObject.dll!UnknownFunction []
[2017.11.12-22.43.11:044][  0]LogWindows: Error: [Callstack] 0x0000000001ED2507 UE4Editor-CoreUObject.dll!UnknownFunction []
[2017.11.12-22.43.11:044][  0]LogWindows: Error: [Callstack] 0x000000000135E6A0 UE4Editor-Core.dll!UnknownFunction []
[2017.11.12-22.43.11:044][  0]LogWindows: Error: [Callstack] 0x00000000015B19A2 UE4Editor-Core.dll!UnknownFunction []
[2017.11.12-22.43.11:044][  0]LogWindows: Error: [Callstack] 0x00000000107DF60D UE4Editor-Projects.dll!UnknownFunction []
[2017.11.12-22.43.11:044][  0]LogWindows: Error: [Callstack] 0x00000000107DF91E UE4Editor-Projects.dll!UnknownFunction []
[2017.11.12-22.43.11:044][  0]LogWindows: Error: [Callstack] 0x0000000079507F71 UE4Editor.exe!UnknownFunction []
[2017.11.12-22.43.11:044][  0]LogWindows: Error: [Callstack] 0x000000007950C4EC UE4Editor.exe!UnknownFunction []
[2017.11.12-22.43.11:044][  0]LogWindows: Error: [Callstack] 0x000000007950525A UE4Editor.exe!UnknownFunction []
[2017.11.12-22.43.11:044][  0]LogWindows: Error: [Callstack] 0x00000000795054AA UE4Editor.exe!UnknownFunction []
[2017.11.12-22.43.11:044][  0]LogWindows: Error: [Callstack] 0x0000000079512379 UE4Editor.exe!UnknownFunction []
[2017.11.12-22.43.11:044][  0]LogWindows: Error: [Callstack] 0x0000000079513D57 UE4Editor.exe!UnknownFunction []
[2017.11.12-22.43.11:044][  0]LogWindows: Error: [Callstack] 0x000000002E252774 KERNEL32.DLL!UnknownFunction []
[2017.11.12-22.43.11:044][  0]LogWindows: Error: [Callstack] 0x0000000030260D51 ntdll.dll!UnknownFunction []
[2017.11.12-22.43.11:044][  0]LogWindows: Error: [Callstack] 0x0000000030260D51 ntdll.dll!UnknownFunction []
[2017.11.12-22.43.11:044][  0]LogWindows: Error: 
[2017.11.12-22.43.11:058][  0]LogExit: Executing StaticShutdownAfterError
[2017.11.12-22.43.11:060][  0]LogWindows: FPlatformMisc::RequestExit(1)

That’s the bug that I ran into when using C++. So me being curious, I decided I’d have a look to see what would happen if I used blueprints (Spoilers I tried blueprints before but it kept crashing so I tried C++ to see if I could get lucky.).

  1. Create a blank project for blueprints
  2. Create a blueprint and add a tilemap component
  3. Replace root with tilemap component
  4. Use tilemap component function “Create New Tile Map”. Oddly enough, it compiled fine and didn’t crash, however:
  5. Create variables and place the variables into the input pins for the Create New Tile Map function: crash.

With this, I tried a few things:

  1. Tried not replacing root and just keeping the tile map component as a child component of root. Didn’t work
  2. Tried only inputting map width or map height… crash
  3. Tried only inputting tile width or tile height; winner!

I checked the logs and was graced with the presence of this line:


[2017.11.12-22.59.58:403][834]LogWindows: Error: Assertion failed: (NewWidth > 0) && (NewHeight > 0) [File:D:\Build\++UE4+Release-4.18+Compile\Sync\Engine\Plugins\2D\Paper2D\Source\Paper2D\Private\PaperTileLayer.cpp] [Line: 116] 

So I need to be honest at this point: I’d forgotten that I’d left my map width/map height at 0; I feel like a moron. For those curious, when a new layer is created in the tile map, it goes through with the above assert to make sure it’s valid. I went back and created a new C++ project and it seemed that was also the problem. An idiotic X hours of my life for sure, however is there any chance these errors could be handled a nicer way? Unfortunately with the editor crashing entirely, it took a while to dig through to work out exactly why the editor had crashed. It also doesn’t help that the C++ project can’t be opened again (I’m sure there would be a work around that I haven’t thought of but still.)

Thanks for looking through my ramble.