If you find yourself having to strip illegal chars from user input, as I have found myself doing on numerous occasions when dealing with files and directory paths in Unity, it is always a good idea to have a method/function handy and at the ready, there are of course many ways to do this and I know that some would lean towards Regex as I have also done in the past, but here’s my adapted unity 3d – c# .net offering that also does what it says on the tin.