Forum

This forum is for swapping tips or ideas with fellow users, suggesting new features, or showing of what you have created with the system etc, there is no guarantee of an answer to questions posted in the forum. All support questions must be submitted via the Support ticket system

Welcome Guest 

Show/Hide Header

Welcome Guest, posting in this forum requires registration.





Pages: [1] 2 3
Author Topic: conflicting morphs on instances of same prefab
creole
Newbie
Posts: 16
Permalink
Post conflicting morphs on instances of same prefab
on: December 29, 2012, 17:14
Quote

Hi

We need to instantiate several instances of the same prefab. The prefab has morphs. On the instances, the morphs don't always behave independently. Sometimes they do. Sometimes changing the mesh of one of the instances changes the mesh of all of the instances. Sometimes none of the meshes change, not even the one of the instance that's being morphed.

Using MegaCopyObject on the instances doesn't help.

Using Unity 4.0.0f7.

Is there a solution for this issue?

Thanks.

spookycat
Administrator
Posts: 148
Permalink
Post Re: conflicting morphs on instances of same prefab
on: December 29, 2012, 17:34
Quote

I am working on this, all was working fine in 3.5 and before, the prefab system in Unity was not designed to work with dynamic meshes so the connection between Unity and the mesh being worked on needs to be broken for it to work, the Mega Copy Object would do that in versions prior to 4.0 but something has changed so trying to figure out a full proper solution.

spookycat
Administrator
Posts: 148
Permalink
Post Re: conflicting morphs on instances of same prefab
on: January 3, 2013, 15:39
Quote

Hi There, we have been trying to recreate the issue but everything works as expected on this end, we copied the object using Mega Copy Object and we could morph that separately from the original, we also made a prefab from that and added it back into the scene and again that worked as expected, made a copy of that in the scene and again each could be morphed on its own. I did a quick video showing that in Unity 4.0.0f7 http://www.youtube.com/watch?v=8rgnF8j4jMc

creole
Newbie
Posts: 16
Permalink
Post Re: conflicting morphs on instances of same prefab
on: January 4, 2013, 20:19
Quote

Hi Chris, I tried to follow the video but it doesn't work for me. If I drag my imported model in the scene, add morphs to the top of the model's hierarchy and try to MegaCopyObject I get the following error:

NullReferenceException: Object reference not set to an instance of an object
MegaCopyObject.CopyMesh (UnityEngine.GameObject subject, .MegaModifyObject mod) (at Assets/Mega-Fiers/Scripts/MegaFiers/Utils/MegaCopyObject.cs:190)
MegaCopyObject.DoCopyObjects (UnityEngine.GameObject from) (at Assets/Mega-Fiers/Scripts/MegaFiers/Utils/MegaCopyObject.cs:347)
MegaCopyObjects.DoCopyObjects () (at Assets/Mega-Fiers/Editor/MegaFiers/MegaCopyObjects.cs:13)

However, if I add the morphs lower in the hierarchy (where the mesh renderer is) MegaCopyObject works but the morphs on the original and the copy don't behave independently. And if I apply CreateMegaPrefab on the copy I get this error message:

DisconnectPrefabInstance can only be called on prefab instances
UnityEditor.PrefabUtility:DisconnectPrefabInstance(Object)
MegaCopyObjects:DoCreateSimplePrefab() (at Assets/Mega-Fiers/Editor/MegaFiers/MegaCopyObjects.cs:35)

spookycat
Administrator
Posts: 148
Permalink
Post Re: conflicting morphs on instances of same prefab
on: January 4, 2013, 21:05
Quote

Are you using the latest version of MegaFiers?

creole
Newbie
Posts: 16
Permalink
Post Re: conflicting morphs on instances of same prefab
on: January 4, 2013, 21:15
Quote

Yes

spookycat
Administrator
Posts: 148
Permalink
Post Re: conflicting morphs on instances of same prefab
on: January 4, 2013, 21:18
Quote

Is your object a single object and are the MegaFier components attached to the object that have the meshrenderer?

creole
Newbie
Posts: 16
Permalink
Post Re: conflicting morphs on instances of same prefab
on: January 4, 2013, 21:32
Quote

The MegaFier components are attached to the object that has the (skinned) mesh renderer. But I'm not sure if it's a single object. It's something like this:

top level element (with character controller and some scripts attached to it)
-2nd level element (with Animator and some more scripts attached to it)
--3rd level element (beginning of the bone hierarchy)
---4th level element (hip)
----etc.
--3rd level element (with skinned mesh renderer and material and MegaModifyObject and MegaMorph)

spookycat
Administrator
Posts: 148
Permalink
Post Re: conflicting morphs on instances of same prefab
on: January 4, 2013, 21:40
Quote

Arr ok looking at the code it seems Copy Object is only expecting a Meshrenderer, I will update the code and submit a new version which should fix the problem for you, my test morph object was a normal mesh, sorry about that and thank you for finding the bug.

creole
Newbie
Posts: 16
Permalink
Post Re: conflicting morphs on instances of same prefab
on: January 4, 2013, 21:43
Quote

Thanks. Looking forward to the new version.

Pages: [1] 2 3
Mingle Forum by cartpauj
Version: 1.0.34 ; Page loaded in: 0.028 seconds.