diff options
| author | tylermurphy534 <tylermurphy534@gmail.com> | 2022-11-06 15:12:42 -0500 |
|---|---|---|
| committer | tylermurphy534 <tylermurphy534@gmail.com> | 2022-11-06 15:12:42 -0500 |
| commit | eb84bb298d2b95aec7b2ae12cbf25ac64f25379a (patch) | |
| tree | efd616a157df06ab661c6d56651853431ac6b08b /VRCSDK3Worlds/Assets/MeshBaker/Examples/SceneRuntimeExample/MB_Example.cs | |
| download | unityprojects-eb84bb298d2b95aec7b2ae12cbf25ac64f25379a.tar.gz unityprojects-eb84bb298d2b95aec7b2ae12cbf25ac64f25379a.tar.bz2 unityprojects-eb84bb298d2b95aec7b2ae12cbf25ac64f25379a.zip | |
move to self host
Diffstat (limited to 'VRCSDK3Worlds/Assets/MeshBaker/Examples/SceneRuntimeExample/MB_Example.cs')
| -rw-r--r-- | VRCSDK3Worlds/Assets/MeshBaker/Examples/SceneRuntimeExample/MB_Example.cs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/VRCSDK3Worlds/Assets/MeshBaker/Examples/SceneRuntimeExample/MB_Example.cs b/VRCSDK3Worlds/Assets/MeshBaker/Examples/SceneRuntimeExample/MB_Example.cs new file mode 100644 index 00000000..3c11b92d --- /dev/null +++ b/VRCSDK3Worlds/Assets/MeshBaker/Examples/SceneRuntimeExample/MB_Example.cs @@ -0,0 +1,31 @@ +using UnityEngine; +using System.Collections; + +public class MB_Example : MonoBehaviour { + + public MB3_MeshBaker meshbaker; + public GameObject[] objsToCombine; + + void Start(){ + //Add the objects to the combined mesh + //Must have previously baked textures for these in the editor + meshbaker.AddDeleteGameObjects(objsToCombine, null, true); + //apply the changes we made this can be slow. See documentation + meshbaker.Apply(); + } + + void LateUpdate(){ + //Apply changes after this and other scripts have made changes + //Only to vertecies, tangents and normals + //Only want to call this once per frame since it is slow + meshbaker.UpdateGameObjects(objsToCombine); + meshbaker.Apply(false,true,true,true,false,false,false,false,false); + } + + void OnGUI(){ + GUILayout.Label ("Dynamically updates the vertices, normals and tangents in combined mesh every frame.\n" + + "This is similar to dynamic batching. It is not recommended to do this every frame.\n" + + "Also consider baking the mesh renderer objects into a skinned mesh renderer\n" + + "The skinned mesh approach is faster for objects that need to move independently of each other every frame."); + } +} |