Skip to content

Commit

Permalink
fix: cannot install with 'upm' branch in Unity 2019.1
Browse files Browse the repository at this point in the history
  • Loading branch information
mob-sakai committed Jan 28, 2020
1 parent 6c3a3b6 commit eb8ff00
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ internal static PackageInfo ToPackageVersion(this AvailableVersion self, Package
newPInfo.IsVerified = false;
newPInfo.Origin = (PackageSource)99;
newPInfo.Info = baseInfo.Info;
newPInfo.PackageId = string.Format("{0}@{1}", newPInfo.Name, self.refName);
newPInfo.PackageId = string.Format("{0}@{1}", newPInfo.Name, self.refNameVersion);
return newPInfo;
}
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,16 @@ public void UpdateClick()
string refName = GetSelectedVersion().packageInfo.git.revision;
#else
string refName = GetSelectedVersion().VersionId.Split('@')[1];
var originRefName = refName;

// Find correct reference (branch or tag) name.
while(!AvailableVersions.GetVersions(selectedPackage.name, url).Any(x=>x.refName == refName))
{
var index = refName.IndexOf('-');
if(index < 0 || refName.Length < 1)
throw new Exception($"Cannot install '{packageId}'. The branch or tag is not found in repository.");
refName = refName.Substring(index+1);
}
#endif
PackageUtils.UninstallPackage(selectedPackage.name);
PackageUtils.InstallPackage(selectedPackage.name, url, refName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ void InitializeUI()
addButton.parent.Insert(addButton.parent.IndexOf(addButton), space);
#endif

internalBridge.UpdateAvailableVersionsForGitPackages();
EditorApplication.delayCall += Bridge.UpdateAvailableVersionsForGitPackages;
}
}
}
Expand Down

0 comments on commit eb8ff00

Please sign in to comment.