I am having issues with the roll-a-ball tutorial. Specifcally the rolling sound.


(Elijah Lucian) #1

the problem i run into is this line specifically.

rollingParam.setValue(Mathf.Max(Mathf.Abs(rb.velocity.x), Mathf.Abs(rb.velocity.z)) * 40.0f);

(my “rb” is the rigid body from the original unity project)

these are the errors I get.

NullReferenceException: Object reference not set to an instance of an object PlayerController.FixedUpdate () (at Assets/Scripts/PlayerController.cs:45)

FMOD Studio: Instance of Event event:/Movement found playing at the origin. EventInstance.set3DAttributes() should be called on all 3D events UnityEngine.Debug:LogWarningFormat(String, Object[])

So this leads me to believe that somehow the project supplied with the tutorials have something already set up, however I can’t see exactly where it is.

Another thing, that when I take out the line above my “movement” sound is triggered from the “ambience emitter” and not the player… seems really strange, seeing as how I am copying the code line for line and nothing was mentioned about how to set it up otherwise in the videos.

pls help!


(Elijah Lucian) #2

here is my full code.


I tried some other code. still doesn’t work. still gives me the same error
“Object reference not set to an instance of an object PlayerController.FixedUpdate () (at Assets/Scripts/PlayerController.cs:45)”


(Nicholas Wilcox) #3

Line 32 is not working correctly because the event “event:/Movement” doesn’t have a speed parameter.

Also to fix the warning about sounds playing at the wrong position you need a call set3DAttributes on the EventInstance in the fixedUpdate method.


(Elijah Lucian) #4

I followed the series exactly… why does she mention to use “speed” here if it’s not something that exists… ?


(Nicholas Wilcox) #5

The videos don’t cover the creation of the events in studio. It’s assumed by the code that whatever event is being played has a parameter setup in studio called “speed”.