Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs

Hey! 
I tried your script on Unity 2018 and couldn't reproduce your error. Can you let me know what platform and unity version you're running on?  And if you happen to have a simple project that produces your error I can look at, even better. Thanks!!