2D Toolkit Forum
2D Toolkit => Support => Topic started by: vicenterusso on April 15, 2014, 01:47:41 pm
-
Everytime I pull my project from another machine, I need to re-commit every sprite collection. Heres what happen:
NullReferenceException: Object reference not set to an instance of an object
tk2dSpriteCollectionData.get_inst () (at Assets/TK2DROOT/tk2d/Code/Sprites/tk2dSpriteCollectionData.cs:555)
tk2dBaseSprite.Awake () (at Assets/TK2DROOT/tk2d/Code/Sprites/tk2dBaseSprite.cs:901)
tk2dTiledSprite.Awake () (at Assets/TK2DROOT/tk2d/Code/Sprites/tk2dTiledSprite.cs:87)
And here is my .gitignore about 2dtk:
Assets/-tk2d*
Assets/Resources/tk2d.meta
Assets/Resources/tk2d/*
Read it somewhere and started using. Anyway, whats is the necessary files to avoid this error?
-
Do you have meta files turned on and are you checking in all the meta files for everything?
After you import on the new machine you should 2D Toolkit > Rebuild.
-
Do you have meta files turned on and are you checking in all the meta files for everything?
After you import on the new machine you should 2D Toolkit > Rebuild.
Meta files turned on and included for everything. Rebuild Index didn`t worked. Tried before...
-
Most people, including us use some form of version control (we use Hg and Plastic) with meta files with no problem. Are you getting this issue consistently, and are you checking in the libraries folder as well?
-
My Libraries folder is not included. Here is my .gitignore:
http://hastebin.com/nuxevocawe.pl
And my generic .gitattributes file:
http://hastebin.com/resejemabo.mel
Edit: yes, I do have this problem every time..
-
Not sure what to suggest here. This is not a known problem. The only thing I can think of is to look at the project, should be sufficient even if you can isolate it to 1 sprite collection thats broken.
-
Not sure what to suggest here. This is not a known problem. The only thing I can think of is to look at the project, should be sufficient even if you can isolate it to 1 sprite collection thats broken.
Almost sure it won't help, but anyway.. the error when I open a project in another machine:
NullReferenceException: Object reference not set to an instance of an object
tk2dSpriteCollectionData.get_inst () (at Assets/TK2DROOT/tk2d/Code/Sprites/tk2dSpriteCollectionData.cs:555)
tk2dBaseSprite.Awake () (at Assets/TK2DROOT/tk2d/Code/Sprites/tk2dBaseSprite.cs:901)
tk2dTiledSprite.Awake () (at Assets/TK2DROOT/tk2d/Code/Sprites/tk2dTiledSprite.cs:87)
-
That implies that it hasn't successfully loaded some platform specific sprite collection. Try deleting the Resources/tk2dFolder, -tk2d object and then 2D Toolkit > Rebuild Index. That may help, if it doesn't it does imply something is breaking, but its close to impossible to work out what without looking at a broken dataset.
Note - if you're using text serialisation make sure git is merging correctly.
-
The Resources folder is not on my git project. When I change machine, the Resources/ files are not changed. Maybe thats the problem? I will add these files to git project and see what happens...
My .gitignore:
Assets/-tk2d*
Assets/Resources/tk2d.meta
Assets/Resources/tk2d/*
-
Resources/tk2d.meta should be regenerated, but the other files should be there. Let me know how it goes. Not sure how I overlooked that in the first post...
-
Resources/tk2d.meta should be regenerated, but the other files should be there. Let me know how it goes. Not sure how I overlooked that in the first post...
What do you mean by regenerated? From what I understood you`re telling me to keep Resources/tk2d.meta out of source control? It`s already on my git ignore... so it`s suppose to regenerated everytime. Maybe, it`s related to this issue ( http://2dtoolkit.com/forum/index.php/topic,3989.0.html )?
-
I should have been clearer.
Resources/tk2d.meta and Resources/tk2d/* should not be in the ignore file and should be checked in.
In theory, rebuilding the index should regenerate these, but I've not tested that since the feature was first implemented ages ago, so that may be what is causing your problem.
Try removing this from the ignores, and check these in, see if it works better.
Assets/-tk2d* is the only tk2d related thing that should be in the ignores.
-
I should have been clearer.
Resources/tk2d.meta and Resources/tk2d/* should not be in the ignore file and should be checked in.
In theory, rebuilding the index should regenerate these, but I've not tested that since the feature was first implemented ages ago, so that may be what is causing your problem.
Try removing this from the ignores, and check these in, see if it works better.
Assets/-tk2d* is the only tk2d related thing that should be in the ignores.
I re-tested.
Checking out on another machine, rebuilding index, closing unity and reopen again, fixes the problem. But I`ll leave only on Git Assets/-tk2d*
-
I should have been clearer.
Resources/tk2d.meta and Resources/tk2d/* should not be in the ignore file and should be checked in.
In theory, rebuilding the index should regenerate these, but I've not tested that since the feature was first implemented ages ago, so that may be what is causing your problem.
Try removing this from the ignores, and check these in, see if it works better.
Assets/-tk2d* is the only tk2d related thing that should be in the ignores.
Sorry for reviving an old post, but I just need something clarified. Is the above the most up-to-date rule in regards to handling 2D Toolkit in Git? For the past several projects we've been following what it says in the Manual on the 2D Toolkit website (http://2dtoolkit.com/docs/latest/advanced/version_control.html), so we've been excluding the Resources/tk2d/*. After coming across this post I'm now questioning the way we've been doing it this whole time. Is the Manual out of date as far as version control is considered?
Also, in the "After updating..." section of the Manual, is that referring to after updating the version of the 2D Toolkit asset, or after pulling any changes related to sprite collections, animations, etc.?
-
Hi,
Yes thats correct. The manual was never updated from the looks of it, sorry its fixed now. Resources/tk2d/* can be reconstructed but it should be checked in.
> Also, in the "After updating..." section of the Manual, is that referring to after updating the version of the 2D Toolkit asset, or after pulling any changes related to sprite collections, animations, etc.?
After updating refers to pull / merge (in git parlance) or or otherwise changing any sprite collection assets externally from unity.
-
Thank you for the clarification. :)
-
So you say I should "Rebuild Index" every time I push something related to tk2d?
What should I do if I need to auto-build my project (for example I use Unity Cloud Build for fast iOS builds)? I get a lot of "broken builds" sometimes and can't do anything with it (some atlases just corrupted, sprites a sliced and messed up).
Can this "Rebuild Index" happen by itself without manual pressing button? Or at least every time before build or something like that?
-
Hi,
It should pick up and rebuild the index when it detects changes - but I have seen this fail occasionally due to dates not propagating thru, etc. In this case however, you could try making it Rebuild automatically. For example, just before a build is started...
using UnityEditor;
using UnityEditor.Build;
using UnityEngine;
class tk2dRebuildIndexPreprocessor : IPreprocessBuild
{
public int callbackOrder { get { return 0; } }
public void OnPreprocessBuild(BuildTarget target, string path)
{
tk2dEditorUtility.RebuildIndex();
}
}