Skip to content

Instantly share code, notes, and snippets.


PJ Legendre snarlynarwhal

View GitHub Profile
snarlynarwhal / SpriteAlphaFlicker.cs
Last active Sep 11, 2020
Makes the sprite alpha flicker.
View SpriteAlphaFlicker.cs
using UnityEngine;
public class SpriteAlphaFlicker : MonoBehaviour
public float flickersPerSecond = 15f;
public float flickerRangeMin = -0.1f;
public float flickerRangeMax = 0.1f;
private SpriteRenderer spriteRenderer;
private float alpha;
View FollowMouse.cs
using UnityEngine;
public class FollowMouse : MonoBehaviour
public float positionZ = 0;
private void Update()
Vector3 mouseWorldPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
mouseWorldPosition.z = positionZ;