Hello Guest

Author Topic: Importing / Exporting between projects  (Read 6196 times)

db82

  • Newbie
  • *
  • Posts: 5
    • View Profile
Importing / Exporting between projects
« on: March 12, 2012, 06:12:00 pm »
Hi

We are experimenting with sharing assets between our team.

If I make a prefab of an AnimatedSprite and export / import to a new project, the SpriteCollection for the prefab seems to be missing.

Is there any easy fix for this?

Thanks

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Importing / Exporting between projects
« Reply #1 on: March 12, 2012, 06:22:47 pm »
How are you sharing this? What version of Unity are you using, 3.4/3.5 Pro/Free?

db82

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Importing / Exporting between projects
« Reply #2 on: March 15, 2012, 11:09:59 am »
Sorry for late reply.

We are using the Pro trial version, 3.5.0f5

How to duplicate this:

1. Create a new project, include 2D Toolkit, Open demo 1 - demoscene.
2. Create a prefab named SheepPrefab
3. Drag sheep from Hierarchy to SheepPrefab in Project.
4. Right-click on SheepPrefab and Export Package (Note: DemoSpriteCollection is missing from the Items to Export)
5. Create a new Project, include 2D Toolit.
6. Delete tk2d_demo as if this was a blank project
7. Import the SheepPrefab package into the project
8. Bring the DemoAnimations up in Inspector, select the sheep clip

At this point no frames are displayed in Inspector, I also get a bunch of these errors in Inspector:

Code: [Select]
IndexOutOfRangeException: Array index is out of range.
tk2dSpriteAnimationEditor.DrawSpritePreview (Int32 collectionId, Int32 spriteId) (at Assets/TK2DROOT/tk2d/Sprites/Editor/tk2dSpriteAnimationEditor.cs:542)
tk2dSpriteAnimationEditor.OnInspectorGUI () (at Assets/TK2DROOT/tk2d/Sprites/Editor/tk2dSpriteAnimationEditor.cs:446)
UnityEditor.InspectorWindow.DrawEditors (Boolean isRepaintEvent, UnityEditor.Editor[] editors, Boolean eyeDropperDirty)
UnityEditor.InspectorWindow.OnGUI ()
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture)




unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Importing / Exporting between projects
« Reply #3 on: March 15, 2012, 01:00:42 pm »
Hi,

To create the package, you will need to select and export the sprite collection (and associated data files) explicitly. There is no way around this (apart from explicitly selecting the files as mentioned before), and I'll explain the reason.

The sprite object has a link to the sprite collection data object.

The sprite collection data object contains the geometry and other parameters, and links to the materials & atlas textures. There is an implicit link (using GUID) to the sprite collection editor object, which means that while the editor will be able to match this up again and find the source object, it will not show up in the dependencies.

The sprite collection editor object contains links to the actual source textures, and other bits of information which aren't relevant to the runtime. This is used in the editor, so if its actually missing, you will not be able to view the inspectors, etc. This can't be in the dependencies, as it will be included in builds (together with the source textures, etc which aren't necessary during the build)

So back to your original problem, you will need to explicitly select the sprite collection object (DemoSpriteCollection) in addition to the prefab as the dependencies system wont automatically pick it up.

Hope that helps,
unikron