Question by
Nicseloli · Oct 09, 2020 at 08:19 PM ·
collisioncollision detectioncollision2denableenable and disable script
collision not working after enabling it twice
In a top down shooter i have enemies which randomly spawn. When they spawn they perform a spawn animation. I deactivate the collision in start so u cant get killed unfairly. Void EnemyGo gets activated through an animation event after the animation. My problem is that the collision wont work then. my code:
public class EnemyMovement : MonoBehaviour
{
public Collider2D m_Collider2D;
void Start
{
m_Collider2D = GetComponent<CircleCollider2D>();
m_Collider2D.enabled = false;
}
void EnemyGo()
{
m_Collider2D.enabled = true;
}
}
I do the same thing with the rigidbody2d and iskinematic and it works there.
Comment
Your answer
Follow this Question
Related Questions
Collision not working 1 Answer
C# - My increament code is not working? 1 Answer
2D collision not working 0 Answers
How to check if any/multiple 2D sprites neighbour/collide with eachother 0 Answers
Collisions not working in top-down RPG? 0 Answers