Skip to content

Instantly share code, notes, and snippets.

@rondinellimorais
Created January 18, 2021 20:06
Show Gist options
  • Save rondinellimorais/7268adb2a019290d283471274eae3e8f to your computer and use it in GitHub Desktop.
Save rondinellimorais/7268adb2a019290d283471274eae3e8f to your computer and use it in GitHub Desktop.
change_material.cs
public void ToggleImage(Renderer renderer, string base64String)
{
Texture2D texture2D = new Texture2D(1, 1);
byte[] bytes = Convert.FromBase64String(base64String);
texture2D.LoadImage(bytes);
texture2D.Apply();
renderer.material.mainTexture = texture2D;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment