Комментарии:
Greetings. I have a problem, I did everything according to the instructions, but it still gives me an error in the State script, with line 26 to 30 with actions, as if the script does not see the playerInput reference. I would be very happy if you could direct me or advise me. :D
Ответитьquestion: how to u exit crouching state?
ОтветитьMine is stuck in idle as well. No inputs working. Here's everything:
I changed the Start to Awake in Character script (as per suggestion in another comment below), that took away two errors (null handle input) but left me with:
ArgumentException: GetComponent requires that the requested component 'PlayerInput' derives from MonoBehaviour or Component or is an interface.
UnityEngine.Component.GetComponent[T] () (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/Component.bindings.cs:42)
Character.Awake () (at Assets/StateMachine/Character.cs:55)
My line 55 in Character script is
playerInput = GetComponent<PlayerInput>();
I don't get it, since the Character script (which this tutorial makes a Class and attaches to Player) IS monobehaviour. And the PlayerInput is autogenerated when you click the Action Map C# generate button, so that can't be changed--and I'm pretty sure that is an interface or Component.I made sure "Sprint" has press and release in its binding as well.
The ONLY thing I can think is I have another script for a keyboard action (press 1, this thing appears, press 1 again it disappears) using PlayerInput Action Map as well. Since there's no movement of the Player, or change to his movement state (other than clicking the object or pressing 1, which I don't think counts) I don't think that script should go in the FSM, or interfere with it? It has these lines:
PlayerInput Input;
(and then in Awake it has...)
Input = new PlayerInput();
Are those two combatting each other for PlayerInput() or something?
The other thing I ran into was it didn't recognize the word 'actions' in the State script lines like moveAction = character.playerInput.actions["Move"];
so I had to change those to moveAction = character.playerInput.Player.Move; Which got rid of the error but didn't help him actually move. Either way, I don't think this should cause the Argument Exception error above.
It's like none of the FSM/Character scripts are getting called from the Action Map (Player) actions which should start their respective movement from the animation tree (pretty sure I matched your tree exactly)? This is my fourth different tutorial series for character movement and I have gotten that "actions" error on all of them. Changing actions["Move"] to Player.Move has worked on the others. Sidenote: I got one state machine working from a tutorial (the Jump like Super Mario one), but it was doing a jump that was 3 different velocities depending on the jump (in a sub state machine in animator) and I just didn't like the way it was looking or feeling for my game. It called actions from context using the .ctx code.
Any thoughts, ideas, or help greatly appreciated!
Hi, thanks for the tutorial it is really great, I jst can't make function the sprint juming, the animation plays but it stays on the same position, and I can't figure out what is wrong with, can you help please?
ОтветитьCan anyone help? Everything is working correctly, scripts rechecked. But the character plays only Idle. If you manually move the slider in Locomotion Blend Tree, everything works.
ОтветитьBro my character is sliding on the map what could I do wrong?
Ответить5;06
ОтветитьPra quem esta com erro no crouch é só criar uma Layer chamada Player na camada 8 e colocar ela no player, e la no script do CrouchingState voce pode usar int layerMask = 1 << 8;
Mas se preferir pode usar int layerMask = 1 << LayerMask.NameToLayer("Player"); //se usar essa comente a linha de cima e crie uma Layer Player onde desejar
can you give me the project?
ОтветитьWhat do I do for the look input in the input system?
ОтветитьCan you send the source code of this project ??
ОтветитьI'm new to game developement with Unity so I don't know much about it. But it appears that I don't know where I should place the rigidbody for the character.. and I don't know how to set up the animations like that, I just can't get it to work. Hopefully someone can help with that. I would really appriciate that.
ОтветитьI don't know what I missed but when I press Start play in Unity, doesnt work and show me a message that is not working on the Console. The message is about something going wrong with Update() and the FixedUpdate() in the Character script.
If someone know what I do wrong, it would helps a lot.
hello ı am amateur so it can be dumb question but ı want to ask we use to much update in this video and ı want make a big project. is this way comvinient for me or ı need to change anythink. thanks for great tutorial.
Ответитьplease help me i am stuck and need this badly for my school project due in 4 weeks :( i follow the steps rewatched the video several times but when i run it he character stay in Idle state and even when i pressed the keys nothing happens
Ответитьi did everything the same but still character stay in idle state and when key is pressed nothing happen
can you help ??
I got many issues with the code, for example, my animator dosent work, and it dosent allow me to use it as a avator do you have anyway how we could fix it
ОтветитьHello! I can't get out of crouch and i get this error 'State' does not contain a definition for 'toString' and no accessible extension method 'toString' accepting a first argument of type 'State' could be found
ОтветитьGreat vid!, i just got one issue, when i press jump while my character is sprinting it gets stuck(it looks like isn´t getting any speed value); i already watched the video a couple of times, but i cant find out whats wrong, any ideas?
ОтветитьHow do you make started, performed and cancelled phases work with state machines?
Ответить