I tried creating a static NSMutableDictionary like this
static NSMutableDictionary* Textures;
+(Texture*) loadTexture: (NSString*) name path: (NSString*) path{
CGImageRef imageReference = [[UIImage imageNamed:path] CGImage];
GLKTextureInfo* textureInfo = [GLKTextureLoader textureWithCGImage:imageReference options:nil error:NULL];
Texture* texture = [[Texture alloc] init:textureInfo];
if(!Textures) Textures = [[NSMutableDictionary alloc] init];
[Textures setObject:texture forKey:name];
return texture;
}
It seems I can only add one object to the dictionary but I believe I took care of creating a new one each time so I am stuck on why it seems I am only able to store one object in this dictionary. Also, it adds the first one and fails to add any subsequent calls.