Hello Guest

Author Topic: tk2dTextMesh is not correctly using SortingLayer in Game View  (Read 9342 times)

AbsurdInteractive

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 16
    • View Profile
We have our Camera set at z Position 0 and all of our sprites and meshes within our game set at z Position 0 as well. The camera is orthographic and has a Near Plane of 0, and a Far Plane of 10. So far we've had no issues displaying anything in our 2D game by using SortingLayers.

Just today we noticed when we created a tk2dTextMesh at z Position 0, that the tk2dTextMesh was not showing up in the Game View despite the SortingLayer being setup in front of all our sprites. It did show up in our Scene View correctly though. After tweaking many different things, the only way I could get the tk2dTextMesh to show in the Game View was to actually change my Game View camera's Near Plane to -1 to display the tk2dTextMesh. So I was wondering how is the tk2dTextMesh being rendered differently from the rest of the meshes because that is the only 2D Toolkit object that seems to have this issue.

Also, is there a file I should look in to possibly see if I can try to fix this issue?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: tk2dTextMesh is not correctly using SortingLayer in Game View
« Reply #1 on: April 09, 2014, 06:01:34 am »
What version of 2D Toolkit and Unity are you using

AbsurdInteractive

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: tk2dTextMesh is not correctly using SortingLayer in Game View
« Reply #2 on: April 09, 2014, 06:15:29 am »
I'm using Unity 4.3.4f1 with 2DToolkit 2.4.0.
« Last Edit: April 09, 2014, 06:42:01 am by AbsurdInteractive »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: tk2dTextMesh is not correctly using SortingLayer in Game View
« Reply #3 on: April 09, 2014, 06:38:23 am »
I can't see this happen on my version. Can you create a repro case for this?

AbsurdInteractive

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: tk2dTextMesh is not correctly using SortingLayer in Game View
« Reply #4 on: April 09, 2014, 06:41:50 am »
Ok, so I had the tk2dtextmesh on the Default SortingLayer with OrderInLayer to 1. I had other Unity sprites behind the tk2dtextmesh. The sprites were in SortingLayer Default and had OrderInLayer 0.

Then I changed the SortingLayer for the tk2dtextmesh to the SortingLayer that is in front of the Default, which for me is Foreground SortingLayer with OrderInLayer as 1. The tk2dtextmesh did not show up again. But when I kept the tk2dtextmesh's SortingLater to Foreground, and then changed the OrderInLayer to 0, then the tk2dtextmesh showed up in front of the sprites.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: tk2dTextMesh is not correctly using SortingLayer in Game View
« Reply #5 on: April 09, 2014, 07:13:45 am »
Are your sprites using the solid shader? sorting layer only affects transparent things... I still can't reproduce this, it must be something local to your set up - if you post a unity package demonstrating the issue I could probably tell you why it isn't working.

AbsurdInteractive

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: tk2dTextMesh is not correctly using SortingLayer in Game View
« Reply #6 on: April 09, 2014, 07:46:05 pm »
My Unity sprites are using the Default-Sprite shader for sprites, and my tk2dtextmesh is using the BlendVertexColor shader that comes with 2D Toolkit. I'll try to make a UnityPackage for you.

AbsurdInteractive

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: tk2dTextMesh is not correctly using SortingLayer in Game View
« Reply #7 on: April 09, 2014, 09:14:19 pm »
Here you go. Here's the repro. Just open the scene textMeshRepro. I imported 2DToolkit 2.4.0. As per common sense I did NOT include your 2DToolkit plugin in the repro package. My default camera size was 640 by 960, and I had iOS, build, but that did not affect anything as the problem seems to be in all the build types.

AbsurdInteractive

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: tk2dTextMesh is not correctly using SortingLayer in Game View
« Reply #8 on: April 11, 2014, 09:12:05 pm »
Was just wondering if you had a chance to look at the Repro?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: tk2dTextMesh is not correctly using SortingLayer in Game View
« Reply #9 on: April 12, 2014, 07:01:06 am »
Your camera is at 0, 0, 0.
The text mesh is at 0, 0, 0 and mesh bounds are offset slightly for backwards compatibility pushing it out of the frustum.

Move your camera back a bit and everything works as expected.