Monkey Frog Studio Posted yesterday at 02:35 AM Posted yesterday at 02:35 AM I'm finding that prefabs aren't working quite as expected. I made a simple test. Numbers correspond to images attached. 1 - I created a simple map that contained one brush for the floor and the stock barrel object. The barrel is the child of the box brush. I then saved the map as a prefab. 2 - I started a new map and dragged in the prefab. Then I dragged in two more copies from the right-side panel for a total of three. Then I saved the map. 3 - I opened the original prefab file and moved the stock barrel model to a new position and saved it. 4 - I opened the previous map with the three instances of the prefab and the stock barrel model was not repositioned but maintained the original barrel position. To be sure, I exited the Leadwerks editor, restarted and re-loaded the same map. The barrel did not move. 5 - I opened the prefab file again and added a new barrel (one of my own custom models) and saved the prefab. Then I opened the map file with the three instances of the prefab. The first prefab I had originally placed showed the newly added barrel model. The original stock barrel model was still in its original position (i.e. it had not moved even though I had moved the barrel in the prefab). My expectation is that if I alter the original prefab that any map that references that prefab will update to those alterations when the map is opened in the Leadwerks editor. So far, this is not happening. Quote Creating professional 2D and 3D content is my passion! Monkey Frog Studio
mdgunn Posted 19 hours ago Posted 19 hours ago Did a little test. I agree prefabs do no update as expected. My case may be different (or the same, I don't know) as I am experiencing headaches with brushes and prefabs. About 100% of the time brush based prefabs do not update as I expect and I have to delete ALL old instances and put new copies in and they will look as I hoped the update would have made them look (but did not). Here is an image of what is about to be explained. Try the following 1) Create a box, anywhere EXCEPT the centre of the world. World centre would be stupidly convenient of course so we don't do that. 2) Save as prefab. Prefab will inherit the old world position which to me feels like it probably never what you want. 3) On the original map place the prefab some where else not at world centre. If it's a brush it won's sit on surface as you might hope but rather use the root object centre. To avoid this if I use brushes to define a base of pivot . I don't want to commit to moving to a 3D program yet brushes are just fine at this stage! The pivot then interferes with the ability to edit the brushes (have to move brushes out, edit, put back under pivot etc. super painful and prone to error). Anyways....next. 4) Enter prefab and add a box or other geometry to it. Will look fine in prefab. 5) In world the box will appear based on the location of the original item. If you didn't delete the prefab source the original prefab source will gain the new geometry and the ACTUAL prefab will appear to not gain the geometry because it's getting offset back to the position of the original. This feels like a SUPER weird and confusing situation to me. In the image you can see the red box and yellow box appearing over the original green box when in the prefab they were put over the green box. Odd because it LOOKS like the original got updated (which isn't itself even a prefab at this point) and the prefab appears not to be update but it did but the objects are updated back to the original world offset and not by their relationship to the geometry inside the prefab. Quote
Monkey Frog Studio Posted 2 hours ago Author Posted 2 hours ago I did further testing with prefabs, this time without using any brushes, but just models. I still ran into issues. This time, I brought in a barrel model and placed a single book on top of the barrel and saved it as a prefab. I started a new map and populated it with three of the barrel/book prefabs and saved. Then I opened the prefab and added a second, different book model and saved the prefab. When I opened the map file with the three instances of the prefab, only the first (initially placed) prefab was visible, but the second book had been properly added. The other two prefabs actually were there (you could see them in the scene editor), they just weren't visible in the Leadwerks' editor. However, selecting them in the scene editor and then moving them made them suddenly appear (see attached images). Quote Creating professional 2D and 3D content is my passion! Monkey Frog Studio
Monkey Frog Studio Posted 2 hours ago Author Posted 2 hours ago Did another test with the barrel and books. I moved the books (moved and rotated) and saved the prefab. Then I opened the test map that uses three instances of the prefab. Like in my previous post, the first barrel and books was visible while the second and third were invisible in the editor (see post above). Selecting and moving them made them visible again. However, the books were moved and rotated ONLY on the initially placed prefab (the one that's visible when the test map is opened). The other two prefab instances retained the original book orientation and position (see image). Quote Creating professional 2D and 3D content is my passion! Monkey Frog Studio
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.