Hello Guest

Author Topic: 2D Toolkit and Git  (Read 17333 times)

vicenterusso

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 25
    • View Profile
2D Toolkit and Git
« 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:

Code: [Select]
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:

Code: [Select]
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?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: 2D Toolkit and Git
« Reply #1 on: April 15, 2014, 05:01:26 pm »
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.

vicenterusso

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: 2D Toolkit and Git
« Reply #2 on: April 15, 2014, 05:45:27 pm »
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...

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: 2D Toolkit and Git
« Reply #3 on: April 16, 2014, 10:21:02 am »
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?

vicenterusso

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: 2D Toolkit and Git
« Reply #4 on: April 16, 2014, 01:50:32 pm »
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..

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: 2D Toolkit and Git
« Reply #5 on: April 17, 2014, 02:58:15 am »
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.

vicenterusso

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: 2D Toolkit and Git
« Reply #6 on: April 20, 2014, 01:29:58 am »
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:

Quote
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)

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: 2D Toolkit and Git
« Reply #7 on: April 20, 2014, 10:34:22 am »
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.

vicenterusso

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: 2D Toolkit and Git
« Reply #8 on: April 20, 2014, 05:21:41 pm »
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:
Code: [Select]
Assets/-tk2d*
Assets/Resources/tk2d.meta
Assets/Resources/tk2d/*

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: 2D Toolkit and Git
« Reply #9 on: April 22, 2014, 02:31:40 pm »
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...

vicenterusso

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: 2D Toolkit and Git
« Reply #10 on: April 22, 2014, 03:25:40 pm »
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 )?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: 2D Toolkit and Git
« Reply #11 on: April 23, 2014, 11:12:36 am »
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.

vicenterusso

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: 2D Toolkit and Git
« Reply #12 on: April 23, 2014, 03:26:26 pm »
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*


piscopo

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: 2D Toolkit and Git
« Reply #13 on: December 13, 2017, 07:34:43 pm »
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.?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: 2D Toolkit and Git
« Reply #14 on: December 14, 2017, 09:52:37 pm »
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.