I’ve been trying to get into Unity 3d but it seem it’s harder to teach yourself how to play a guitar.
I’ve been watching countless tutorial and example video still can’t get well with the Unity 3d tools and the scripting.
Let get to the point. So I want to make an object move and the the code I usually see is:
float S = Input.GetAxis ("Horizontal");
but I always has my own style and I use something like this:
if(Input == w)
objec.moveUp // Sorry I forgot all the API code because I haven't use it for 1 month but I'm sure you understand my point.
Is it has conflict with performance or is it the same thing?
I just can’t learn Unity 3D well. I teach myself C# and solving a lot of hard problem and I can say that it’s still easier to get into compare to Unity 3D.
Sorry for my English. I’ve been inactive in using Unity 3D for almost 1-2 month and I forgot everything.
I want to build a habit that I can do it well instead of remember everything I’ve seen.
Your code doesn’t take analog joysticks into account. There’s no way to move a little bit up, you’re either moving full-speed or not moving at all. Even non-analog controllers get a little tweening from Unity, IIRC.
I can tweak that. I hope you get my point. It wasn’t the code but what I mean is are the other alternative code work the same? Or only Input.GetAxis (); will be need in all case scenario?
I know that it’s not going to work because I’m writing an Algorithm instead of a workable code!
If you get the point then you will be able to understand what I wanted to ask.
Maybe this thread can get me back to learn Unity 3D again. I’m not smart but at least I’m a try hard person.
An algorithm is workable code. The definition is literally a “process or set of rules to be followed in calculations or other problem-solving operations, especially by a computer”. If your code isn’t working, it means your algorithm isn’t working.
There is no point if you are trying to compare different functions which can be the same in the end and sometimes not. In some cases it does not matter, in some cases the other one can be slower. It all depends what you are actually doing.
It’s just a shame you’re focusing so hard on the points that don’t actually matter. Don’t worry about optimizing your code before you’ve even written any. Go build your game and then go back and determine what you need to improve. Chances are it won’t be the portions you actually think are slow.
If that so then I will continue doing thing my own way.
How do you know that the thing you’re doing is right or wrong? What is you trying to experiment thing and you don’t know what you doing it right or wrong?
If the question is if is a performance issue or problem if break things up into steps or combine them, then no, it isn’t a significant issue. You are fine breaking them into separate lines if you prefer and it is easier to read for you.
Sometime it just piss me off that I always do thing differently from other people. I remember quiting learning guitar for 2 week because I can’t do the barre chord. I just try and try to get pass that and thing become easier.