maxhacker11

Fader.cs

Dec 11th, 2023
432
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.33 KB | Source Code | 0 0
  1. using UnityEngine;
  2. using DG.Tweening;
  3.  
  4. public class Fader : MonoBehaviour
  5. {
  6.     public SpriteRenderer spriteRenderer;
  7.     public float fadeDuration = .5f;
  8.  
  9.     public void Fade(bool fadeDirection)
  10.     {
  11.         float targetAlpha = fadeDirection ? 1f : 0f;
  12.         spriteRenderer.DOFade(targetAlpha, fadeDuration);
  13.     }
  14. }
  15.  
Tags: fader
Advertisement
Add Comment
Please, Sign In to add comment