Sound damping not working (and then concerns about GameObject.isStatic)
Posted: Sun Apr 21, 2019 12:42 am
Some time ago I came across some code in EnemySounds supposed to do some inexpensive sound damping approximation; Lowering the volume of sounds coming from enemies that have no line of sight to the player, checked with a raycast.
This evening I experimented a bit with this feature, and found no difference when listening to a pacified fire daedra around a corner and just slightly ahead where I could see it directly.
I instrumented the code (Unity Editor doesn't work very well under Linux, I rely MonoDevelop for editing and on log messages instead), and discovered that the "CombinedModels" object that was hit by the raycasts was not static, so was not considered for sound damping.
Searching further, I read that the GameObject.isStatic attribute is "Editor only"; And indeed damping works in Unity Editor, just not in standalone player.
What I wonder now, is not only whether this flag can be read by the standalone player (seems it can't) but also if it can be written by the standalone player to make some GameObjects static, something that I do not know how to test...
This evening I experimented a bit with this feature, and found no difference when listening to a pacified fire daedra around a corner and just slightly ahead where I could see it directly.
I instrumented the code (Unity Editor doesn't work very well under Linux, I rely MonoDevelop for editing and on log messages instead), and discovered that the "CombinedModels" object that was hit by the raycasts was not static, so was not considered for sound damping.
Searching further, I read that the GameObject.isStatic attribute is "Editor only"; And indeed damping works in Unity Editor, just not in standalone player.
What I wonder now, is not only whether this flag can be read by the standalone player (seems it can't) but also if it can be written by the standalone player to make some GameObjects static, something that I do not know how to test...