Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*****************************************************
- // Author: The Messy Coder
- // Date: January 2022
- // For this video review: https://youtu.be/d8Oe1ydME7E
- // Please support by following on Twitch & social media
- // Twitch: www.Twitch.tv/TheMessyCoder
- // YouTube: www.YouTube.com/TheMessyCoder
- // Facebook: www.Facebook.com/TheMessyCoder
- // Twitter: www.Twitter.com/TheMessyCoder
- *****************************************************/
- using UnityEngine;
- namespace Messy
- {
- public class PlayAnimation : MonoBehaviour
- {
- [SerializeField]
- private bool m_PlayAnimOnce = true;
- [SerializeField] private Animation m_Anim;
- bool hasPlayed = false;
- [SerializeField] private string m_AnimClip;
- public void Play()
- {
- if (m_PlayAnimOnce == true && hasPlayed == false || m_PlayAnimOnce == false)
- {
- m_Anim.Play(m_AnimClip);
- hasPlayed = true;
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment