public override void OnInspectorGUI()
    {
        m_object.Update();
        DrawDefaultInspector();

        _2dxFX_NewTeleportation2 _2dxScript = (_2dxFX_NewTeleportation2)target;

        Texture2D icon = Resources.Load("2dxfxinspector-hdr") as Texture2D;

        if (icon)
        {
            Rect  r;
            float ih     = icon.height;
            float iw     = icon.width;
            float result = ih / iw;
            float w      = Screen.width;
            result = result * w;
            r      = GUILayoutUtility.GetRect(ih, result);
            EditorGUI.DrawTextureTransparent(r, icon);
        }

        EditorGUILayout.PropertyField(m_object.FindProperty("ForceMaterial"), new GUIContent("Shared Material", "Use a unique material, reduce drastically the use of draw call"));

        if (_2dxScript.ForceMaterial == null)
        {
            _2dxScript.ActiveChange = true;
        }
        else
        {
            if (GUILayout.Button("Remove Shared Material"))
            {
                _2dxScript.ForceMaterial = null;
                _2dxScript.ShaderChange  = 1;
                _2dxScript.ActiveChange  = true;
                _2dxScript.CallUpdate();
            }

            EditorGUILayout.PropertyField(m_object.FindProperty("ActiveChange"), new GUIContent("Change Material Property", "Change The Material Property"));
        }

        if (_2dxScript.ActiveChange)
        {
            EditorGUILayout.BeginVertical("Box");



            Texture2D icone = Resources.Load("2dxfx-icon-fade") as Texture2D;
            EditorGUILayout.PropertyField(m_object.FindProperty("_Fade"), new GUIContent("Fade of the FX", icone, "Change the Fade of the FX"));
            icone = Resources.Load("2dxfx-icon-color") as Texture2D;
            EditorGUILayout.PropertyField(m_object.FindProperty("TeleportationColor"), new GUIContent("Teleportation Color", icone, "Color"));

            icone = Resources.Load("2dxfx-icon-fade") as Texture2D;
            EditorGUILayout.PropertyField(m_object.FindProperty("_Distortion"), new GUIContent("Distortion Value", icone, ""));

            icone = Resources.Load("2dxfx-icon-fade") as Texture2D;
            EditorGUILayout.PropertyField(m_object.FindProperty("_HDR_Intensity"), new GUIContent("HDR Value", icone, ""));



            EditorGUILayout.BeginVertical("Box");


            icone = Resources.Load("2dxfx-icon-fade") as Texture2D;
            EditorGUILayout.PropertyField(m_object.FindProperty("_Alpha"), new GUIContent("Fading", icone, "Fade from nothing to showing"));

            EditorGUILayout.EndVertical();
            EditorGUILayout.EndVertical();
        }

        m_object.ApplyModifiedProperties();
    }
Example #2
0
 // Start is called before the first frame update
 void Start()
 {
     _2dfx    = GetComponent <_2dxFX_NewTeleportation2>();
     _shinyFX = GetComponent <_2dxFX_Shiny_Reflect>();
 }
 // Use this for initialization
 void Start()
 {
     script = GetComponent <_2dxFX_NewTeleportation2>();
     source = GetComponent <AudioSource>();
 }