privatevoid Start() { // Add/Create a noise modifier to this object right after start noise = gameObject.AddComponent<MDM_MeshNoise>(); // Update current modifier every frame noise.updateEveryFrame = true; // Otherwise it can be updated manually by calling... // noise.MDModifier_ProcessModifier(); }
privatevoid Update() { // Sample noise noise.noiseIntensity = Mathf.Sin(Time.time * 2.0f) * 0.75f; // Sample extension - if space is pressed, increase the vertex count if possible if (Input.GetKeyDown(KeyCode.Space)) noise.MDModifier_SubdivideMesh(); // Sample extension - if R is pressed, restore mesh to its original state if (Input.GetKeyDown(KeyCode.R)) noise.MDModifier_RestoreMesh(); } }