Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Generating multiple object on changing transform
#1
Hi,
I was working in Unity 2018.2.20 and everything was going good. But then I converted my project in Unity 2018.4.0 because there were some animation issues in previous version of Unity. Now I am facing a strange issue when I change the transform of objects in any Generator, the Generator used to move all the objects' position but now it isn't. Instead it is creating new objects on my new provided position and keeping the previous objects still at old location. I have made prefabs of my tracks. Whenever I instantiate my prefabs or open them to modify them, Generators generate new multiple instances of all the game objects.
I am attaching a Screenshot for better understanding. Looking forward to hear from you soon.
Regards.
   
Reply
#2
Hi,
Please try the following, and if it doesn't work please send me a minimal copy of your project
  1. Make sure that all the meshes of your tracks are removed from your scene, then refresh the generator to create them again.
  2. Make sure that your Input Spline Path use the desired value for their Use Global Space option
  3. Make sure that the prefabs you instantiate have the correct parent in your scene hierarchy (the same than the object you made your prefab from)
Hope this helps
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#3
Hi,
Thanks for your response. I tried all these possible solutions but these are not working for me. Let me send you a copy of my track.
I will exclude the curvy package from it to make it of minimum size.
Reply
#4
Hi,
Your issue is caused by a restriction from the new Prefabs system, introduce in Unity 2018.3. If you look at the console, you will find the following two messages:
  • A message from Unity:
    InvalidOperationException: Destroying a GameObject inside a Prefab instance is not allowed
  • And a message from Curvy that gives more details:
    [Curvy] Error while trying to destroy the object 'Create GameObject_40_GameObject40_Pole000'. This is probably because that object is part of a prefab instance, and Unity 2018.3 and beyond forbid deleting such objects without breaking the prefab link. Please remove the corresponding object from the prefab and try the faulty operation again.
So, this happens because in your prefab you included objects generated by the Curvy Generator. When generating the new objects, Curvy tries to destroy the old ones, but Unity does not allow it to.
So the solution is to not include the generated objects in your prefab, which is the right thing to do anyway, to avoid having huge prefabs. Removing the generated objects from the prefab will make your prefab way lighter, from 18Mo to 0.3Mo.

I will send you via mail the cleaned prefab.

Have a nice day
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#5
Hi,
First of all, Thank you so much for your response.
Secondly, Yeah, the new Unity Prefab system, I wasn't aware of it much. The issue is I wasn't getting any message on my console while I was working (not sure if I had turned off messages or warnings at that time).
Actually I didn't know Curvy regenerates new objects and destroys the previous ones, I used to think it just changes the transforms of the generated objects, that's why I never thought of removing the generated objects from my prefabs.
You just made my life so easy. I was sick of these heavy prefabs. You solved my both problems.
Thanks again.
You too have a great day and I am having one.
Regards.
Reply
#6
Glad to read that Smile
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#7
Hello,
I came across issue with prefabs and curvy just now, and I dont quite get what this means:
(06-28-2019, 07:13 PM)_Aka_ Wrote: So the solution is to not include the generated objects in your prefab, which is the right thing to do anyway, to avoid having huge prefabs.

I tried removing the created mesh from the prefab(I just deleted the created mesh and then saved the prefab), but that results a multiple meshes when I run the game on Editor. What would be the correct way to do this so I dont end up with multiple duplicate generated meshes?

[Image: Sieppaa.PNG]
Reply
#8
As you might already know, the objects with blue names are part of the prefab, and with black names are not part of it.
So you already not include the generated mesh objects in the prefab, which is the right thing to do.

The sentence you are asking about:
"So the solution is to not include the generated objects in your prefab, which is the right thing to do anyway, to avoid having huge prefabs."
was said to a user which included all the generated objects in the prefab. In other words, all his objects had names in blue, which is not your case.
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#9
(08-22-2019, 02:39 PM)_Aka_ Wrote: As you might already know, the objects with blue names are part of the prefab, and with black names are not part of it.
So you already not include the generated mesh objects in the prefab, which is the right thing to do.

The sentence you are asking about:
"So the solution is to not include the generated objects in your prefab, which is the right thing to do anyway, to avoid having huge prefabs."
was said to a user which included all the generated objects in the prefab. In other words, all his objects had names in blue, which is not your case.

Yes I managed to remove the mesh from the prefab, but Curvy creates a new instance of the mesh everytime I run the game in the editor, resulting multiple useless meshes.

In the image you can see the Create Mesh_6_Mesh000 gameobject hasbeen created twice, first instance was created on the first time I pressed play, second on the second startup, first instance is not interactable. If I would start the game again a third instance would show up and so on.. How can I stop the the duplicate mesh creation/delete the earlier created mesh.
Reply
#10
Hi,
This should not happen. Can you send me the scene reproducing this issue so I can debug it?
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Best practice for mass-object instancing along 100km spline (railways) plus streaming bs@vectorvision.de 9 158 Yesterday, 11:49 AM
Last Post: teamteam
Information [Quick and dirty] Shape Extrusion: interpolate between multiple Crosses _Aka_ 9 2,610 09-02-2019, 09:42 PM
Last Post: _Aka_
Exclamation Need Help Stopping an Object at a ControlPoint DCalabrese 3 239 08-01-2019, 01:34 PM
Last Post: _Aka_
  Orient Spline to Object DanMarionette 1 305 06-11-2019, 05:56 PM
Last Post: _Aka_

Forum Jump: