- Home /
How do i check if a file exists (on the web)?
Hi
I want my game to be able to check if a certain file on a certain webpage exist. and the it can give the user the option on whether they want to download it or not.
My problem is i do not know how to make my game check for that file?
Can anyone help me out
Answer by semiessessi · Jan 15, 2014 at 04:41 PM
If you are using UnityEngine.WWW to make the web request then you can check the error member from UnityEngine.WWW
its also possible to get the verbose text of the response and parse it for the http status code.
Thanks for linking me to that, I've got it working now. Thank you very much :)
Answer by neomarian · Feb 24, 2019 at 04:44 PM
Use UnityWebRequest.Head and check responseCode, if >= 400 then file does not exits (according to wikipedia)
Your answer
![](https://koobas.hobune.stream/wayback/20220613130523im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Check if key is pressed once 1 Answer
Update() VS delegate events 2 Answers
update script 1 Answer
FixedUpdate limits: consistant 0.01 s on mobile devices? 1 Answer
Update for gui 1 Answer