void OnGUI() { // Blob settings GUI.Box(new Rect(-5.0f, -5.0f, 245.0f, 105.0f + models.Length * 25.0f), ""); Settings.Distance = FloatField(new Rect(2.5f, 2.5f, 230, 20), "Shadow Distance", ref distanceText, Settings.Distance); foreach (RuntimeModel model in models) model.BlobCam.farClipPlane = Settings.Distance; Settings.Falloff = FloatField(new Rect(2.5f, 25.0f, 230, 20), "Falloff", ref falloffText, Settings.Falloff); Shader.SetGlobalFloat("_BlobFalloffExponent", Settings.Falloff); Settings.Strength = FloatField(new Rect(2.5f, 47.5f, 230, 20), "Strength", ref strengthText, Settings.Strength); Settings.BlurIterations = IntField(new Rect(2.5f, 70.0f, 230, 20), "Blur Iterations", ref blurItrText, Settings.BlurIterations); if (Settings.BlurIterations < 0 || 20 < Settings.BlurIterations) { Settings.BlurIterations = Mathf.Clamp(Settings.BlurIterations, 0, 20); blurItrText = Settings.BlurIterations.ToString(); } foreach (RuntimeModel model in models) { BlobBlur blobBlur = model.BlobCam.GetComponent<BlobBlur>(); blobBlur.BlurIterations = Settings.BlurIterations; blobBlur.Strength = Settings.Strength; } // Model switching for (uint i = 0; i < models.Length; ++i) { float y = 95f + i * 25.0f; Rect r = new Rect(2.5f, y, 230.0f, 22.5f); if (GUI.Button(r, models[i].name)) { currentModel.gameObject.SetActive(false); currentModel = models[i]; currentModel.gameObject.SetActive(true); } } }
void Start() { foreach (RuntimeModel model in models) { GameObject plane = CreatePlane(model.ModelBounds); plane.transform.position = new Vector3(0, model.ModelBounds.min.y - model.ModelBounds.size.y * 0.01f, 0); plane.transform.parent = model.transform; model.gameObject.SetActive(false); } currentModel = models[0]; currentModel.gameObject.SetActive(true); }