2D Toolkit Forum
2D Toolkit => Support => Topic started by: Moran on March 24, 2013, 12:47:51 pm
-
Hi!
I SVN "Checked out" a project which had a prefab with sprites in it.
Initially it worked well, but then I changed the prefab and undid the change, if I remember right (didn't pay attention).
The result being that for some objects in the prefab, whenever they are clicked or scrolled to, "Rebuilding Index" always appears several times, even if I click away and immediately back to the same object.
I tried Updating again but erasing the -tk2d file as instructed in some post, not helping.
Help?
EDIT: It also results in this error message, after almost every "rebuild": MissingReferenceException: The object of type 'tk2dIndex' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
tk2dEditorUtility.CreateIndex () (at Assets/TK2DROOT/tk2d/Editor/tk2dEditorUtility.cs:215)
-
Did you update to Unity 4.1 at around the same time?
If you did, you will at least need to be on version 1.91 + patch1. This fixes the "tk2dIndex" issue.
You do have .meta files turned on for svn, right?
-
I did update Unity. Since I bought td2k under another account, my package don't auto-update. I'll update and report, although I already rebuilt the entire object and that also worked.
We've been using SVN for a while, "meta files" is selected and we're using "force text".
-
OK. Let me know how it goes and we'll take it from there.
-
Hi,
I am having the same problem as above. When I check out from svn (standard setup) I get index out of range and all animations are gone haywire. Is there a simple way of avoiding this?
Unity 4.0 ~ tk2d 1.9
Thanks
-
Meta files are on, right?
Also, what happens if immediately after you get latest from svn, you restart Unity, and then rebuild index?
-
After posting this I tried checking out again and since by chance I had added the -tk2d file, I checked it out with the rest of the source and the whole thing worked.
Didn't build indexes, just ran the project and things were in better shape.
Not sure if this is pure luck or the fact that I had the original -tk2d file with the project in svn helped mitigate the problem.
What are your recommendations regarding using version control with the toolkit, should we add the -tk2d file or any others?
And yes .meta and force text on.
-
The -tk2d file shouldn't be checked in, it could cause issues when merging changes, but shouldn't be an issue if you're using text serialization. The best practice should be to rebuild index manually after updating from VC.
-
Rebuilding indexes and -tk2d file was the cause of my loosing the animations, the alternative was to go and rebuild all anims manually and relink them to the animated sprites in my levels (hours of work potentially).
In the case where you recommend index rebuild after checkout, why do you think the animation settings are getting corrupted? worth noting that not all animations are affected.
-
I'm not sure to be honest - It is probably best to look at the contents of the .prefab in a text editor to debug that. There are references to sprite collection data objects in there, and if they are somehow different when checked out then that is one reason it could possibly corrupt the animation. The other option is to look at the broken animation immediately in debug inspector mode to see if all references are correct?
If you do find out what it is, please let me know so I can address it properly.
-
Forgot to update but the patch for 1.90 and the following version solved the issue for me.
Now, after a merge, whether -tk2d is versioned or not, clicking on "new" sprites causes the index to be rebuilt just once and that's it.
Thanks and good luck netlander.
-
@Moran - that was an issue specific to Unity 4.1 & tk2d 1.90/91 without the patch. Unity decided to change how something worked without any warning and that broke index generation :( Is this the case in yours @netlander?
-
Nop, I'm still on 1.9.0/Unity 4.0 but I think it's a quirk in these versions, I've gone through the process of checking out and rebuilding, this time I didn't encounter the problem.
My solution was to proceed as follows:
Check out the project.
Import tk2d.
Run (so the index is rebuilt).
This seemed to have avoided me having corrupt animations but I can't say for certain what's exactly happening.
Thanks for your help guys.
-
I think I'm having the same issue, Unity keeps running "Rebuilding Index" and collections that are loaded through tk2dSystem.LoadResourceByName stops working. I wouldn't mind it so much if rebuilding the index was reasonably fast but it takes approximately 5 minutes to rebuild the index in our project :/
Is there a log somewhere that I can check to see what is actually breaking the collections?
Edit: I'm using tk2d 1.92 + patch and Unity 4.1
-
Ok, I've narrowed down the problem to the following scenario:
- Run the game
- Select a gameobject with a runtime loaded sprite collection in the Hierarchy view
- Unity starts rebuilding the index over and over
This is making it impossible to inspect the objects we're using.
-
How is this loaded at runtime? Just tk2dSystem? Or is this specific case loaded by any other means?
-
It is loaded through tk2dSystem yes, like this:
tk2dSpriteCollectionData collection = tk2dSystem.LoadResourceByName<tk2dSpriteCollectionData>( collectionName );
-
I'll investigate that.
-
So do you have a workaround for this? I'm having the same problem like Aegzorz has said..
-
This should be fixed in tk2d 2.0. What version are you working on?
-
This should be fixed in tk2d 2.0. What version are you working on?
I am currently using tk2d 2.0 and I am experiencing the same problems mentioned in this post.
Just to restate:
-Clicking on some elements with a tk2dsprite in the inspector (both at runtime and not) causes Unity to enter a frozen state. A popup appears saying "Rebuilding Index" with a progress bar that runs indefinitely. I haven’t fully isolated why it’s only some of the tk2dsprites that cause this, but I will post an update when I do.
I have attempted to manually rebuild my indices through the 2D Toolkit panel in Unity, but this doesn’t change the behavior I mentioned above.
tk2d is a great piece of software, but this particular issue is a huge block to my current work flow. Debug printing transform values for tk2d elements is too slow to implement my tasks (GUI).
-
We've improved the code yet again in 2.1 - when it does this it usually meant it couldn't find something it expected to find in the project. I.e. it rebuilds the index expecting to find something in the next interation, but then it doesn't for some reason or other and goes into this infinite loop. I've changed the behaviour so it fails a bit more elegantly, i.e. simply displays a "-" when it can't find something after one attempt at rebuilding the index.
If you can create a repro case, I can almost certainly fix it for you. I've found more than one case of random weirdness so far.
I don't understand this bit: "Debug printing transform values for tk2d elements is too slow to implement my tasks (GUI).".
-
Had a similar Problem today.
Using SVN with several Coders. One Working Copy changed the *.meta of a series of Sprite Collections (Don't know why). Turns out, for some reason all guid's in there have been changed. I triggered a rebuild to correct the mess and it seemed to work, but if you now selected any sprite and tried to change the SpriteCollection the Rebuilding Index Loop occurred. Only solution was to revert the to original Meta-Files.
We are using 2.1 beta 2. Sadly I can not provide you with an repro-project, because it currently exceeds 2 Gigabyte and contains sensitive data.
Maybe this helps clarifying issues like that.
-
What meta files did it change in total? It should NEVER change meta files for any existing assets :( If GUIDs are broken, then this will inevitably break - and theres more stuff broken than just the index....
-
Hello, may be my problem and it's solution will help somebody.
Situation:
In our game we had levels that full of various objects(sprites) that placed everywere. I have xml file that converted from psd file. This file have names and positions of objects. My task was write a script that reads that file and place right sprites in right positions. All this must be done in editor mode, and created objects will saved as prefab. Important : we defined platform specific sprite collections, for 1x and 2x platforms.
What i done:
Script has reference to tk2dSpriteCollectionData. He read sprite name from xml; find sprite collection that has definition of sprite with readed name; create a sprite with right collection and name; add it to the scene.
Here structure of folders where placed sprite collections:
US/US_Objects_1_Data/US_Objects_1@1x_Data/US_Objects_1@1x (generated tk2dSpriteCollectionData)
US/US_Objects_1_Data/US_Objects_1@1x_Data/atlas0
US/US_Objects_1_Data/US_Objects_1@1x_Data/atlas0 material
US/US_Objects_1_Data/US_Objects_1@2x_Data/US_Objects_1@2x (generated tk2dSpriteCollectionData)
US/US_Objects_1_Data/US_Objects_1@2x_Data/atlas0
US/US_Objects_1_Data/US_Objects_1@2x_Data/atlas0 material
US/US_Objects_1_Data/US_Objects_1 (generated tk2dSpriteCollectionData)
US/US_Objects_1_Data/US_Objects_1@1x (generated tk2dSpriteCollection)
US/US_Objects_1_Data/US_Objects_1@2x (generated tk2dSpriteCollection)
US/US_Objects_1 (tk2dSpriteCollection)
Problem:
My script must have reference to tk2dSpriteCollectionData.
If I give him reference to US/US_Objects_1_Data/US_Objects_1 then it can't find any sprite.
If I give him reference to US/US_Objects_1_Data/US_Objects_1@1x_Data/US_Objects_1@1x , the script generate my map. Map look fine, but infinite "rebuiding index" starts when I select one of objects. Anyway I don't sure is it good to use platform specific data (US_Objects_1@1x) for generation
My solution:
Before generating a map I deleted platform 2x from sprite collections. And my folders became like this:
US/US_Objects_1_Data/US_Objects_1 (generated tk2dSpriteCollectionData)
US/US_Objects_1_Data/atlas0
US/US_Objects_1_Data/atlas0 material
US/US_Objects_1 (tk2dSpriteCollection)
In script I give reference to US/US_Objects_1_Data/US_Objects_1. And generate map. Everything looks fine now. And now I can select any of generated objects. I save this as prefab. And after that I add platform 2x to sprite collection. As result I get generated map that uses platform specific sprites.
May be all this is very specific, but I hope I help somebody. Sorry for my English :)