AS-> FBX -> Unity BUGSSSSSS

General Moho topics.

Moderators: Víctor Paredes, Belgarath, slowtiger

zsolt67
Posts: 13
Joined: Wed Jun 08, 2016 9:41 pm

AS-> FBX -> Unity BUGSSSSSS

Post by zsolt67 »

I just had enough
We spent a week to make it right.
We tried almost all possibilities and their permutation believe in the marketing this should work
Situation is very simple one character and a simple animation with eye blinking mouth yawning.
We never got a perfect animation in Unity
We tried group layers, switch layers, smart bones, without bones every imaginable setup.
All kind of problems comes up in unity. Can see eye, Open and closed eye visible togehter, wrong z order. etc etc etc
We use the unity importer script
You can download our test from here: https://drive.google.com/file/d/0B_pXC7 ... sp=sharing

Is anyone here the AS-> FBX -> Unity scenario ever worked?
dkwroot
Posts: 677
Joined: Thu May 02, 2013 6:56 am
Location: USA
Contact:

Re: AS-> FBX -> Unity BUGSSSSSS

Post by dkwroot »

Are you using the unity importer script? The newest one, I mean.
zsolt67
Posts: 13
Joined: Wed Jun 08, 2016 9:41 pm

Re: AS-> FBX -> Unity BUGSSSSSS

Post by zsolt67 »

I dont know which one is the last one, I use this: (the date of the file is 10 Nov 2015)

Code: Select all

using UnityEngine;
using UnityEditor;
using System;

public class AnimeStudioPostProcessor : AssetPostprocessor
{
	private bool fIsAnimeStudioModel = false;

	void OnPreprocessModel()
	{
		fIsAnimeStudioModel = false;
		// resampleRotations only became part of Unity as of version 5.3.
		// If you're using an older version of Unity, comment out the following block of code.
		// Set resampleRotations to false to fix the "bouncy" handling of constant interpolation keyframes.
		try
		{
			var importer = assetImporter as ModelImporter;
			importer.resampleRotations = false;
		}
		catch
		{
		}
	}

	void OnPostprocessGameObjectWithUserProperties(GameObject g, string[] names, System.Object[] values)
	{
		// Only operate on FBX files
		if (assetPath.IndexOf(".fbx") == -1)
		{
			return;
		}

		for (int i = 0; i < names.Length; i++)
		{
			if (names[i] == "ASP_FBX")
			{
				fIsAnimeStudioModel = true; // at least some part of this comes from Anime Studio
				break;
			}
		}
	}

	void OnPostprocessModel(GameObject g)
	{
		// Only operate on FBX files
		if (assetPath.IndexOf(".fbx") == -1)
		{
			return;
		}

		if (!fIsAnimeStudioModel)
		{
			//Debug.Log("*** Not Anime Studio ***");
			return;
		}

		Shader shader = Shader.Find("Sprites/Default");
		if (shader == null)
			return;

		Renderer[] renderers = g.GetComponentsInChildren<Renderer>();
		int straightRenderOrder = shader.renderQueue;
		foreach (Renderer r in renderers)
		{
			int renderOrder = straightRenderOrder;
			if (r.name.Contains("|"))
			{
				string[] stringSeparators = new string[] {"|"};
				string[] parts = r.name.Split(stringSeparators, StringSplitOptions.None);
				int j;
				if (Int32.TryParse(parts[parts.Length - 1], out j))
					renderOrder += j;
			}
			r.sharedMaterial.shader = shader; // apply an unlit shader
			r.sharedMaterial.renderQueue = renderOrder; // set a fixed render order
			straightRenderOrder++;
		}
	}
}
rave
Posts: 48
Joined: Sun Mar 20, 2005 8:44 pm

Re: AS-> FBX -> Unity BUGSSSSSS

Post by rave »

Hi,
I have the same problem:

Does anyone know, where you can obtain the current script?
Which is the current version?

Thank you
User avatar
Lukas
Posts: 1296
Joined: Fri Apr 09, 2010 9:00 am
Location: Netherlands
Contact:

Re: AS-> FBX -> Unity BUGSSSSSS

Post by Lukas »

Make sure you have the latest version of ASP, and create a custom content folder. Inside the custom content folder will be a folder called "Extra Files" where you'll find the latest script.

Not sure what the latest version is as there's no version number noted anywhere in the script.
zsolt67
Posts: 13
Joined: Wed Jun 08, 2016 9:41 pm

Re: AS-> FBX -> Unity BUGSSSSSS

Post by zsolt67 »

Just doesnt work
Please somebody who has real practice not just ideas write here
After a week and 245 try I gave up. THIS IS NOT WORKING AND ANIME STUDIO SHOULD FINISH ADVERTISING THIS FEATURE!!!
rave
Posts: 48
Joined: Sun Mar 20, 2005 8:44 pm

Re: AS-> FBX -> Unity BUGSSSSSS

Post by rave »

Yes, thank you for the tip. I think, it tworks on my pc.

@zsolt67
Can you show some screenshots from unity?
What's the problem in unity?

Greetings
zsolt67
Posts: 13
Joined: Wed Jun 08, 2016 9:41 pm

Re: AS-> FBX -> Unity BUGSSSSSS

Post by zsolt67 »

What works on your pc? The imported file works like the the boar parts in good Z order the blinking eye blinking open,close, open and yawning with streching mouse?
Can you please send it on captured video.
If really works for you could you please send your unity importer script to compare
zsolt67
Posts: 13
Joined: Wed Jun 08, 2016 9:41 pm

Re: AS-> FBX -> Unity BUGSSSSSS

Post by zsolt67 »

here is the video of unity result. Z order not ok. https://drive.google.com/file/d/0B_pXC7 ... sp=sharing
As I said before we tried almost all possible setup, modification trick EVERYTHING. if we can repair Z order problem, the two status of eye visible same time. I we modify something and that problem disappear other comes up.
dkwroot
Posts: 677
Joined: Thu May 02, 2013 6:56 am
Location: USA
Contact:

Re: AS-> FBX -> Unity BUGSSSSSS

Post by dkwroot »

Are you using Unity 5.3?
dkwroot
Posts: 677
Joined: Thu May 02, 2013 6:56 am
Location: USA
Contact:

Re: AS-> FBX -> Unity BUGSSSSSS

Post by dkwroot »

Unity importer works fine for me. Here are some steps:

In Unity Assets folder, create a folder titled: "Editor" and place the Anime Studio import script inside of it. Restart Unity.

Import your FBX file. That's all there is too it.

In Anime Studio, make sure you aren't using the Z axis to order your image layers and keep everything flat.
zsolt67
Posts: 13
Joined: Wed Jun 08, 2016 9:41 pm

Re: AS-> FBX -> Unity BUGSSSSSS

Post by zsolt67 »

Newest free unity.
Can you please capture the video. Atube catcher is a free program to capture video from screen
zsolt67
Posts: 13
Joined: Wed Jun 08, 2016 9:41 pm

Re: AS-> FBX -> Unity BUGSSSSSS

Post by zsolt67 »

Anyone?
User avatar
synthsin75
Posts: 9968
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: AS-> FBX -> Unity BUGSSSSSS

Post by synthsin75 »

He gave you instructions. Have you tried them for yourself?
dkwroot
Posts: 677
Joined: Thu May 02, 2013 6:56 am
Location: USA
Contact:

Re: AS-> FBX -> Unity BUGSSSSSS

Post by dkwroot »



I made an easy to follow tutorial. I'm using Unity 5.3.5 and AS 11.2
Post Reply