## XSIApplication.UnloadPlugin

### Description

Unloads a self-installable plug-in from Softimage. All registered plug-in items are unregistered when a plug-in is unloaded; therefore you will not be able to use these items in Softimage until you reload the plug-in.
Unloaded plug-ins are still part of the XSIApplication.Plugins collection. They can be distinguished from other plug-ins by using the Plugin.Loaded property. An unloaded plug-in always has zero entries in its Plugin.Items collection.

### C# Syntax

    XSIApplication.UnloadPlugin( String in_pluginFileName, Boolean in_bRemove );

### Scripting Syntax

    XSIApplication.UnloadPlugin( Plugin, bRemove );

### Parameters

Parameter | Type | Description
--- | --- | ---
Plugin | String | The plug-in file name which includes the full path.
bRemove | Boolean | Option to completely remove the plug-in file from the list of plug-ins that Softimage maintains. This option does not remove the actual plug-in file from the disk, so the plug-in file may be reloaded the next time that Softimage is restarted.

### Examples

#### JScript Example

    //--------------------------------------------------------------------
    //      This example shows how to define and load a plug-in in Softimage
    //
    // README: Copy and paste the example into the script editor
    // and run (F5).
    //--------------------------------------------------------------------
    function ExUnLoadPluginDemo()
    {
            // lookup installed plugin
            var oPlugin = Application.Plugins( "XSIApplication.UnLoadPlugin Example" );
            // manually unload plugin
            Application.UnloadPlugin( oPlugin.FileName );
            // The above script logs the following results:
            //INFO : XSIUnloadPlugin called"
            //INFO :        Name: XSIApplication.UnLoadPlugin Example"
            //INFO :        Author: Softimage Co.
            //INFO :        Major: 1
            //INFO :        Minor: 0
            //INFO :        Language: JScript
            //INFO :        Filename: [userpath]\Addons\XSISDKDocExamples\Application\Plugins\ExXSIApplicationUnLoadPlugin.js
            //INFO :        URL: www.softimage.com
            //INFO :        Email: xsi@softimage.com
            //INFO :        Help:
            //INFO :        OriginPath: [userpath]\Addons\XSISDKDocExamples\Application\Plugins\
            //INFO :        Categories: Doc Example
            //INFO : Loaded: True
    }
    function  XSILoadPlugin( in_reg )
    {
            in_reg.Name = "XSIApplication.UnLoadPlugin Example";
            in_reg.Author = "Softimage Co.";
            in_reg.Major = 1;
            in_reg.Minor = 0;
            in_reg.URL = "www.softimage.com";
            in_reg.Email = "xsi@softimage.com";
            in_reg.Categories = "Doc Example";
            return true;
    }
    function  XSIUnloadPlugin( in_reg )
    {
            Application.LogMessage( "XSIUnloadPlugin called" );
            Application.LogMessage( "\tName: " + in_reg.Name );
            Application.LogMessage( "\tAuthor: " + in_reg.Author);
            Application.LogMessage( "\tMajor: " + in_reg.Major);
            Application.LogMessage( "\tMinor: " + in_reg.Minor);
            Application.LogMessage( "\tLanguage: " + in_reg.Language);
            Application.LogMessage( "\tURL: " + in_reg.URL);
            Application.LogMessage( "\tEmail: " + in_reg.Email);
            Application.LogMessage( "\tHelp: " + in_reg.Help);
            Application.LogMessage( "\tOriginPath: " + in_reg.OriginPath);
            Application.LogMessage( "\tCategories: " + in_reg.Categories);
    }
    //--------------------------------------------------------------------
    // Code to bootstrap example into system
    //--------------------------------------------------------------------
    function ExampleSourceCode()
    {
            return "// XSISDK Doc Example\n" +
                    XSIUnloadPlugin.toString() + "\n" +
                    XSILoadPlugin.toString();
    }
    // if we are running from script editor save code to
    // examples addon folder in the user's directory.
    if (GetUserPref("ScriptingSessionActive"))
    {
            var ex_name             = "ExXSIApplicationUnLoadPlugin";
            var ex_subfolder        = "Plugins";
            var ex_folder           = "XSISDKDocExamples";
            var ex_langsuffix       = ".js";
            CreateAddonDirectories( InstallationPath(siUserPath), ex_folder );
            var fso = XSIFactory.CreateActiveXObject("Scripting.FileSystemObject");
            var filename = XSIUtils.BuildPath(
                    InstallationPath(siUserAddonPath),
                    ex_folder,
                    "Application",
                    ex_subfolder,
                    ex_name+ex_langsuffix );
            if (!fso.FileExists(filename))
            {
                    var f = fso.CreateTextFile ( filename );
                    f.write( ExampleSourceCode() );
                    f.close();
                    Application.LoadPlugin(filename);
            }
            ExUnLoadPluginDemo();
    }

### See Also

XSIApplication.LoadPlugin XSIApplication.Plugins Plugin Plugin.Loaded