Texture Converter

Topics: User Forum
Nov 17, 2011 at 9:52 PM

Hi.

I have a Texture2D from a png that has a large rounded-corner rectangle in the middle of transparent background. I'm getting an exception when I try to turn this into a list of Vertices using PolygonTools.CreatePolygon. It is a null reference exception at the second if statement in:

if (_multipartDetection || polygon.Count <= 2)
{
    if (SearchNextHullEntrance(detectedPolygons, polygonEntrance.Value, out polygonEntrance))
        searchOn = true;
}

In TextureConverter.cs. It is polygonEntrance that is null.

After looking over the code it looks like this will always result in a null reference if the condition "polygon.Count <= 2" is met because polygonEntrance does not actually get instantiated until polygon.Count is greater than 2.

Nov 28, 2011 at 3:00 PM

Are there any work arounds for this, or have I missed something?