Warning: The following contains strong language, because I was angry when I wrote it. But I checked the rules and they didn’t say anything about that. Just, please, don’t be pointlessly offended or anything. Come on.
So I’m just trying to make a platformer. A simple 2D platformer. But Unity doesn’t want me to.
OK so I create my animations (and I already have to do some weird shit so Unity allows me to create a 1-frame animation, and so I can make animations slower) and I connect them in Mecanim.
What is this? Am I supposed to define some, er, “parameters” here? Isn’t that what code is for?
Sigh, ok, I guess I need a boolean that says if I’m on ground, and an int for the speed. So I connect my states, just Stand, Walk, and Jump. Then I realize, I should probably use a float for the speed. Well shit, turns out, I can’t just change the int to a float, I have to remove it, add the float, and then connect everything again. I knew this graphical shit would bite me in the ass eventually, I just didn’t think it’d happen so early.
But, oh, wait, it’s not that simple. Turns out, I can’t check a float for equality, just if it’s higher or lower. Well crap. What the fuck am I supposed to do? I want my character to stand if its speed is 0. So I look that up and it seems I’m supposed to put something like “lower than 0.01 and higher than -0.01”, which is B.S., but ok, I’ll just try hard not to vomit as I’m doing it.
Now I want to add an additional animation for running. How do I do this? I decided I would download the sample 2D assets and see how they do it there. Aaaaand its horrible. It basically says, if the speed is higher than 0.1 then run, if it’s higher than 0.01 then walk, else idle. What the hell!? Am I really supposed to hardwire the walking and running speeds like that? What if I want to use this file for a character with a different speed? Can I not? Do I have to create a copy of the fucking thing and manually change each value? What am I a fucking farmer? And while we’re on the topic, what if I want the other character to have different animations? It really seems like I’m S.O.L. I’d have to duplicate everything as if I was a beginner that doesn’t know how to define a function.
But then comes the scripting. There seems not to be any way to automatically sync a variable with an animator property. I have to do it manually. So I think, shigh, ok, let’s try with properties.
private bool OnGround {
get { return animator.GetBool(“OnGround”); }
set { animator.SetBool(“OnGround”, value); }
}
Well good, but this is going to get old in about three seconds. Does C# support macros so I can automate this process…?
No, it doesn’t.
And what about the speed? It’s given by rigidbody.velocity.x (or something) so… basically it’s duplicated and redundant now. Great. Every time I change the velocity, I have to remember to update the Speed property too. Fucking great.
In the end I decided fuck it, I’ll remove the Speed and OnGround properties and just have a State that’s an int, then connect every state with “any state” and assign each one a different int value.
At that point I decided to write this and post it here. I did not just come here to rant, I’m also hoping that somebody will tell me that I’m doing everything wrong and explain the Right Way of doing things. So please, if you know what that is, go ahead.