Question by
simplicitydown · Jan 04, 2016 at 08:38 PM ·
c#triggering animation box collider
A bug on simple script for triggering object movement using animation
I remember using this script a year ago to accomplish this, but now it won’t quite work. The platform just starts moving when the game starts instead of waiting for the player to enter the trigger. Would be a useful script for anyone if it could work:
public Animator leAnimator;
void OnTriggerEnter2D(Collider2D col)
{
if(col.tag == “Player”)
{
Debug.Log (“derp”);
leAnimator.SetTrigger(“Start”);
}
}
Thanks!!
Comment
Answer by simplicitydown · Jan 05, 2016 at 12:24 AM
Figured it out:
GameObject playerReference = GameObject.Find("Player");
void Update(){
if (GameObject.Find("pushBlockCollider").GetComponent<pushBlockCollider>().inPushBlock){
Debug.Log ("got to pushblockCollider True");
}
Your answer
Follow this Question
Related Questions
OnTriggerEnter and Exit using Position Markers? help?? 1 Answer
I want to freeze fp player , animation then starts , then unfreeze the character . 0 Answers
UI button that displays on top of a clickable 2D Box Collider in the scene won't work 0 Answers
Vector2.Dot not returning 0 2 Answers
Is there a way to make a script activate when you look at an object? 1 Answer