What happens if you modify a image when it's open? - png

I was doing a geometry dash private server with a friend then I noticed that we can modify images in ftp while someone is running the game so I want to ask what will happen if we rename the image when someone is playing?

It depends on what image you're talking about. Gamesheets get loaded on starting the game so renaming them will do nothing while running the game but detail images like the vault faces will only be loaded when needed. Since the names of these images are hardcoded you need to change those before renaming them, otherwise it will just crash due to missing files.

Related

SFML: unable to open .png file

It may sound like other questions related to this matter but I don't have any problems opening rectangular .png files. Seems like my computer has problems only with non-rectangular pictures (e.g. triangular play button without the background). What can be done? I think there's no need to provide a reproducible example. Appreciate all the help.
EDIT: the error is as follows
I think you forgot to put your picture in your project folder because I once made that mistake for a game that I made. You should also maybe remove Resources/res/ from the loadFromFile code.
I'm using rectangle and circle shapes with textures loaded form file without problem, transparent .png's too. If you are absolutelly sure that your code is correct, you got correct file address etc.. Maybe there is a problem with image. Try to load some another image where you 100% know that it works fine. Maybe your antivirus is messing with your projects,. Check if you have exception for your project directories. I could be more specific if you provide some code of your attempt to us.

Force Unity to save prefabs to disk

Using Unity 5.4.2.
I've created an editor script that implements an exporter for some prefab data when you press an export button. It recursively finds all the prefab files matching a certain type under its own directory and loads those prefabs so they can be exported in a custom manner.
The problem I'm having is that the prefabs on disk, that are loaded with
var prefab = AssetDatabase.LoadAssetAtPath<GameObject>(file);
do not match the current state in the editor. That is if you have modified some of the prefab data in the editor, it is not actually saved to disk. Note that this does not require any objects to be added to a scene, I am just exporting data directly out of components attached to prefabs.
I have tried adding AssetDatabase.SaveAssets(); to the top of my export function, which is supposed to save all the assets, but when I edit a value and then log the values loaded from the prefabs, they are not up to date. There are two (non-programatic) methods I have found so far that cause my exporter to be able to see the modified data:
If I exit Unity and restart it, the prefabs appear to get saved at that point and the exporter sees the updated data.
If I play and stop any scene, then export, the exporter can see the updated data, but oddly (according to git status) they have not been written to disk, so I suspect LoadAssetAtPath actually loads some cached version which is updated on 'play'.
Is there a way to force Unity to save everything to disk so that my exporter can operate on the most up to date values?
The following should do the trick
// Your changes go here
AssetDatabase.Save();
AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate); // perhaps even ForceSynchronousImport?
// You loading should go here
For more information about ImportAssetOptions see this documentation https://docs.unity3d.com/ScriptReference/ImportAssetOptions.html
Note: This does not answer the original question, but identifying and working around the cause may help anyone with the same/similar problem.
My problem was when exporting computed-and-cached properties in components attached to the prefabs. My assumption that LoadAssetAtPath would load a fresh instance from disk was wrong, it returns the version already in editor memory, which means cached values aren't invalidated like they would be with a fresh load.
The solution I used was to never cache when running in the editor, using #ifdef UNITY_EDITOR.

Memory problems when working with images and camera on iphone

In my application users can add up to 8 images taken by the camera and upload them to the server one-by-one.
My problem is that even when taking the first picture i get an memory warning, which of course forces the app to release any view not visible.
What is the best practice approach to handling pictures?
How do I hold them until they're uploaded, without running out of memory?
My objective is to avoid any memory warnings.
Thanks in advance.
/Esben
After clicking images store images into Document directory. It is most safe option to store
images and then use it. Find some tutorial and after click image send image to document
directory and then fetch from directory and use it. Hope it helps you.
Proceed Following steps.
I am faced like this problem, now it's working for me use following steps.
Select image and and display to UIImageView. then Upload to server.
Release UIImageView.
Again take picture and upload to server.

old images show after replacing with new ones in ios app

I am dealing with this really really annoying bug in X-Code where it seems to save images to some type of memory that seems impossible to clear.
I have replaced a bunch of images in which I am creating a clock animation however when I try to play the animation it showes all the old images, I have tried cleaning the app and still they continue to show even though I have deleted the images.. So then I tried changing the name of the images along with the code where they were getting called and now I'm getting a bunch more errors, So I'm just woundering if anyone knows how to get around this problem of xcode caching images.
You need to clean the build or delete it from the device/simulator. That usually takes care of it if you're sure the files are named correctly. Also make sure that you're using the correct case in your filenames, that messed me up a few times. :)
In the XCode explorer, right click on the image, use "Show in finder" and make sure they refer to the images you want.
Try using the Clean option from the Product menu in XCode.

Images and Caching - same image after name change

I've got a mysterious problem with images and caching. In my project I've got 20 photos that elegantly fade in and out with a random function that changes up the order a bit.
I found that I didn't like one image in particular, image_1.png and wanted to push it back in the rotation (each time the app starts the images start with image_1.png). So, I swapped the name of image_1.png with that of image_16.png. When I look at image in the project folder and in Resources indeed the images are as they should be but when I run the app its the same old image that starts things out.
I have reset the sim, deleted the app from my iPhone, removed the images from the project and reimported them and still the same image.
Even odder.. I have an image_0.png that is no longer in the project file at all ... its not even on my hard drive.... but it shows up as well.
Do I have a ghost in my Mac or is this just seriously persistent cache?
Clean All Targets
Sounds like a persistent cache.
Let me guess: you have your images in a directory that you add to your project as a reference?
Yeah, that stuff's weird and buggy. Even in the latest xcode. I find it helps to recreate the folder with the new contents in a different place, then remove the old one from the project and add the new one. Perhaps even closing the project before re-adding.
XCode sucks.