-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mechanical sound support part 3 #495
base: master
Are you sure you want to change the base?
Conversation
…component. Have mechsoundcomponent inherit from monobehaviour directly. Update mechsoundinspector to inherit from unity editor directly and by adding a propertydrawer to handle mechsound appearance. Initialize soundlist in mechsoundscomponent.
…he MechSound Drawer. Handle when no component attached to the gameobject implements it.
…om methods, refactor handling of audio clip playing using an established gameobject's audiosource, and moved call to update event into OnEnable method. Also deleted mechsounddata and some other minor cleanup.
…changes and then playing the clips under round robin selection.
…ts: plunger, drain, bumper.
convenient especially prefabs.
Awesome! This will take a little bit of time to review, trying my best for this week. |
Committed a fix for the zero-volume-by-default problem when adding |
Ok but what about the prefabs in the main repo, like the flipper? Should I move those into the pipeline repos? |
Yes, most of the prefabs are already moved on my branch. |
Got it. One more thing: The prefabs will need to reference my new sound code, so is it ok to introduce a dependency on the main repo in the asset library? |
Not sure I understand - The sound code is in the main repo, right? If a component that is implemented in the main repo sits on a prefab in the asset lib, that shouldn't be a problem, as long as they are in the same project. |
Yea I guess so. It's just a formal thing. You could install the asset library without the main package technically and then you'd get missing scripts in the prefabs. But then again who does that. |
Awesome! I'll go through this hopefully this weekend! |
I've now rebased this onto my collider branch, since I felt more comfortable resolving your commits than mine. ;) I'll do the testing now and if everything is good then I'll merge my branch first and then this one. |
Okay, in case my comments weren't clear in the other repo. I've now rebased and pushed the sound code:
Can you:
That'd be awesome, then I'll can do the review and merge this relatively quickly. |
I've got a few compilation errors, too (the logs below are from your branch, not the rebase branch, although they occur on the rebase branch as well):
|
Ok, checking out the rebased branch now |
Getting a different compilation error: |
Yes I got that one too, maybe a relict from the rebase. You can remove the entire method since it's not used. |
Alright I got it to work I think. It's a bit hard to tell because I get like three frames per second when running HDRP on my laptop. |
Awesome, everything seems to be fine too, here. Will do the review tomorrow hopefully. Cheers! |
Started testing - This is awesome! 👍 Okay if I rename I'm also redoing the icons (so my Illustrator file is complete), what do you think about this design? Since the music notes don't really represent music.. |
Also adding curly brackets around oneliners, if you could do that in the future that'd be awesome. |
Glad you like it. The changes you suggested are fine by me. I didn't make the icons myself anyways. They are just recolored default icons from Unity. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for this. I've pushed a commit to the -rebased
branch (6abd49f), lemme know what you think. Some other comments below.
VisualPinball.Unity/VisualPinball.Unity.Editor/Sound/SoundComponentInspector.cs
Show resolved
Hide resolved
I reviewed the changes you made on your branch. Formatting and style is too subjective and not important enough to argue about, so that's all good. The one thing I don't agree with is making private fields public so the inspector classes can access their names. If you look at Unity docs, you'll see they don't do this in their examples, and I think that's for a good reason. I know spelling out a variable name as a string kind of sucks for tracing usage in an IDE and breaks when the variable is renamed, but I think it's more important to communicate that this field is not relevant to outside classes and should not be written to from the outside. With the changes you've made, this is no longer clear. |
Well, they are prefixed with We're in a stage where refactoring is common, and I don't want to run after serialized member names that my IDE cannot handle. I would agree with you if we were talking about public APIs. There, it would be important to communicate visibility, and you wouldn't want anybody to write to your internals. But it's all internal here, anyway. Visibility is basically determined by the lowest access something needs, and not by whether we decide to offer a functionality to a third party. |
Ok fair enough |
Trying to fix the plunger issue and then I'll merge. |
Picking up where linojon left off in #466. I merged his changes into my fork and rebased the feature branch onto the upstream master branch. Here are the problems I have identified so far:
Problems
Usability
Add mech sound button situation ✅
Audio playback in editor ✅
SoundAssets
have a button to play back their audio in the editor. Pressing this button creates a new game object with an audio source in the currently open scene, if such an object doesn't already exist. This behavior is an unexpected and unwelcome side-effect, because it permanently alters the currently open scene.Sounds must be added manually ✅
Users must manually add sounds to each game object (these should be included in prefabs instead).
Architecture
Inheritance for the sake of type constraints ✅
DropTargetBankApi
needed a reference to the associatedDropTargetBankComponent
to call itsEmitSound
method. In otherxApi
classes the associatedxComponent
instance is referenced using theMainComponent
property defined in the abstract base classItemApi
.DropTargetBankApi
previously did not inherit fromItemApi
becauseItemApi
has a type parameter for the component type and a constraint that requires that type parameter (in this caseDropTargetBankComponent
) to inherit from the abstract base classMainComponent
, whichDropTargetBankComponent
did not. linojon solved this by makingDropTargetBankComponent
inherit fromMainComponent
purely to satisfy the constraint ofItemApi
without actually implementing any of the abstract methods ofMainComponent
(and instead throwing an Exception when they are called). This is bad because it leads to unexpected results when calling those methodsDiligence
SerializableDictionary
withNonSerialized
attribute inMechSoundsComponent
seems a bit pointless, but I have not yet checked whether it actually is ✅Serialized
andNonSerialized
attributes ✅public
fields all over ✅Bugs
MechSound.volume
is not applied ✅Incomplete