Posts

Post marked as solved
5 Replies
2.9k Views
Even if the operating system language has been set to something else (such as Finnish), NSError.localizedDescription seems to always have the description in English. I need the error message provided by the system in Finnish, but I have no idea how to achieve this.Somebody on the internets says that in order to achieve this, one has to create a new localization in the Xcode project (which happens on the Info pane of the project settings). I don't need localizations per se, because this project is supposed to be in one single language. Either way, when I try to add a new localization (by clicking on the + button and selecting "Finnish") nothing happens. It shows an empty list of files to localize, and when I click the Finish button, nothing at all happens. No new localization is added to the list.(I'm wondering if this happens because the project has been created in an unconventional manner. More precisely, it has been created by SpriteBuilder. Changing the project to something else is pretty much out of the question, so that's not a solution.)I just want the Finnish version of localizedDescription. How can I retrieve it from the system?
Posted
by WarpRulez.
Last updated
.
Post marked as solved
12 Replies
2.8k Views
I have been trying to find information on this, but I just can't find anything. The SKShader and SKUniform reference documents do not provide this information, and neither does the SpriteKit Programming Guide document (and in fact, it seems that shaders are not mentioned there at all, even though the document is linked to from the SKShader and SKUniform reference documents). Couldn't find this by googling either.The SKShader documentation recommends sharing shaders between sprites as much as possible. In other words, if two sprites use the same shader, it's better to share the same SKShader object between them rather than create a new shader for each one.But what if two such sprites use the same shader, but different uniform values? For example, there may be a uniform named "factor" used in the shader, and one sprite wants to use a value of 0.25 for it, while another wants to use a value of 0.4. (As far as I understand, this is something that can be done with one single shader, and it should be completely efficient. Nothing changes when rendering the sprites, except the value of that uniform, which should be possible and efficient.)I can't find any info on what the kosher way of doing this in SpriteKit using SKShader.The 'shader' property of SKSpriteNode retains the object. Which means that the one and same SKShader object will be shared between two sprites if I simply assign one to both. Obviously this won't work if I want them to use a different value for a uniform.I notice that SKShader is copyable. Should I assign a copy of the original SKShader object to each sprite? Will this work? Will it be efficient? Can then each copy be assigned different uniform values and then they will work properly? Or do I need to replace the SKUniform objects in each copy with new objects?What is the correct way of doing this?
Posted
by WarpRulez.
Last updated
.