I want to start an animation (.fxb from C4D) with the press of a GUI button. I can get the button to work but not able to call the animation. I’ve tried a number of ways from different forum posts but can’t seem to get any to work, i’ve attached the latest below.
Thanks in advance.
using UnityEngine;
using System.Collections;
public class GUI_Button : MonoBehaviour
{
public Texture2D buttonImage = null;
public GameObject anim = null;
private void OnGUI()
{
if (UnityEngine.GUI.Button(new Rect(15, 15, 100, 50), buttonImage))
{
animation.Play("anim")
}
}
}