It was such a pain, there's a lot of specifics to the unity version you're using, I followed a tutorial I'll find it and comment it when I find it
I actually don't have the files right now since I don't have the computer I made it on at the moment and I can't remember what tutorial I used because I made this a while ago, but you're welcome to use a unity decompiler tool to try to figure out how it works. I'm sorry I can't help you more I just genuinely cannot remember what tutorial I used.