Ive created a tall clump of grass which shifts like someone disturbed it. what I want is to have it in idle mode then trigger it to animate when someone triggers its collider. I set this up as a prefab and it works when i put together a bunch of prefabs yet i want to put this prefab into a rule tile to use it in a tile palette. So far ive gotten to the point of absolutely nothing working so thats to say im at square 0 on this one.
the collider2D is on the prefab as well as the script which tells the controller to trigger the animation.
When i add a tilecollider to the grid i can see the collider2d on the prefabs but they dont do anything
my script
public class movegrass : MonoBehaviour
{
private Animator myAnim;
private void Start()
{
myAnim = gameObject.GetComponent<Animator>();
}
void OnTriggerEnter2D(Collider2D collision)
{
if (collision.name == "Player")
{
myAnim.SetTrigger("Grass");
}
}
}