Example #1
0
        public void Initialize(string editorPath)
        {
            var assembly = EditorPluginInterop.EditorPluginAssembly;

            if (EditorPluginInterop.EditorPluginIsLoadedFromAssets(assembly))
            {
                Debug.LogError($"Please delete {assembly.Location}. Unity 2019.2+ loads it directly from Rider installation. To disable this, open Rider's settings, search and uncheck 'Automatically install and update Rider's Unity editor plugin'.");
                return;
            }

            // for debugging rider editor plugin
            if (RiderPathUtil.IsRiderDevEditor(editorPath))
            {
                LoadEditorPluginForDevEditor(editorPath);
            }
            else
            {
                var relPath = "../../plugins/rider-unity/EditorPlugin";
                if (SystemInfo.operatingSystemFamily == OperatingSystemFamily.MacOSX)
                {
                    relPath = "Contents/plugins/rider-unity/EditorPlugin";
                }
                var baseDir = Path.Combine(editorPath, relPath);
                var dllFile = new FileInfo(Path.Combine(baseDir, $"{EditorPluginInterop.EditorPluginAssemblyName}.dll"));

                if (!dllFile.Exists)
                {
                    dllFile = new FileInfo(Path.Combine(baseDir,
                                                        $"{EditorPluginInterop.EditorPluginAssemblyNameFallback}.dll"));
                }

                if (dllFile.Exists)
                {
                    var bytes = File.ReadAllBytes(dllFile.FullName);
                    assembly = AppDomain.CurrentDomain.Load(bytes); // doesn't lock assembly on disk
                    if (PluginSettings.SelectedLoggingLevel >= LoggingLevel.TRACE)
                    {
                        Debug.Log($"Rider EditorPlugin loaded from {dllFile.FullName}");
                    }

                    EditorPluginInterop.InitEntryPoint(assembly);
                }
                else
                {
                    Debug.Log($"Unable to find Rider EditorPlugin {dllFile.FullName} for Unity ");
                }
            }
        }
    public void Invalidate(string editorInstallationPath)
    {
      var riderBuildNumber = RiderPathLocator.GetBuildNumber(editorInstallationPath);
      editorBuildNumber = riderBuildNumber.ToSerializableVersion();
      productInfo = RiderPathLocator.GetBuildVersion(editorInstallationPath);
      if (riderBuildNumber == null)
        shouldLoadEditorPlugin = false;

      shouldLoadEditorPlugin = riderBuildNumber >= new Version("191.7141.156");

      if (RiderPathUtil.IsRiderDevEditor(editorInstallationPath))
      {
        shouldLoadEditorPlugin = true;
        editorBuildNumber = new SerializableVersion(new Version("999.999.999.999"));
      }
    }
Example #3
0
    public void Invalidate(string editorInstallationPath, bool shouldInvalidatePrevEditorBuildNumber = false)
    {
      var riderBuildNumber = RiderPathLocator.GetBuildNumber(editorInstallationPath);
      editorBuildNumber = riderBuildNumber.ToSerializableVersion();
      if (shouldInvalidatePrevEditorBuildNumber)
        prevEditorBuildNumber = editorBuildNumber;
      productInfo = RiderPathLocator.GetBuildVersion(editorInstallationPath);
      if (riderBuildNumber == null) // if we fail to parse for some reason
        shouldLoadEditorPlugin = true;

      shouldLoadEditorPlugin = riderBuildNumber >= new Version("191.7141.156");

      if (RiderPathUtil.IsRiderDevEditor(editorInstallationPath))
      {
        shouldLoadEditorPlugin = true;
        editorBuildNumber = new SerializableVersion(new Version("999.999.999.999"));
      }
    }