Two buttons for each Action

I am unsure as to how to even begin trying to debug exactly where the issue is but for each action; move and spin, two buttons are generated, as I click through units these buttons are destroyed and new ones made in new locations on the row but always two of each.

Let’s start by looking at the UnitActionSystemUI.cs. Can you post the code for that class?

Here it is, thanks for any potential help!

OK, this looks fine. What does selectedUnit.GetBaseActionArray() return. Are you getting 2 actions back, or 4? You can check by adding the following inside the foreach loop

Debug.Log($"Action: {baseAction.GetActionName()}");

and then just running the code without clicking (otherwise it will log that every tie and you won’t know where it started for each click)

It seems that it keeps grabbing the unit and regenerating the move action?? I scrolled through all the errors, and they are all the Unit unit and Move Action popping up over and over. So it would seem the spin action doesnt have an issue but either the unit itself or the move action does?

Any insight would be greatly appreciated.

What exactly did you log?

If you want, you could zip and upload your project somewhere and then I can take a look at it

I add the Log in this loop here, apologies if this isn’t the correct loop.
If that would be the most efficient way to troubleshoot, I don’t object to that. I haven’t ever zipped up a Unity Project, and where/how would you like to receive it.

This is correct but the console logs in your screenshot is not from this.

You can just zip the whole project, but exclude the library folder. I’ve shared a folder on my google drive. You can upload it here: gamedevtv - Google Drive - I will unshare it again after I’ve received your project

sorry I looked through the log and all the errors appeared to be the same, also I just shared the zip hopefully correctly. This is the only problem I’ve had during this course that I have been able to solve myself, so I really appreciate the help. Thanks a ton!

Ok, the problem is quite a simple one.

You have 2 Spin actions and 2 Move actions on your Units. Just remove the bottom 2

Thanks, not use to using a game engine I would have looked for hours at the code, as that’s where I’m use to terrors being, only to not find anything .

That was something when I first started working with Unity and Unreal that threw me early on. As a lifelong (we’re talking when Reagan was in office) coder, I’m so used to thinking about code and algorithms, that I would forget to think about how things come together in Unity itself.

Don’t worry, with practice, you’ll find yourself seeing Unity and C# as an integrated process.

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

Privacy & Terms