Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I have a C# script inside a Unity project. I'd to both keep using the script in this Unity project, and to use it to compile a non-Unity Linux daemon.

So I would basically need to create a new Main for this Linux daemon, and include this script, without using any of Unity's classes. Compiling it using Unity anyway is currently not an option.

However I'm a bit confused on how to do such a thing. How am I supposed to do that?

share|improve this question
    
What have you tried already? –  Byte56 Jan 27 '14 at 15:52
    
@Byte56 I've searched on google and I've found many confusing infos, usually looking to do something different (such as running .NET, compiling different systems, running .asp, etc.). –  Lohoris Jan 27 '14 at 15:53
1  
First off, unity is not .NET, it's Mono, which will run just fine on Linux or OSX. Second off, C# isn't a scripting language. Third off, running and compiling are not the same thing. Is that thing you intend to run as a daemon the server logic of a game? –  Timothy Groote Jan 27 '14 at 17:02
1  
So why is this getting downvoted? –  Grey Jan 27 '14 at 17:22
    
I'm guessing for the lack of trying anything. Just searching around isn't much of an attempt I think. Or the reasons in Timothy's comment. –  Byte56 Jan 27 '14 at 17:35

1 Answer 1

You can compile a .DLL from any mono project, and use that in Unity.

Move the portions of the code you want to keep outside the unity project to a new solution, and compile a DLL from them.

You can then import that DLL and use it in your Unity project.

Unity themselves provide examples of how to do this here :

http://docs.unity3d.com/Documentation/Manual/UsingDLL.html

The "daemon" you want to run can be created in a side project, and compiled separately.

share|improve this answer
    
This put me in the right track, but I don't really need to compile a DLL for that, just using the same source file in a common directory would be enough. Now I've created a new solution for the server and I'll try to do that, I'll come back and edit when I'm done. –  Lohoris Jan 27 '14 at 21:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.