Not sure where to post: What about re-importing the toolkit?
First, I don't know where is a good place to connect w/ the MR devs from MS and the ones at Unity, to ask general questions about toolkit usage. Is GitHub the place? seems awkward.
Second - suppose I have a project, and I've exported the toolkit as a .package prior, and have imported that package into my project. Now, I pull down some toolkit updates from GitHub. Do I re-export the MRToolkit to the .package? If I do that, what is the accepted procedure to re-import that package into my project? I can think of 2 reasonable choices: 1. Select the entire folder HoloToolkit in my project and right-click deleting it, then reimporting it. 2. Simply re-import it. and if I do that, what if there were files in the old toolkit which are not in the new toolkit? Will I have crusty puffs laying around in my Unity tree?
Third - When I import the MR Toolkit, I would have expected ALL the code to be within the HoloToolkit folder, but when I import it, some of the imported files go to different directories. I think this is because Unity tries to do some matching on something or other and it thinks the toolkit's classes are ones that are already in my project. Probably (not sure) that it's because I inherited this project and the previous devs tool the Toolkit's files and put them directly into the project instead of keeping them in the HoloToolkit directory. Can anybody confirm or deny?
(eric frazer) (yeah, I work at ms)
Hi Eric,
The way I do it is by avoiding the .package files, I copy/paste the latest version of the HoloToolkit folder from the repo (MixedRealityToolkit-Unity/Assets/HoloToolkit) into my Assets folder of my Unity project. To delete an old version, I close Unity, delete the old HTK folder and paste in the new one, re-open Unity and it works straight out the box because this method gets rid of the "crusty puffs" :)
-
Slack is a great place for quick little questions. But I think generally it's good to post here so questions are archived by search bots for future reference.
-
Sam (above) has written the good tried and true method I sometimes use for my projects as well, but if your git-fu is really impressive you can use the toolkit as a submodule. I like the later approach cause it's really simple to just pull the latest changes and can easily roll back if something breaks.
-
When you're reimporting an existing package, Unity matches up the classes by it's meta file. If you have devs that are moving or modifying third party packages, you might want to smack their hands and tell them to stop. It's generally recommended to either copy, and modify a class by using a custom name, or write it from scratch with the desired changes. In fact I extend many of the base classes with my own implementations of customization for each specific project, and have had a pretty easy time upgrading. Generally there's a few releases where things are deprecated for a while before getting out right removed.
MixedReality’s git repo has a BUNCH of stuff in it. I don’t know how to put just the toolkit’s assets into a git submodule. Is this possible? Could you type a few words about how to do this? I’m assuming Unity has to access the toolkit’s sources from within the Assets folder?
Thanks
It's possible, but right now it's a trade secret. Sorry.
Are you pulling my leg? I’m Microsoft (efrazer@microsoft). Come on, help me out! I’m trying to port this RoboRaid game to Unity 2017.2 and I’m having a hard time trying to figure out how to integrate the MR Toolkit because the original authors pulled in 1/4th of the original HoloToolkit and messed it all up…. I’m thinking I could put a “soft link” on my hard drive (an alias, in Unix terms), but that sounds really iffy.
You're on the right track. The method we do it is entirely our own.
Who is “we” ? Your company, Unity, Microsoft, GitHub, ???
Valorem
@erichfrazer Hi Erich. I had exactly your problem and made a tool to solve it. It basically clones the repo into a temp folder and then copies the HoloToolkit part (no examples) into your project directory.
I can't promise you that it works, because I coded it only quick & dirty, but you can try it out if you wish. If you wish, you can also create a pull request to enhance it.
https://github.com/eluchsinger/GitGet
I have what I think is the definitive answer: If you have a project that you already imported the MRTK into, by using the "suggested" method of exporting the MRTK to a package, then importing it, then first you have to cross your fingers and do this:
- First ensure you have no outstanding changes in Git. This is very important.
- In Unity, right click on the HoloToolkit and press Delete. Yup. This will leave the MRTK components in your scene, but they will be referencing components that are now deleted. They do this by meta file, so hopefully when you get the MRTK re-imported, the links will fix themselves. Make SURE your project is already using the MRTK you are about to re-"import". Don't be using an older version of the MRTK and try to do this!
- Now, save your scene and exit Unity.
- Go into Git and you'll see a bunch of HoloToolkit files removed from your Assets folder. Check in these changes to accept the now-removed files.
- Add the Assets/HoloToolkit (or equiv) to your .gitignore file. If you don't already have a .gitignore, obviously make one.
Now you are ready to make a hard link on your hard drive.
- Open up a cmd prompt w/ admin privs
- Cd to YourProject/Assets
- Type "mklink /J HoloToolkit D:\MRToolkit-Unity\Assets\HoloToolit" (this will make a junction on your hard drive. Your OS now thinks this is a real directory. So does Unity!)
- Re-open your project in Unity. It will re-import the assets and hopefully fix all your broken links.
- Your project should run now. Save out and go back into your Git program and look at the deltas. You should NOT have a bunch of changed files in your MRTK Git enlistment. If you do, something is wrong. Likewise, you should NOT have a bunch of changed files in YourProject/Assets/HoloToolkit, your Git enlistment shouldn't care about what is going into Assets/HoloToolkit any longer, from the .gitignore file!
I've done this procedure w/ 3 of my Unity projects, and now they're all referencing the same base HoloToolkit enlistment, and cooperating. it's quite astounding.
Yup, that's pretty much what I do, but I automated the whole process. There's a bit more to it than that but it's essentially the crux of it.
I do add this repo as a submodule though, instead of copying directly from the toolkit project itself.
Took to time to write this up for ya.
https://www.rageagainstthepixel.com/expert-import-mrtk/