Something wierd going on.. help please.

Discuss coding questions, pull requests, and implementation details.
Post Reply
User avatar
Hazelnut
Posts: 3015
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Something wierd going on.. help please.

Post by Hazelnut »

Okay, so something wierd is happening with the public float variables for sound volume of footsteps & riding that I cannot figure out. I'm trying to reduce the volume of the horse sounds since they're so much louder than everything else. When I did the TransportManager I copied the sound volume bit from PlayerFootsteps including a public class variable for the sound volume that is then multiplied by the global volume set by the player.

Footsteps volume is set to 0.7f in the class, but is 0.45 when I run DFU in Unity editor. Riding volume is set to 1.0f in the class and same when I run the editor, regardless of what value I put in the class.

Now I know that public vars are changable in the Unity inspector and that these values persist across sessions. But that's for gameobjects and components, which neither of these manager classes are. They're lazy initialised by GameManager and stored in there as singletons, and while GameManager is a MonoBehaviour and shows up in the inspector, these classes don't since they're not added as components. Still I have no other explanation for the behaviour I see other than Unity is setting the values. I have searched for the value 0.45 in all the files, scenes / prefabs etc and nothing.

Also if I change the variable to private everything works just as I would expect. (can't do that since it would break tedious travel mod)

Help please.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
King of Worms
Posts: 4752
Joined: Mon Oct 17, 2016 11:18 pm
Location: Scourg Barrow (CZ)
Contact:

Re: Something wierd going on.. help please.

Post by King of Worms »

Its loud because the wav is loud.
Or am I wrong?

I reduced the volume of the horse when I eas recreating the sounds and its ok now.

Some sounds have just unreasonably high volume in vanilla

I dont think it should be modulated thru the core?

User avatar
Hazelnut
Posts: 3015
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Something wierd going on.. help please.

Post by Hazelnut »

Well it is, and so are footsteps. You may need to undo the modulation you did, as the loudness is due to this setting being stuck at full blast I think. Not saying the wav itself isn't loud but the core is maxing it relative to other sounds too.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Something wierd going on.. help please.

Post by Interkarma »

Hazelnut wrote: Thu Aug 29, 2019 7:13 pm Footsteps volume is set to 0.7f in the class, but is 0.45 when I run DFU in Unity editor. Riding volume is set to 1.0f in the class and same when I run the editor, regardless of what value I put in the class.
MonoBehaviour components attached to scene objects with public fields will be set by scene data. In the case of PlayerFootsteps, this is attached to the PlayerAdvanced prefab, which has 0.45 set as the Footstep Volume Scale. Scene/prefab state is always authoritative over these values when game starts.

If you're adding a similar setup in the TransportManager, this will also become controlled by scene/prefab, you'll need to set that new value on PlayerAdvanced prefab too. The best way to do this is actually on the prefab itself in Project view (not in Hierarchy). First search for the prefab like below.

prefab.JPG
prefab.JPG (32.63 KiB) Viewed 3739 times

And then edit values in the Inspector for that prefab.

footsteps.JPG
footsteps.JPG (29.11 KiB) Viewed 3739 times

User avatar
Hazelnut
Posts: 3015
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Something wierd going on.. help please.

Post by Hazelnut »

Thank you!

I have no idea why the find in files didn't catch the 0.45 value in that file... anyway, is done now. :D
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

Post Reply