Bizzar Unity 2.5 on Windows question, external assets

Q1)So here is my new wierd delima, I have objects that I want to be included in the distribution, but not inside the Unity gama binary that gets built. Do I need to put them into the Plugins folder for them to be included with the package but not embeded in the binary?

Q2) During the game editor “play” button, where is the test binary being ran from? I need to have my DLL that is in the Plugins folder actually on the same “level” or in the same “folder” as the binary during the “play”. I thought it was in the root of the Temp folder but it doesn’t seem to be.

I need things to be running in the editor identical in structure as they would be running when the game is built. Reason being for those who thing I have just lost it completely while you read this thread, is that I have just created a way to spawn multiple game windows and have them fully interact, problem is, I can only troubleshoot this after the game has been ‘built’ using the “Build” function in Unity. Then I can manually place the external assets in the folder structure I need them in and the DLL in the same folder as the game exe.

I might be on my own on this one since it is advanced feature that might not even exist yet in Unity for this type of build situation.

nudge I figured I would give this topic a little nudge so it doesn’t disappear into the history of the threads :slight_smile: Still looking for where that “run” button actually runs the binary from when we click on “run” so I can place the appropriate libraries along side that thing.

You may want to look at Editor.isPlayingOrWillChangePlaymode:

You could write an editor script that checks for this and then copies the files over when switching to play mode and deletes them when switching out. I’m not seeing the equivalent of an Editor Update() method called once per frame, however, you could probably hook it into an EditorWindow’s Update() call. Maybe another dev will comment about that part.

This will help but I still need to know when it is in play mode where the EXE is running from. I thought it was under the Unity folder in the TEMP folder for the project but apparently it isn’t. The intermediate build for test in play mode is running somewhere, that is where I need to place my DLL’s and some other junk during ‘play’ mode vs ‘edit’ mode.

Thanks for any help on this.
What I need to know is what is the equivelant to this:

In play path vs edit path.

You might want to look into a program such as Filemon (formerly)

This’ll tell you when//where files are created - it might be pretty quick to track down, I’m on a Mac right now though…

Good luck!

For test runs in the editor, assemblies need to be in the asset folder, non .NET DLLs need to be in Assets/Plugins (and you need pro)

When you build the game the DLLs will be copied to the corresponding places automatically.

Thanks to both but you are overlooking the point here, so its my fault I am not clear and I am sorry for that. The Plugins folder places files ‘beneath’ the root of the binary, not with the binary. I need certain DLL’s to be on the same root folder as the game binary itself, not in any subfolder under it.
Then I have folders that are required to be off the root of the game folder also, not beneath it. This is horibly hard to explain other than the following is what I am seeking:

UnityGameRunning.EXE from Play button
MyMainDLL.DLL in same folder as UnityGAmeRunning.EXE in Play

As it stands the hierarchy is as follows:

Game.exe
Data\stuff.dll

This is bad in my project, I need

Game.exe
stuff.dll
Data\other assets with other dlls and stuff
OtherDataTOstuff\non-unity assets and stuff

The stuff.dll in this instance is required to be in the root with Game.exe for it to work. Adding items to Assets places them by default in the Data folder created by Unity.

(also, i appologize if I haven’t mentioned this already, I have pro)

So, this is where you are mistaken. The Play mode in the Editor does not generate EXEs. It is running in the editor’s process.

void Start () {
		UnityEngine.Debug.Log(UnityEngine.EditorApplication.applicationPath);
}

Results in :
The type or namespace name EditorApplication' does not exist in the namespace UnityEngine’. Are you missing an assembly reference?

Are you sure it exists in the Windows build of Pro for 2.5?

I have created an Editor folder in my Assets folder, placed the

using UnityEditor;

under the UnityEngine
In the start I am trying to have it then display the call results of the applicationPath to the debug window and it is returing to me a null refference error.

Here is the script file that exists in the Editor folder:

using UnityEngine;
using UnityEditor;
using System;
using System.IO;
using System.Threading;
using System.Collections;

public class Impact : MonoBehaviour {
    string tmpReturn;
    void Start () {
    tmpReturn=UnityEditor.EditorApplication.applicationPath;
		UnityEngine.Debug.Log(tmpReturn);
	}
}

Since applicationPath is a variable and not a method I know I shouldn’t be calling with () on the end.

The exact error in the console with an empty project and this is the only code on the only script is this:

To reproduce simply create a new Windows 2.5 project, (empty no asset import), add a folder called Editor, create a CS file and place the script listed above in it, click play.

From what I understand, that string should now have the editor path. So I have missed a step somewhere.
Thanks

Remove the :MonoBehavior part

The editor extensions can not be monobehaviors as editor classes do not exist at runtime which is the only place monobehavior classes exist.

either make it a descendant of nothing or something out of the UnityEditor namespace

I’ve tried this from different angles, I can’t get it to return the path.

My script in the editor folder:

using UnityEditor;
public class GetIt 
{
	string tmpReturn;
	public string GetIt() 
	{
		tmpReturn=UnityEditor.EditorApplication.applicationPath;
		return tmpReturn;
	}
}

My calling script:

using UnityEngine;
using System;
using System.IO;
using System.Threading;
using System.Collections;

public class Impact : MonoBehaviour {
	GetIt testing=new GetIt();

	void Start () {
		UnityEngine.Debug.Log(testing.tmpReturn);
	}
	void Update () {	}
}

What else am i doing wrong?
My calling script is not in my editor folder. Even if it was it still doesn’t work.

You try to use editor functionality in a game class.
That will not work, editor is editor only, not in game classes. When you run the game, even within the editor, the editor classes are not accessable.

The path there is for asset processing scripts, not to get the application path, as it will not work in the application.

The application path at runtime is gained through .NET itself through System.Environment.CurrentDirectory

This thought has no relevance.
A DLL that needs to be in the same folder as the exe will not work in Unity as Unity searches for the DLLs and assemblies in the subfolders.
I do not see what kind of DLL you might have that requires the DLL to be in a different place than the other XX DLLs and assemblies.

Actually it does work when built, I need to know 1 very simple thing which is eluding me at the moment, when the game is in the editor and I click on “Play” all I care about is the binary that is being used at that moment. I know this can’t be that hard of a question, maybe it is a trade secret which is why it is so hard to get the answer to.

If the Editor isn’t the answer then when we click play what is actually happening? I’ll keep digging, one way or the other I’ll find the answer tonight.

HA! Found the secrect!
C:\Program Files\Unity\Editor

Edit:
Found a down side, when you spawn a process from the DLL that is external to the Unity.exe in the Editor folder, it “thinks” you have moved your project folder afterwards. Which is incorrect assumption on the editors part.

The DLL thread shows started and terminated correctly prior to stopping the editor and working on the script again. There is no way I can work around that ‘bug’ since the project folder has not moved only that I am now using a DLL that does not exist in the project folder and where it needs to be for testing purposes.
Basically, it uses the Unity.exe in the Editor folder for the intermediate builds then later when you build your game, it rebuilds the binary with linking done to the rest of your project. (actually it appears to be doing a slight bit more than this)

I already explained this in a previous post: there is no intermediate binary, no generated EXE when you press “Play”. Unity.exe IS the editor executable. Your game is being simulated inside the editor. There is no game exectuable until you Build a player.

Why does it think I moved the project folder when I am using a local DLL in the Editor folder along side the Unity.exe though? It shouldn’t. I am able to mimic what I am looking to do after the build but I can’t continue to write code without it thinking I moved the project folder.

As far as what you explained, I didn’t fully understand since you didn’t mention the full path to the exe. I didn’t read between the lines per say. The following should be allowed:

Have external assets to Unity completely, but still included in Unity so that they are included in the Data folder when Unity is built (so far I just have to copy assets that I want into that folder after the build)

Allow side by side library with the editor binary during development phase. Right now when I try this, Unity thinks I have moved my project folder when I utilize the library through class calls. When the project folder has not moved at all, I don’t know why or how it thinks it has moved but it does.

How are you making use of this DLL and why does it have to be in the root folder?

Long story short, the DLL is a COM library that I use to spawn more 3d windows, each window is a DirectX window where I spawn camera’s for each network interface. The Unity window itself is the world observer. Everything in the Unity window is based on what I call my global tracking elements. As a new player arrives in the game, I spawn a new window that is a watcher element. Well this new window needs to be running in its own thread and independent of Unity but at the same time synchronized with Unity.

I wrote a C# wrapper for 3Impact and I have this wrapper in the Assets folder so that I can use the calls directly. With this said, I have full access to not only Raknet in Unity but I have the network access and 2d interface from 3Impact available to me. What I also have is other ActiveX and COM libraries that I have written that interact with SQL and Oracle.

When I start up Unity, I spawn 2 command windows (I like the word spawn, actually I am just Creating them). These windows are my interface to SQL 2008 and Oracle 10, each for their own purposes. All of this interacts with the Unity command window. I have an EGO for SQL, an EGO for Oracle and what I have labeled my puppet EGO which is used for spawning the watcher interfaces. I like Unity’s RDP interface for the peer to peer interface but it lacks some of the other TCP/IP work I need to do. This is just the tip of the iceberg but the bottom line is that both my COM and ActiveX libraries have to reside in the root with the Unity binary otherwise since Unity places everything in the full build (build or build and run), my libraries do not interact at-all. They can’t be in the Data folder, nor can any of the sub folders I use for 3Impact, nor the sub folders I use for either SQL or Oracle, both of which are necessary.

Unfortunately Unity does not permit me to add in ‘external’ folders to include with the program build that are not either in the Data folder or otherwise embedded within the game EXE that Unity builds.

There are many reasons why I am doing the code this way.
I don’t know if this helps to elaborate on the why or not.It is always hard for me to explain what I am doing or even why. I have an entire battle system written in C# for 3Impact that is actually working quiet well for the server side battle results, it took me over 6 months to perfect it and I don’t want to start over on it. It is a side by side library for the game that allows me to express to the players the results of a given battle and receive from the players action requests, in return my library then determines if it is a legal action or not and reacts accordingly.

I have an entire library that is for zone preparation and heart beat information for spawning creatures and events that relies on LUA, LISP and independent libraries I have written, they are all plugins that I have written in C++ but not for Unity, my interface to those plugins also requires the entry point library be in the root with the binary, they have sub folders with rule files that reside on the server, these rule files are nothing more than instructions that are read in and translated then the information is bridged into the game. I can add definition to a new creature or an entire new creature class and creature elements like animation, size, texture, etc then tell the zone file to seed it, spawn it and track it.

I’ve had to ditch some of my Delphi code though, couldn’t get those libraries to work at all for some reason.

I’ll post some screen shots that I am comfortable with sharing later this week if you want to see a visual of this in process. Every time I quit the processes then stop the editor from play mode, Unity crashes because of the “folder moved” issue. (which is a ghost of an issue really, cause I haven’t moved my project folder at all) Let me know if you want a visual and I will get a watered down version of what I am doing and screen shot it.