Forum rules - please read before posting.

Play() Animation event getting error

i believe this has to do with something in AC, if im reading the guidelines correctly,  but here is my situation:

I have a light(as in a sprite of a light) in the scene(2d game mode), that has an animation attached to it that is making it flicker on an off.  The goal is to have a tick sound play everytime it turns on and off, as per the key frames in the animation tab.  I was able to do this by adding the AC sound component, inserting the clip, and then in the animation, ad am "event" that triggers "Play()".   and it works when i test it, but the animation tab becomes broken.  It's just all grey and the console displays this:

AmbiguousMatchException: Ambiguous matching in method resolution
System.Reflection.Binder.FindMostDerivedMatch (System.Reflection.MethodBase[] match) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/Binder.cs:106)
System.MonoType.GetMethodImpl (System.String name, BindingFlags bindingAttr, System.Reflection.Binder binder, CallingConventions callConvention, System.Type[] types, System.Reflection.ParameterModifier[] modifiers) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System/MonoType.cs:245)
System.Type.GetMethod (System.String name, BindingFlags bindingAttr) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System/Type.cs:787)
UnityEditor.AnimationEventPopup.FormatEvent (UnityEngine.GameObject root, UnityEngine.AnimationEvent evt) (at C:/buildslave/unity/build/Editor/Mono/Animation/AnimationWindow/AnimationEventPopup.cs:160)
UnityEditor.AnimationEventTimeLine.EventLineGUI (Rect rect, UnityEditorInternal.AnimationWindowState state) (at C:/buildslave/unity/build/Editor/Mono/Animation/AnimationWindow/Deprecated/AnimationEventTimeline.cs:146)
UnityEditor.AnimEditor.EventLineOnGUI () (at C:/buildslave/unity/build/Editor/Mono/Animation/AnimationWindow/AnimEditor.cs:311)
UnityEditor.AnimEditor.OnBreadcrumbGUI (UnityEditor.EditorWindow parent, Rect position) (at C:/buildslave/unity/build/Editor/Mono/Animation/AnimationWindow/AnimEditor.cs:112)
UnityEditor.AnimationWindow.OnGUI () (at C:/buildslave/unity/build/Editor/Mono/Animation/AnimationWindow/AnimationWindow.cs:47)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)





I've found threads elsewhere with similar issues but none of them say where to fix it, and was hoping maybe its something in AC that i can change to fix it.. any ideas?  thanks! 

Comments

  • can you post screenshots of the issue(s), of the inspector so we can see the setup and options of things.
  • Threads on this forum?  I don't recall hearing of this problem before, and none of the line errors refer to any of AC's scripts.

    When you say it works when you test it, do you mean it works when you play the game?  If that's the case, and the Animation window breaks, then it could be that Sound's Play() function is being run outside of the game running.  I could be wrong, but I believe that would be a Unity issue.

    You should be able to get around it by instead calling a function of your own on a custom script, and have that function run Sound.Play() only when the game itself is running.
  • thanks for the replies! 

    Sorry, didn't mean threads on this forum, was actually talking about the thread that klarax posted, but I couldn't understand anything from it.  Guess it definitely is a Unity issue, calling from a custom script is worth a try, just need to learn how to do that hahah.  I did find a work around by making an after effects composition and just copying the frames, frame by frame, and got it to sync to the light so its just a looping file now.  I'll try the script function if I ever run into it again in the future!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.