Referencing items within a layer

Aug 30, 2010 at 7:34 PM
Edited Aug 30, 2010 at 7:35 PM

Layer clipLayer;
clipLayer = level.getLayerByName("clip");
if (clipLayer.Items.Count > 0)

It claims that clipLayer is a null object, and it won't compile. The layer "clip" does exist in my map, and I can assume this is not a problem with my map because as it stands, it isn't even detecting clipLayer as a list (though i looked through level.cs and confirmed it is indeed a list).

The purpose of this code is to retrieve all the items from a layer, and store them to create geoms in farseer for map collisions.

Please help with this


This post/conversation was originally located at the old gleed2d forums and was moved here in September 2010 by the project coordinator, zissakos.

Aug 30, 2010 at 7:37 PM

Hi keres

won't compile because of a null object? I think you are mixing runtime with compile-time errors here.

So what exactly happens when you press F5? Have you tried to debug it line by line? Which line throws the error?

And if you send me your level XML file I could try this here.