Sword slash does not behave as in video

I have managed to trigger the animation flip of the sword slash but parenting the instantiated prefab to the sword object causes that animation to do a 360 degree slash. If I disable the parenting then it behaves as seen in the video. So either I have done something wrong or the parenting in the video is not working and I don’t know which is the case.

This may be beyond my technical capacity to assist, as my familiarity with Visual Scripting is limited (and there are a lot of assumptions I’m having to make about what’s going on). The deeper you head into the course using VS instead of C#, the more difficult this will become to debug (or to get assistance from non VS Code programmers.

Assuming your animation is set up correctly, the animation almost needs to be being called twice. Is there a script on the sword that also might be receiving and reacting to the events?

I’m assuming Visual Scripting has a node analogous to a Debug.Log. If it does, log out each of the events and verify that they are firing only once per attack.

While this looks like an interesting conversion, I strongly suggest also doing a version of this course using C#. If you’re new to C#, you might take our beginner friendly 2D game course to familiarize yourself with C# to make the code in this course a bit easier to understand. You could do this in a parallel fashion (Do the code @Stephen_Hubbard teaches in C#, and while on the same lecture write the code in Visual Scripting) or you can complete the course in C# and then go back through and attempt it in VS. As the course progresses further, many of these components are going to interact together in complex ways which may be difficult to debug in VS.

I debugged the instantiated animation, as you suggest, and only one instance is being logged per click, so that part should be working as intended.


I tried slowing the animation down to 1 frame, to get a clearer picture of what is going on, and it seems like the parenting to the sword object causes the slashAnim rotation to match that of the sword, which creates the 360 degree “effect”, and why it disappears when I disconnect the parenting.

I have never used C#, or done any programming at all, and wouldn’t know where to start. I come directly from the Learn programming the easy way, with Visual Scripting, and thought that this would be the next natural step. Is the course you mention the one called “Complete C# Unity Game Developer 2D Online Course”?

God I feel so dumb… I just noticed in the video just now, that when he slashes the animation is being childed to the Active Weapon, not the Sword. Now it works just like the video…

Yes it is. It starts assuming no direct knowledge of C# and builds up your knowledge of the language as it goes.
Visual Scripting is a nice starting off point, but once you start delving into advanced coding, you’ll find that graphs can become far too complex to express an idea that through C# can be expressed in just a few lines of code.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms