Create Transparent Material at Runtime in Unity - Change Standard Mode with C# Script API

Channel:
Subscribers:
11,700
Published on ● Video Link: https://www.youtube.com/watch?v=ywIJ5YkW98s



Duration: 1:37
3,207 views
45


Unity create Material on the fly - https://gist.github.com/iwanPlays/04d399de55a98475d906103779ba9ff3
Incomplete:
Material mat = new Material(Shader.Find("Standard"));
mat.SetColor("_Color", new Color(1,0,0,.5f));
mat.SetFloat("_Mode", 3);
mat.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.SrcAlpha);
mat.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
mat.EnableKeyword("_ALPHABLEND_ON");
mat.renderQueue = 3000;
//mat.SetInt("_ZWrite", 0);
//mat.DisableKeyword("_ALPHATEST_ON");
//mat.DisableKeyword("_ALPHAPREMULTIPLY_ON");

transparent material at runtime in player, via c# script api https://answers.unity.com/questions/999594/change-material-rendering-mode-but-dont-update-mat.html




Other Videos By iwanMods


2020-08-07OBS - Fix Blurry Scaling (Nearest Neighbor/Point Filter Resize for Low Resolution / Pixel Art Games)
2020-08-05Unity/dnSpy Game Modding Tutorial (Receiver 2 Tritium Night Sights Mod)
2020-08-03How to Extract 3D Models, Textures, Music from Unreal Engine Games
2020-08-02Constant Rate Factor (CRF) 51 in x265 at 60fps 1080p FHD [Handbrake/ffmpeg]
2020-08-01How to ReShade Unreal Engine Games
2020-07-31ReShade Tutorial - Quick Shader Injector How-To
2020-07-05This is what happens if you mod a Golden Desert Eagle and a Yeet Canon G1 into a Pistol Simulator
2020-07-01How to Mod a Game to Enhance Usability | Removing Black Screen Flash in Receiver 2
2020-06-14dnSpy Game Modding Tutorial
2020-05-10How to Enable Visual Studio CODE Mouse Scroll Wheel Zoom (and GUI Zoom)
2020-05-10Create Transparent Material at Runtime in Unity - Change Standard Mode with C# Script API
2020-05-07How to Decompile .RPYC & Mod RenPy Games (Story/Dialogue/Text Modding)
2020-05-05How to Full Screen Web Games (HTML5 on Kongregate)
2020-05-03How to Extract Pictures and Music from TyranoBuilder Game Files (NW.js / node-webkit)
2020-05-02Receiver 2 Disco Lights Mod Tutorial
2020-05-01How to Play Custom Maps in Ravenfield
2020-04-23How to Download and Install/Uninstall DESKTOP MEADOW!
2020-04-21Unity Game Modding Beginner Tutorial
2020-04-20How to load GameObject Meshes Dynamically in Unity (Random Swap Them)
2020-04-20How to use Mutators (Mods with Ravenscript) in Ravenfield!
2020-04-18How to Limit FPS in Receiver 2 (dnspy Modding Tutorial)



Tags:
unity
coding
realtime
c#
api
material
transparent material