Hi there…
is there a way to control where imported packages place themself? As it is by default, the package place itself in the same place as it was original eksported from. Meaning, if I have a project where I want to be able to import the same package multiple times into different locations in the same project, I can’t. Or can I?
Is there a way to get it to import directly at the folder where I say “import” Like when I import assets, they place themself in the folder I have selected…
Possibly you could use AssetDatabase.ImportAsset and AssetDatabase.MoveAsset in an editor script to automate the job. I don’t know if ImportAsset will correctly import packages though.
If not, then you could use AssetDatabase.CopyAsset to copy around already imported package content. Though why would you want duplicate assets in the first place?
We have been forced to, because of Unity’s way of working with projects, keep all our different projects within the same main Unity project.
I have several times asked in this forum for an alternative, but it seems that is the best way to do it.
That is because we have this libary of objects, which we need to include into several different projects, without loosing the connection to the original. And as Unity just do copies, whenever you import something, and can’t handle references, we are forced to do it all in one Unity project.
But… Materials…
Those we need to be unique per project. We can’t be sure a specific material works within every light setup, and we need to be able to be tweak those per project.
Otherwise if I tweak a given objects material, I might mess up the same objects appearance in another project.
So, our material collection (not textures, materials) needs to be imported as a package, everytime we do a new project (within out master Unity Project…)
And our material collection has been exsported as a unity package, to be imported everytime we make a new project, so we have a fresh collection of our materials, which can be tweaked without destroying other projects. But when we import the package into, say, a new folder in our main Unity Project (in a sub folder called i.e: Project 1243), it will not place the materials in that folder.
That is a problem.
It will create a new folder structure within the Unity Project at the same directory from where it was originally exported…
Is there a way around this?
I’m sorry for the long post, but you need to know the usage, of course, to be helpful.
I will look into the solutions you mention, but as I’m not really the scripting guy in this project (or the technical guy), I need to talk with some other persons, to know if this solves anything:)
Thanks anyways… (Tusinde Tak!!!)
Something more to take to your tech guys then: I haven’t used the AssetPostProcessor, but it might turn out to be useful for this purpose as well.
That class definitely looks interesting…!
But on the other hand, maybe I’m over complicating this.
I just tried copying an entire folder structure with all our textures from our server, directly into the project without ever touching “import asset”, and they imported nicely when I activated the project afterwards.
So…maybe all this should just be done outside of Unity, as an externally process? I mean, the materials are present as .mat files (right?) and I could just copy them around as I wish, without ever touching the import functions in Unity? Or does this mess up Unity’s understanding of what is present in the project?
So, when I add a new project folder within our main Unity project, I could just copy all materials (.mat, not textures!) from our material libary, and place them the right place in this new project, without ever opening Unity? Is this ok?
I would expect that would work just fine. One problem you might find is texture references from the materials going wrong, but since you’re inside the same project, it might just work.
I will test it first thing in the morning. I’m at home right now at my lovely PC, so have no chance of checking if it works.
Thx for the suggestions…