// if want to hide project and folder path for screenshot
//p.Title = "Example Project ";
//p.Path = "C:/Projects/ExamplePath/MyProj";
if(p!=null)
{
projectsFound.Add(p);
// add found projects to history also (gets added only if its not already there)
Tools.AddProjectToHistory(p.Path);
}
}// valid key
}// each key
}// for each registry root
// NOTE those 40 projects should be added to custom list, otherwise they will disappear (since last item is not yet added to our list, until its launched once, so need to launch many projects, to start collecting history..)
// but then we would have to loop here again..? or add in the loop above..if doesnt exists on list, and the remove extra items from the end
// scan info for custom folders (if not already on the list)
if(AllProjectPaths!=null)
{
// iterate custom full projects history
foreach(varprojectPathinAllProjectPaths)
{
// check if registry list contains this path already, then skip it
boolfound=false;
for(inti=0,len=projectsFound.Count;i<len;i++)
{
if(projectsFound[i].Path==projectPath)
{
found=true;
break;
}
}
// if not found from registry, add to recent projects list
// sometimes projects are in wrong order, seems to be related to messing up your unity registry, the keys are received in created order (so if you had removed/modified them manually, it might return wrong order instead of 0 - 40)
// sort by modified date, projects without modified date are put to last, NOTE: this would remove projects without modified date (if they become last items, before trimming list on next step)
projectsFound.Sort((x,y)=>
{
if(x.Modified==null&&y.Modified==null)return0;// cannot be -1, https://stackoverflow.com/a/42821992/5452781
//return x.Modified.Value.CompareTo(y.Modified.Value); // BUG this breaks something, so that last item platform is wrong (for project that is missing from disk) ?
});
// trim list to max amount (older ones are dropped)