Beispiel #1
0
            private void OnEnable()
            {
                string productID = this.GetType().ToString().Replace(@"Editor", string.Empty);

                displayAdvancedSettingsKey = string.Format("{0}.displayAdvancedSettings", productID);
                displayColorKey            = string.Format("{0}.displayColor", productID);

                displayAdvancedSettings = EditorPrefs.GetInt(displayAdvancedSettingsKey, 0) == 1;
                displayColor            = EditorPrefs.GetInt(displayColorKey, 1) == 1;

                baseTarget = this.target as OilPaint;
            }
Beispiel #2
0
    private void OnEnable()
    {
        Camera[] cameras        = GameObject.FindObjectsOfType <Camera>();
        Camera   selectedCamera = null;

        for (int i = 0; i < cameras.Length; ++i)
        {
            if (cameras[i].enabled == true)
            {
                selectedCamera = cameras[i];

                break;
            }
        }

        if (selectedCamera != null)
        {
            oilPaint = selectedCamera.gameObject.GetComponent <OilPaint>();
            if (oilPaint == null)
            {
                oilPaint = selectedCamera.gameObject.AddComponent <OilPaint>();
            }

            if (enableCompare == true)
            {
                Shader.EnableKeyword(@"OILPAINT_DEMO");
            }
            else
            {
                Shader.DisableKeyword(@"OILPAINT_DEMO");
            }
        }
        else
        {
            Debug.LogWarning(@"No camera found.");
        }

        this.enabled = oilPaint != null;
    }