2D Toolkit Forum

2D Toolkit => Support => Topic started by: pedrommlr on June 07, 2013, 03:04:04 am

Title: tk2dExternal does not exist
Post by: pedrommlr on June 07, 2013, 03:04:04 am
I'm having a bit of a problem with the 2.0 version 2d Toolkit.

I get the message tk2dEditorSkin.cs(14,25): error CS0103: The name `tk2dExternal' does not exist in the current context

It's like Unity can't find the dll, but I see it right there in the editor folder.

Any ideas?
Title: Re: tk2dExternal does not exist
Post by: int64 on June 07, 2013, 07:36:42 am
Before updating tk2d to 2.0 version, I deleted "tk2d" folder in "Assets/Plugins" directory. After that, I reinstalled tk2d 2.0 with no errors.

P.S.: sorry for my bad English
Title: Re: tk2dExternal does not exist
Post by: unikronsoftware on June 07, 2013, 09:12:42 am
Its hard to tell whats going on without actually looking at it.
1. Have you moved the files from the default locations?
2. Have you tried restarting Unity?
Title: Re: tk2dExternal does not exist
Post by: pedrommlr on June 07, 2013, 06:41:55 pm
I have tried deleting TK2DROOT from the assets folder and installing from scratch. That didn't work.

And yes, I've moved the TK2DROOT folder to a Plugins folder, otherwise Unity simply ignored the 2dtk plugin.
Title: Re: tk2dExternal does not exist
Post by: unikronsoftware on June 07, 2013, 07:10:28 pm
You shouldn't move the tk2dROOT folder to plugins. I take it you're using JS? Thats what the 2D Toolkit > Set up for JS menu option is for - it moves the correct files into Plugins. Moving editor scripts into plugins does really nasty things, but sadly thats how Unity works :(

If your project isn't too big, the easiest way to fix this is:
1. In your project, shift select everything that isn't tk2d. Export a unity pacakge.
2. Create new project, import tk2d. Run Setup for JS.
3. In the new project, import unitypackage from #1.

If its too big then you'll have to manually move the files back to the default locations, but you can skip the ones which Setup for JS moves for you. Do step #2, then make a note of what goes where. Everything should work when they're in the right folders.
Title: Re: tk2dExternal does not exist
Post by: pedrommlr on June 07, 2013, 09:31:11 pm
Ah yes! That cleared the errors, great!

But now there's another issue. All my prefabs now have this message where 2dtk scripts used to be:

http://cl.ly/image/1o0k1Y0p0C2Y

Including collections and all...
Title: Re: tk2dExternal does not exist
Post by: pedrommlr on June 07, 2013, 09:33:03 pm
Also, running the integrity check now shows a lot of errors like
"File GUID does not match: Assets/Plugins/tk2d/Code/Sprites/tk2dSpriteCollectionData.cs"
Title: Re: tk2dExternal does not exist
Post by: unikronsoftware on June 08, 2013, 01:12:43 pm
So if you get "File GUID does not match" it means you have done something to break your project metadata.

Common ways this happens is -
1. Moving files outside Unity. This is one of the key things in Unity - never move files in a project from outside Unity. (http://wiki.unity3d.com/index.php/Moving_and_Copying_Unity_Assets)
2. Sharing Unity projects between computers via dropbox / etc. without meta files turned on.
3. Using version control without meta files turned on.

Once metadata is broken, as far as I'm aware, it can't be fixed.
You can still update tk2d, but you'll have to do it manually. I"m assuming you haven't run the "Setup for JS" script and that you're using c#.

1. In your exiting project, enable meta files, close down Unity, and make a zip backup of Assets & ProjectSettings. Libraries isn't needed with meta files on. You'll notice a LOT of .meta files in there.
2. Import tk2d 2.0 into the project, letting it overwrite what it needs to. Restart Unity, and fix any errors as described in the migration guide.
http://unikronsoftware.com/2dtoolkit/doc/2.00/migration_guide.html
3. Hopefully your project would have updated fine.


If you wish to do this, but you've run Setup For JS - you should do this instead.

1. Create a new project, do NOT turn on meta files in this project.
2. Import 2D Toolkit 2.0 into this new project, and then after its imported properly, run Set up for JS.
3. Shut down Unity, and browse to that folder.
4. Copy the contents of the Tk2DRoot folder and its subfolders, taking care not to overwrite the meta files in your original project.
5. Copy the contetnst of the Plugisn folder and its subfolders, again taking care not to overwrite meta files in the original project.
6. Fix any compatibility issues as in the migration guide.

Let me know if you run into any more issues - unfortunately your project is now "broken" compared to the default 2D Toolkit project, and its going to be tricky updating.


Note:
If you have messages showing "associated scripts can't be found", then you will need to drag the appropriate scripts in to fix it. If you're going to do this, you might as well delete all the tk2d files, reimport the package and fix them then once and for all. That WILL actually fix the meta files and you'll then be able to upgrade the normal way.
Title: Re: tk2dExternal does not exist
Post by: Vico92 on March 30, 2015, 11:47:34 am
I'm having identical problem here since I've updated to Unity 5.0, I've just updated 2DToolkit to 2.5.1 too but still get error :
****/MyProject/Assets/TK2DROOT/tk2d/Editor/tk2dEditorSkin.cs(25,25): Error CS0103: The name `tk2dExternal' does not exist in the current context (CS0103) (Assembly-CSharp-Editor)

While It's not blocking development (still can run app on editor/device) it's annoying to get focused on that error each build… How can I manually add this entry, pls?
Title: Re: tk2dExternal does not exist
Post by: unikronsoftware on March 30, 2015, 12:41:53 pm
It is likely that the files have been moved to different directories and the update can't see it. Did you use SetupforJS / move the tk2d files from the default directories?
Title: Re: tk2dExternal does not exist
Post by: Vico92 on March 30, 2015, 01:06:44 pm
I do not use JS and I didn't activated JS setup nor moved files. Every 2dtk files are located in the TK2DROOT created at import.
To me it's not related to project's update since it also occurs with fresh new project & fresh import of 2DToolkit.
But could be something on monodevelop side?
Title: Re: tk2dExternal does not exist
Post by: unikronsoftware on March 30, 2015, 01:28:48 pm
That is very bizarre. I just imported tk2d 2.5.1 (from forum) into a new Unity 5 project and I don't see it. Can you zip up and email a broken project to support at unikronsoftware.com?
Title: Re: tk2dExternal does not exist
Post by: Vico92 on March 30, 2015, 03:17:51 pm
Done. I've sent the project by email + a dropbox link, just in case.

I noticed there's no more -tk2d.asset file generated, is that correct?
Title: Re: tk2dExternal does not exist
Post by: unikronsoftware on March 31, 2015, 10:33:05 pm
Replied to your email.
Title: Re: tk2dExternal does not exist
Post by: yo_milo on April 08, 2015, 07:33:53 pm
I am having the same problem... I even created a fresh new project, just to import 2D Toolkit, same error...
Title: Re: tk2dExternal does not exist
Post by: unikronsoftware on April 08, 2015, 07:48:14 pm
Vico92's problem was in Monodevelop only, because of a Unity issue that doesn't generate the solution files correctly. If that is the case, you'll need to file a bug with the Unity guys. In the mean time you can manually add the dll to the solution but thats not a great solution.
Title: Re: tk2dExternal does not exist
Post by: yo_milo on April 08, 2015, 10:31:22 pm
The thing is, the DLL is there.

But for some reason Mono does gives me the "Does not exist in the current context" error in tk2dEditorSkin line 14, 20, 24, and 46.

So, do you recommend me deleting and adding the DLL?

Sorry if this problem is not really 2D toolkit. I love your tools, but this bug has totally disrupted my rhythm today... I have not been able to work...
Title: Re: tk2dExternal does not exist
Post by: unikronsoftware on April 08, 2015, 10:36:32 pm
Is the DLL in the external assemblies in the relevant monodevelop project? Thats what it wasn't doing correctly last time I looked.
Title: Re: tk2dExternal does not exist
Post by: yo_milo on April 08, 2015, 11:39:18 pm
I reinstalled Monodevelop. It fixed my problem.
Title: Re: tk2dExternal does not exist
Post by: Vico92 on April 09, 2015, 09:12:05 am
.cs FILES are into the project but DLL REFERENCES are missing.

To add the missing references :
1-right-clic the References folder in Assembly-CSharp-Editor to edit references.
2-Select .NET Assembly tab, then go to the TK2DROOT.tk2d/Editor folder
3-Select both tk2dExternal.dll and tk2dSkin.dll and clic "Add" then "OK"

You will have to repeat the process when solution is regenerated.
Title: Re: tk2dExternal does not exist
Post by: thiagodeserto on April 18, 2015, 08:30:57 pm
Same problem here, but with unity cloud only.

Locally builds perfectly, but in the cloud cannot build iOS, Android or Web.
Both unity versions are the same: 5.0.1f1.

This is happening with a brand new project and last 2d toolkit version.
2.5.1

Code: [Select]
1: [Unity] Initialize engine version: 5.0.1f1 (5a2e8fe35a68)
2: [Unity] -----CompilerOutput:-stdout--exitcode: 1--compilationhadfailure: True--outfile: Temp/Assembly-CSharp-Editor.dll
3: [Unity] Compilation failed: 4 error(s), 0 warnings
4: [Unity] Assets/TK2DROOT/tk2d/Editor/tk2dEditorSkin.cs(14,25): error CS0103: The name `tk2dExternal' does not exist in the current context
5: [Unity] Assets/TK2DROOT/tk2d/Editor/tk2dEditorSkin.cs(20,24): error CS0103: The name `tk2dExternal' does not exist in the current context
6: [Unity] Assets/TK2DROOT/tk2d/Editor/tk2dEditorSkin.cs(24,24): error CS0103: The name `tk2dExternal' does not exist in the current context
7: [Unity] Assets/TK2DROOT/tk2d/Editor/tk2dEditorSkin.cs(46,17): error CS0103: The name `tk2dExternal' does not exist in the current context
8: [Unity] Assets/TK2DROOT/tk2d/Editor/tk2dEditorSkin.cs(14,25): error CS0103: The name `tk2dExternal' does not exist in the current context
9: [Unity] Assets/TK2DROOT/tk2d/Editor/tk2dEditorSkin.cs(20,24): error CS0103: The name `tk2dExternal' does not exist in the current context
10: [Unity] Assets/TK2DROOT/tk2d/Editor/tk2dEditorSkin.cs(24,24): error CS0103: The name `tk2dExternal' does not exist in the current context
11: [Unity] Assets/TK2DROOT/tk2d/Editor/tk2dEditorSkin.cs(46,17): error CS0103: The name `tk2dExternal' does not exist in the current context
12: [Unity] -----CompilerOutput:-stdout--exitcode: 1--compilationhadfailure: True--outfile: Temp/Assembly-CSharp-Editor.dll
Title: Re: tk2dExternal does not exist
Post by: unikronsoftware on April 19, 2015, 06:00:16 pm
Is tk2dEditor.dll in version control?

I have no idea why its trying to build an Editor folder, or even the Editor assembly for an iOS build. You will need to ask the Unity guys about this. The reason its happening is -
1. Its building an editor assembly when trying to build an iOS / Android / Web deployment for some reason.
2. Its not finding the dll file that is in the editor folder, but it does when building locally. It should at least be consistent with the editor.
Title: Re: tk2dExternal does not exist
Post by: VeTaLkO on July 24, 2015, 10:10:01 am
Hi, i have the same issue.

// Is tk2dEditor.dll in version control?
Should it be? I cant find it in solution itself.
Also, if to open asset store page and check package content from there (just in case i had removed it accidentally), there are only 2 dlls: tk2dExternal and tk2dSkin
Title: Re: tk2dExternal does not exist
Post by: unikronsoftware on July 24, 2015, 10:41:26 am
Sorry, I meant tk2dExternal.dll
Its complaining about a missing tk2dExternal dll - that is an editor DLL, no idea why its trying to build it for a cloud build, as is Assembly-CSharp-Editor. This sounds like a bug in the cloud build