|
Hello, I have been trying to combine some footstep scripts together to create one that will detect the surface the character is on and play some sounds. Im currently at this point. Im constantly getting a compiler error "BCE0022: Cannot convert 'int' to 'System.Type'." Can someone please help me figure out how to fix this script, or if I'm doing it in a needlessly complicated way? Thanks in advance for any help!
(comments are locked)
|
|
I think the problem is here : this should read : And where you say : this makes no sense, there is no boolean called true, so what is the 'true' you are checking for? but I can see you possibly having problems with groundType not having a value during the start function where you are checking if it == 0 || 1 . And do you want to only run this at start? Also at that part of the script, both conditionals in your while statement are the same : did you mean for one to be or detect different controller.velocity.magnitude? also it would be good practice to typecast audioStepLength also : Oh wow, I can't believe I didn't notice the improper '=' to ':' until you said that. Everything works great now, thank you so much! I also fixed the other things you said just for good measure. Just shows how much you need an outsider's opinion sometimes hah :)
Jun 28 '12 at 07:18 PM
Alayna
no worries, I missed the = on first read too =]
Jun 28 '12 at 07:22 PM
alucardj
(comments are locked)
|
|
Just in case other people have the same problem that I had, since it can be really hard (atleast for me) to find a working footsteps script, I will post it here. This works fine for me when put on the First Person Controller. The audioStepLength determines the space between each sound, and you can input sounds by increasing the element size in each section. To work you must place colliders near the ground that are set to is trigger, and tagged with the respective tags. I don't take any credit for this since it was mostly fusing a bunch of scripts from the tutorials and from Unity Answers. I hope that it helps someone! Just get rid of the prints at the bottom and it should work!
(comments are locked)
|

You can double-click the error in the console to open it to the problem line in MonoDevelop. What line is causing the issue?