2D Toolkit Forum
2D Toolkit => Support => Topic started by: arvz on April 26, 2014, 04:38:24 pm
-
Hello,
Some of my tk2dsprites constantly stop being rendered in edit mode after pressing stop during play mode in the editor - though they are still there - you can still click on it, and the collider borders appear, but the sprites are invisible. They do appear in play mode, and will reappear if I recommit the sprite collection - but they disappear again after I finish running the game.
This seems to only happen to a couple of sprites, there are other sprites in the scene from the same sprite collection that is not problematic at all.
Edit: I seem to have fixed it by deleting the sprites and readding them again, but I feel like it could happen again in the future
Any ideas what it could be?
-
It shouldn't do this. This only happens when something has broken with the collection.
If it ever happens again, please post a repro case so I can work out why its happening.
-
Posted in the other thread, but gonna post here as well. This happens to me also. Some sprites, re-adding them temporarily fixes it. Seems to be because of the prefab it's connected to.
-
The same thing keeps happening to me. I noticed that when the sprite will not show in edit mode, the Mesh Filter component in the Inspector shows "Missing (Mesh)" for the Mesh drag-and-drop box. But when the sprite appears again, the drag-and-drop box shows a symbol for the mesh as it should. I don't know why it would be doing this seemingly randomly. I'm using a Mac by the way.
-
Can you create a prepro for this? The last time I saw a repro for this, Unity was being very naughty and overriding values on the sprite from the prefab AFTER OnEnable / Awake / Start were called. Unity seems to get into this state, its not reproducible on normal projects - I'd be interested in finding out why it happens.
-
This is happening to me too. I just updated to Unity 4.5.2, it doesn't happen in Unity 4.3. I'm going to have to roll back to Unity 4.3 because some sprites are missing and the "Mesh Filter" says "None" only on the missing sprites. If I change any sprite property, the sprite shows up again until I press the run button. Pressing the run button make the sprites disappear again.
Everything works fine if I create a standalone build. The problem only shows up in the editor.
-
This is really annoying, it looks like they may have changed how prefabs work again :( I can't reproduce this specific issue though, can you create a repro?
-
+1 here too. Only started happening since the update
-
Please post a repro for this.
-
Hey so I was having the same exact problem and I finally figured out how to repro it. I just tried it multiple times, exactly as written below, and it worked every time.
Unity 4.5.2f1 (pro)
2D Toolkit 2.4.0
Mac OSX 10.9.3
2013 27" iMac
- Create a new project
- Import 2D toolkit
- Delete Main Camera
- Create a tk2dcamera from the Create dropdown in the Hierarchy
- Import a texture (I just imported a white square png)
- Create a new Sprite Collection
- Set the Sprite Collection Physics Engine type as Physics 2D
- Add your imported texture to the collection
- Set the sprite's collider type as Polygon
- Commit Sprite Collection
- Create new tk2dSprite in scene using the Create dropdown in the Hierarchy, and set it to the sprite you created
- Drag the sprite in the scene to the Assets folder to create a prefab of it
- Open the Sprite Collection editor and commit it again
- Press play, then stop
- Sprite disappears from scene in edit mode
Please let me know if you're able to repro!
-
Sorry, I can't reproduce this issue following the steps above - almost identical specs, apart from I'm running on a 2013 Macbook Pro. can you zip up the project and send it my way when its broken?
-
Oops, didn't see that you had responded, sorry. Yeah here you go. [removed link]
-
So in this example, it draws the sprite when you've pressed play but is invisible in the editor?
This is because of that change to the prefab system I mentioned before. I can add a "rebuild all sprites" button in Unity to have them draw in scene view, if that will help?
-
A "rebuild all sprites" button would be great. Ideally, the way prefabs are handled would be fixed, but I understand that may not be possible. A button to rebuild sprites would be a wonderful temporary solution. Thanks!
-
I just wanted to add that I'm seeing, what I think is, exactly the same problem after upgrading from Unity 4.3 to 4.5.4. The Mesh Filter and the Material get set to "None" on random sprites in my scene. Playing the scene in the editor sometimes makes those reappear, but also often breaks others. The sprites all appear to be fine when running on an iPhone.
Has there been any movement on this issue? Did the "Rebuild All Sprites" button make it into any 2dtk 2.5.x beta release?
-
Sorry no, I totally forgot to add it to the trello which I have now.
Add this to tk2dEditorUtility.cs to add the menu option
[MenuItem(tk2dMenu.root + "Rebuild All Sprites", false, 10280)]
static void RebuildAllSprites() {
tk2dBaseSprite[] allSprites = Object.FindObjectsOfType(typeof(tk2dBaseSprite)) as tk2dBaseSprite[];
tk2dTextMesh[] allTextMeshes = Object.FindObjectsOfType(typeof(tk2dTextMesh)) as tk2dTextMesh[];
tk2dStaticSpriteBatcher[] allBatchers = Object.FindObjectsOfType(typeof(tk2dStaticSpriteBatcher)) as tk2dStaticSpriteBatcher[];
foreach (var t in allSprites) { t.ForceBuild(); }
foreach (var t in allTextMeshes) { t.ForceBuild(); }
foreach (var t in allBatchers) { t.ForceBuild(); }
}
-
Much thanks for that menu fix!
Are there any plans to make a "proper" fix, that won't require using this menu tool?
-
Hi,
This doesn't happen for everyone, its because of what Unity have changed in their prefab system. Not sure if its a bug or not, to be honest.
In any case, I can think of a few workarounds to this, but I'd rather not implement them in the event Unity fixes it or reverts behaviour. Just waiting to see what happens in the next version.
-
Im facing this issue on 4.6.0f1 after upgraded to FullInspector 2.5. I use the Rebuild sprites and it work but i have to do it each time i getting back in the scene from play mode. (Back in EditMode)
Probably nothing to do with FullInspector 2.5 but when i upgraded it look like to have triggered something in Unity which make prefab revert to MeshFilter = None each time which is rather strange.
Any ideas to fix this ? Any possible workarounds ?
-
Try this - http://2dtoolkit.com/forum/index.php/topic,4744.0.html