-
-
Save arknano/f7992178d25dc1f6e167b8ff1a9667a2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using PicaVoxel; | |
public class SetVolumeAlpha : MonoBehaviour { | |
public int alpha = 0; | |
//Sets the alpha on all voxels in the volume this script is placed on. | |
public void SetAlpha () { | |
var frame = GetComponent<Volume>().Frames[0]; | |
for (int i = 0; i < frame.Voxels.Length; i++) | |
{ | |
var c = frame.Voxels[i].Color; // get the current voxel colour | |
c.a = (byte)alpha ; // set the alpha | |
frame.Voxels[i].Color = c; // set the colour back | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment