Get sprite texture of a Sprite Sheet?

Hi all.

I’m setting up my sprite sheet like this:

SpriteFrameCache* cache = SpriteFrameCache::getInstance();
cache->addSpriteFramesWithFile("pickups.plist");

And I want to grab only 1 texture of this sprite sheet. I mean i need to fetch 1 sprite’s texture among the sprite sheet that consists of 2 sprites. I’m using this code:

auto spritecache = SpriteFrameCache::getInstance();
auto sprFramePickupMagnet = spritecache->getSpriteFrameByName("pickupMagnet.png");
auto sprFramePickupShield = spritecache->getSpriteFrameByName("pickup_shield.png");

pickup = Pickup::createWithResources(0, sprFramePickupMagnet->getTexture(), sprFramePickupShield->getTexture());

But sprFramePickupMagnet->getTexture() this code gives me the whole texture of my sprite sheet, I want only 1 sprite’s texture. How can i do that?

Thanks!!

Need help @slackmoehrle @zhangxm @dabingnn

My problem is urgent

Solved. i passed SpriteFrame arguments instead of Texture2d