Is it possible to create a unity3d package using files from outside my project? - unity3d

In most examples I see the paths to the files are relative ("Assets/Models/monster.fbx"), and this seems to work fine. But is it possible to have a file from outside my project included in a package? ("/Users/angrymonkey/Documents/dragon.fbx")
I'm doing this by code btw, not from the IDE. So I want to refer to files outside my current project from code.

Related

UnityEngine.UI outside of Unity Environment

I am trying to compile several scripts in my project into an easier to move and manage DLL file, however several scripts call UnityEngine.UI, and I know that the DLL file used to exist in /Contents/UnityExtensions/Unity/GUISystem/Editor/UnityEditor.UI.dll however the only data I can find for it now are the uncompiled files inside the Package Manager, where is the compiled DLL stored now?
The simplest answer that I just found is to look in the project folder of one of your projects in Library\ScriptAssemblies

Custom folder structure for Swift Package

When you generate a new Swift project with swift init, you get a Sources folder similar to this. Wondering if there is a way to change the folder structure so it is like this:
main.swift
lib
lib/something.swift
And just get rid of the Sources directory.
I believe that you can use any folder structure that you want. The only thing in that references specific folders in that particular link you provided was the path in the Package.swift file. Which if you want to use, you can just update the path.
The project file keeps track of what swift files have been added into the project and which should be compiled and included in the resulting binary. As long as the files have been added via xcode you should be fine.

Adding external project to unity solution

I am trying to add an external project to my unity solution.
It works fine using mono develop but whenever I switch back to unity it seems to remove the reference from the solution.
Is there a way to prevent unity from doing this ?
Thanks,
Unity rebuilds (i.e., removes the existing file and build it again from scratch) MyProject.sln file whenever it finds changes from ~/Assets folder. As such, any manual modification done by you or outside Unity's automated process on MyProject.sln will be discarded each time Unity compiles.
As #Kamalen mentioned, the usual way to import an external project is to have the external project be a library project, build *.dll from it, and put the *.dll file somewhere under ~/Assets. When there are *.dll files under ~/Assets, you have a reference to the classes and methods defined in the library file from any code you put under ~/Assets.
However, it seems that you have the access to the source code and tend to modify the external project often from your comment.
In that case, you could consider putting the source code of the external project under ~/Assets. The folder structure would then look like:
MyProject/
MyProject/MyProject.sln // this is rebuilt again each time by Unity
MyProject/Assets/
MyProject/Assets/ExternalProject/... // This could be a git submodule
MyProject/Assets/scripts/...
You can of course have the ExternalProject be a git submodule and maintain it as a separate git repo. Then you can either make changes to the ExternalProject from inside Untiy folder, or the original location of ExternalProject and then sync the ExternalProject under Unity folder with a pull from git.
As a rule of thumb, import *.dll files if you know the library is complete and it is unlikely to have changes in the library project, which includes the case when you do not have access to its source code. When there exist *.dll files in a project, it's common to assume the library is complete, unlikely to change, and outside of our control, and hence it's called an external project.
Your best way to have an external project into Unity is to... not have an external project directly. Unity does rebuild the solution file regulary and is almost like a temporary file.
What you can do is configure your external project as a library project, and configure the project (or an external tool) to output the generated DLL in any subfolder of the Assets folder.
If your external project uses Unity classes, it will need to have references to UnityEngine.dll and UnityEditor.dll, located in folders :
Applications/Unity.app/Contents/Frameworks/Managed/UnityEngine.dll for Mac
Program Files\Unity\Editor\Data\Managed\UnityEngine.dll for Windows

How can I use folders in a Swift application compiled from the command line?

I'm building a simple webserver using Swift3 and the Swift Package Manager. Running swift build in your project folder will build all of the sources found in the Sources directory and output an executable. However, I've found that if I create folders within the Sources directory to organize my code, my builds fail. It looks to me like the presence of folders causes swift to treat the source as different modules. Is this the cause, and if so, how can I work around it?
Yes. Putting directories directly under Sources will cause SwiftPM to interpret those as modules. This is described in the package manager reference.
To work around this, use another level of indirection: put a directory for your module inside Sources and your additional directories inside that directory:
Sources/YourApp/Stuff/Source1.swift
Sources/YourApp/Stuff/Source2.swift
Sources/YourApp/MoreStuff/Source3.swift
Sources/YourApp/MoreStuff/Source4.swift

How to set reference to the folder which contains multiple jar files?

My environment:
Netbean 6.9.1
Glassfish 3.0.1
Windows 7
Goal:
When my coworkers opens the Netbean Project, the library is already referenced without them manually create library, adding jars into it and reference it.
Detail:
I created Netbean project and the project has reference to few jar files in the folder.
Currently whoever opens the project for the first time, they have to manually create library and refer it to the project.
My project location:
C:\Users\masatosan\Desktop\myProject\myApp
My library location:
C:\Users\masatosan\Desktop\myProject\lib\myLib
The myLib folder contains:
some1.jar
some2.jar
some3.jar
I can achieve my goal if I create reference to individual jar file by defining to project.properties file like below: (creating reference to sqljdbc4.jar)
file.reference.sqljdbc4.jar=../lib/sqljdbc4.jar
javac.classpath=\
${libs.restlib_gfv3ee6.classpath}:\
${file.reference.sqljdbc4.jar}:
But my case is different since I have 3 jars in the myLib folder and wanting to reference them all.
Is it possible to reference all jars in myLib folder?
Please let me know if you need more clarification.
I'm sorry, but it doesn't work that way. When you create a project, you have to add the jar files individually.
However, if you put your lib folder under your project, netbeans will refer to them via relative paths. Then when you share the project (lib directory included), netbeans will be able to automatically find the jar files when the next person uses the project. That way you only have to add jar files once.
Short of using a dependency management tool like maven (which Netbeans has good support for), this is really the best solution. It uses a bit more disk space (obviously), but that's never been a huge issue for me.
I figured how so let me share.
Tool --> Library then library window pop up.
Create library called "MyLib" which contains multiple jars.
Add "MyLib" to your project. This change will be written to project.properties file under nbproject folder.
project.properties file indicates the classpath of lib reference you just added.
It should look like something below
javac.classpath=\
${libs.Excella.classpath}:\
${libs.MyLib.classpath}
Now someone else opens the project from different machine and she just needs to do step#1 and #2, which is to create library with same library name i.e. "MyLib"
I think this is what Bill was saying originally but thought it would be helpful to give step by step instructions since I finally figured .... after long time :D