exBitmapFontEditor.Edit C# (CSharp) Method

Edit() public method

public Edit ( Object _obj ) : void
_obj Object
return void
    public void Edit( Object _obj )
    {
        // check if repaint
        if ( curEdit != _obj ) {

            // check if we have exBitmapFont in the same directory
            Object obj = _obj;
            if ( obj != null ) {
                string assetPath = AssetDatabase.GetAssetPath(obj);
                if ( string.IsNullOrEmpty(assetPath) == false ) {
                    string dirname = Path.GetDirectoryName(assetPath);
                    string filename = Path.GetFileNameWithoutExtension(assetPath);
                    obj = (exBitmapFont)AssetDatabase.LoadAssetAtPath( Path.Combine( dirname, filename ) + ".asset",
                                                                       typeof(exBitmapFont) );
                }
                if ( obj == null ) {
                    obj = _obj;
                }
            }

            // if this is another bitmapfont, swtich to it.
            if ( obj is exBitmapFont && obj != curEdit ) {
                curEdit = obj as exBitmapFont;
                Init();

                Repaint ();
                return;
            }
        }
    }

Usage Example

Beispiel #1
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        if (GUILayout.Button("Edit...", GUILayout.Width(50), GUILayout.Height(20)))
        {
            exBitmapFontEditor editor = exBitmapFontEditor.NewWindow();
            editor.Edit(target);
        }
        GUILayout.Space(5);
        GUILayout.EndHorizontal();
    }
All Usage Examples Of exBitmapFontEditor::Edit