#that problem
1 messages · Page 1 of 1 (latest)
To make a animation stop playing you have to uncheck "loop" on the file
which file
also slow internet so the video is taking time
maybe slow discord
the-animation.anim
wait so if i have like over 20 animations i have to do it for every single one?
wait no you are getting it wrong
thats not my problem
its a run animation ofc i want it looped
just wait for the vid see what the problem is
Alrighty. Show the code then?
In the animation controller you should have a start and end
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerController : MonoBehaviour
{
private Rigidbody2D rb2D;
// player movement stuff
private float MoveSpeed;
private float JumpForce;
private bool IsJumping;
private float MoveHorizontal;
private float MoveVertical;
// player animation stuff with code hehehe
private Animator animator;
// Start is called before the first frame update
void Start()
{
rb2D = gameObject.GetComponent<Rigidbody2D>();
animator = gameObject.GetComponent<Animator>();
MoveSpeed = 3f;
JumpForce = 60f;
IsJumping = false;
}
// Update is called once per frame
void Update()
{
MoveHorizontal = Input.GetAxisRaw("Horizontal");
MoveVertical = Input.GetAxisRaw("Vertical");
}
void FixedUpdate()
{
if (MoveHorizontal > 0.1f || MoveHorizontal < -0.1f)
{
rb2D.AddForce(new Vector2(MoveHorizontal * MoveSpeed, 0f), ForceMode2D.Impulse);
animator.SetFloat("PlayerSpeed", 1);
}
if (!IsJumping && MoveVertical > 0.1f)
{
rb2D.AddForce(new Vector2(0f, MoveVertical * JumpForce), ForceMode2D.Impulse);
}
}
void OnTriggerEnter2D(Collider2D col)
{
if (col.gameObject.tag == "Platform")
{
IsJumping = false;
}
}
void OnTriggerExit2D(Collider2D col)
{
if (col.gameObject.tag == "Platform")
{
IsJumping = true;
}
}
private bool IsAnimationPlaying(Animator animator, string stateName)
{
if (animator.GetCurrentAnimatorStateInfo(0).IsName(stateName) &&
animator.GetCurrentAnimatorStateInfo(0).normalizedTime < 1.0f)
{
return true;
}
else
{
return false;
}
}
}
not much happening
the video should be sent now
It seems you made the animation play but never chose the idle animation again
how_to_do_dis.exe
but
wait
@cobalt tundra im not choosing any other animation, i am just adding up a number with my code for the animation to play in the animator controller thingy
There should be two animations, idle, and walk, even if idle is just standing still
your controller is fine
yes there are two
i know the problem is that it does not go back to 0 after i make it 1
i turn the animation into the run animation but i dont know how to revert it
Did you add conditions to the controller nodes?
i added conditions in the transitions
one sec ill grab a article online thatll show it
hm thanks
i will look into that
havent tried it but it seems like it should work
it is doing exactly what im missing
the direction thing
ill keep you updated
Yea np!
thanks for the help till now
What you miss is you enable your walk but you never tell it to go back to idle, or dont have a fallback
yea i didnt really do that
im guessing the jump is just an any state one?
i have a ground check
so
when im in the air i will jump
and when im not it will stop
right?
something like that
The jump is not looped, it should only play once anyways
ah okay
but a small question
what does this mean
UnityEngine.Debug:LogError (object)
Unity.Services.Analytics.AnalyticsServiceInstance:.ctor () (at Library/PackageCache/com.unity.services.analytics@4.2.0/Runtime/AnalyticsServiceInstance.cs:55)
Unity.Services.Analytics.AnalyticsService:.cctor () (at Library/PackageCache/com.unity.services.analytics@4.2.0/Runtime/AnalyticsService.cs:7)
UnityEngine.GameObject:AddComponent<Unity.Services.Analytics.AnalyticsLifetime> ()
Unity.Services.Analytics.ContainerObject:Initialize () (at Library/PackageCache/com.unity.services.analytics@4.2.0/Runtime/Runtime/AnalyticsLifetime.cs:88)
its this
what is the could project
That is not important unless you are using cloud services for ADS, IAP, Analytics etc. If you are then your project is not linked with unitys dashboard
cloud
well i am not
and its kinda annoying, can i turn it off?
?
I showed pic, it might be in those settings
i dont even have those things thats the thing
Neither did I lol, I think its auto installed
no i mean my menu is different
lol
aaaa found it
@cobalt tundrahi there, so i tried the link you sent me
now the animation works it moves when i move and stops when i do stop
but
it does not turn
the blog says "you should place this code where you determine the direction of the player."
but i dont do that
does it mean this part?
I dont. You could make a second animation facing the other way
wha
read what i said
it does use a direction thing
idk how i have to use it cuz i dont use a direction in my movement
Dont use that code if you dont use direction