Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Runtime error bad argument #2 to 'newImageSheet' ONLY when building to iOS device
Started by nml2727 Dec 31 2019 01:26 PM

7 replies to this topic
ios device ios newimagesheet runtime error
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

nml2727

[GLOBAL: userInfoPane.html]
nml2727
  • Enthusiast

  • 89 posts
  • Corona SDK

I have a game that works fine in the simulator.  I have also exported it to an Android device and it also works just fine.

 

However, I just added to TestFlight in iTunes Connect and installed it on an iOS device.  Now it is giving me 

 

Runtime error

 

bad argument #2 to 'newImageSheet' (for single frame size, 'options' table must contain valid 'width' and 'height' values) 

 

 

 

I've double checked the size of the images, the case, the path, and everything else I can think of.  

 

Any ideas as to why I would only get this error on iOS devices and not on Android devices or on the simulator?



[TOPIC: post.html]
#2

agramonte

[GLOBAL: userInfoPane.html]
agramonte
  • Corona Geek

  • 1,307 posts
  • Corona SDK

iOS is case sensitive and Android isn't. I suspect that you have a path or file that does not match case wise with the actual file. Just a guess.



[TOPIC: post.html]
#3

nml2727

[GLOBAL: userInfoPane.html]
nml2727
  • Enthusiast

  • 89 posts
  • Corona SDK

I thought Android was case sensitive as well and it was only the simulator that wasn't?  

 

Regardless, I have tripled checked file names paths and am not seeing any differences. 



[TOPIC: post.html]
#4

nml2727

[GLOBAL: userInfoPane.html]
nml2727
  • Enthusiast

  • 89 posts
  • Corona SDK

I plugged in the device and checked the console messages in xcode and came across this:

 

WARNING:  Image size (4570,570) exceeds max texture dimension (4096).  Image will be resized to fit. 

 

 

So I guess that's why it's later complaining that my width/height values are not right.

 

My question now is, what's the best way to fix this problem?   I made all my sprite sheets from Inkscape in a linear format from left to right.  If I resize it to be a square will I need to change the sheetOptions at all?

 

Currently I have:  

	sheetOptions =
	{
		width = 570,
		height = 570,
		numFrames = 8
	}


[TOPIC: post.html]
#5

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Corona Geek

  • 1,103 posts
  • Corona SDK

Have you actually defined sheetContentWidth and sheetContentHeight (see documentation)? If you haven't, then do.

 

In any case, you should reduce the overall size of those frames, because if they are 570x570, then you should package them with other images in the same sheet. As things are now, you are being extremely inefficient with your texture memory.

 

Easiest way to fix that is to just break the image into two or more rows, but the best way in terms of texture memory usage is to rethink your image dimensions in general or to add other images to the sheet to fill up all that empty and wasted space.



[TOPIC: post.html]
#6

nml2727

[GLOBAL: userInfoPane.html]
nml2727
  • Enthusiast

  • 89 posts
  • Corona SDK

Okay so if I do add several types of animations into the same sprite sheet, then when I go to use them on different display objects, I would use the same sheetOptions but the sequences would be different and pertain to only the frames that particular display object needs? 



[TOPIC: post.html]
#7

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Corona Geek

  • 1,103 posts
  • Corona SDK

You'd need to use the more complex method of defining your image sheets (again, see the documentation). You'd have different animation sequences for each sprite, but those would be found under the same table.



[TOPIC: post.html]
#8

pixec

[GLOBAL: userInfoPane.html]
pixec
  • Contributor

  • 102 posts
  • Corona SDK

I think what xedur is suggesting partly is that you could also make them images to be 512 and upscale in corona to 570 which means only 11% upscale and you spend only one fourth of the text memory


[topic_controls]
[/topic_controls]

Also tagged with one or more of these keywords: ios device, ios, newimagesheet, runtime error