xtom Posted January 4, 2015 Share Posted January 4, 2015 I've attached a screenshot and some steps below which might help to reproduce.. I have created and saved a prefab object for my building I dragged in the prefab from the asset list and placed it in the scene I rotated it a bit At this stage if I run the game it's ok except for the step at the doorway flickers for some reason. Not on the original, just the second. Then I edit the original instance of the building and organise some stuff in the scene tree and save the prefab again to update it. Then when I run the game the second building is all corrupted looking as in the screenshot. Quote Check out my games: One More Day / Halloween Pumpkin Run Link to comment Share on other sites More sharing options...
xtom Posted January 5, 2015 Author Share Posted January 5, 2015 Just a follow up that this problem seems to happen when you re-organise objects in the scene tree and then save the prefab. I've also noticed that sometimes textures on placed prefabs can become stretched after you save a new version. The only way I can see to get by this problem is to delete any placed instances of the prefab and then place new ones in the scene which is a major pain to say the least. Quote Check out my games: One More Day / Halloween Pumpkin Run Link to comment Share on other sites More sharing options...
Josh Posted January 5, 2015 Share Posted January 5, 2015 This is expected. If you change the hierarchy of a prefab there is no way for the engine to guess what you meant to do when the hierarchy doesn't match what it expects. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
xtom Posted January 5, 2015 Author Share Posted January 5, 2015 Ok so I guess this means it's not a good idea to modify prefabs when you are in the middle of a project. That's a pity because I thought it would be useful if you had for example a town with 10 or so of the same buildings on a map and you could modify one and they would all update to newest version automatically. Quote Check out my games: One More Day / Halloween Pumpkin Run Link to comment Share on other sites More sharing options...
Josh Posted January 5, 2015 Share Posted January 5, 2015 The problem is what you are asking for has no definition. Prefab limbs are stored in the map file, and if you change the limbs, there is no way to tell what is supposed to be what. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Rick Posted January 5, 2015 Share Posted January 5, 2015 I'm confused by this. If I save a prefab I would expect the name of the prefab or some kind of ID to be stored with it and all instances of it so that if I make a modification to the base prefab file, it can search for all the other prefab instances that have that ID in my map and update them with the change I just made. If you modify the base prefab file and resave the entire idea is to update all instances of that prefab. We will never get our prefabs right the first time and design decisions change over time. If I have 50 of 1 prefab in my scene and I decided to add something to the prefab I don't want to readd those 50 prefabs. As long as I didn't break the link to any of those instances the link should still exist. That's the entire idea of the link right? To be able to track all instances already in the scene and update them when I update the base prefab file. I would think storing the base prefab filename inside all instances would be all you need to do this. When that file gets saved you go through the map (or on map open this would have to be checked) and look for any base entity that has this prefab name and compare/update all it's limbs according to the base prefab. Or better yet, when we resave a prefab file ask if we want to update all instances of this prefab in the current map (or we can select a map(s) we want this to happen in). Quote Link to comment Share on other sites More sharing options...
Josh Posted January 5, 2015 Share Posted January 5, 2015 I would expect the name of the prefab or some kind of ID Entity names are not unique to that entity; entities within a map can have the same name. Modeling programs do not have any kind of entity ID, they just save data in an FBX file. If the hierarchy changes, there is absolutely no way to identify which entity is supposed to correspond to which in the old structure. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
xtom Posted January 5, 2015 Author Share Posted January 5, 2015 What about storing the prefab file name in the map as a reference and then load in the freshest version of the prefab file whenever you load the map or compile the game? Quote Check out my games: One More Day / Halloween Pumpkin Run Link to comment Share on other sites More sharing options...
Josh Posted January 5, 2015 Share Posted January 5, 2015 It does store the prefab file name and load them from the file. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
xtom Posted January 5, 2015 Author Share Posted January 5, 2015 Ok this is really strange: So I placed in the new version of the prefab into the scene and save the map I go back to my other map and edit the prefab (just add a box on the roof) and save map, save/overwirte prefab I go back to my first map (the new updated prefab is shown in editor but is corrupt when run game) So then I place another of the same prefab again from the asset folder into the scene and run the game and now both the prefabs look ok! I think there is some strangeness going on. Quote Check out my games: One More Day / Halloween Pumpkin Run Link to comment Share on other sites More sharing options...
Rick Posted January 6, 2015 Share Posted January 6, 2015 Entity names are not unique to that entity; entities within a map can have the same name. Modeling programs do not have any kind of entity ID, they just save data in an FBX file. If the hierarchy changes, there is absolutely no way to identify which entity is supposed to correspond to which in the old structure. A prefab isn't an FBX file is it? I assume you aren't storing a prefab in the same format as an FBX file. So you can store a prefab however you want and do whatever you want with it. So if each instance of a prefab has the prefab filename in it, then when we save a prefab, you can loop over every prefab in the map and look for prefabs that have this prefab filename in it and update that instance to match the new prefab. Quote Link to comment Share on other sites More sharing options...
xtom Posted January 6, 2015 Author Share Posted January 6, 2015 Here is a video that shows the strange behaviour I'm getting... (notice how placing the a new copy of the prefab from the asset library seems to fix the corrupt copies) Quote Check out my games: One More Day / Halloween Pumpkin Run Link to comment Share on other sites More sharing options...
xtom Posted January 6, 2015 Author Share Posted January 6, 2015 Ok I found out how to reproduce the texture streaking issue I'm getting on my prefabs... 1) Create a box with texture and save it as a prefab 2) Bring the prefab into the scene from the asset library 3) Rotate the block by clicking the a Rotate toolbar button 4) Ctrl+Drag a copy of the prefab/block The copy ends up with a streaked texture. Quote Check out my games: One More Day / Halloween Pumpkin Run Link to comment Share on other sites More sharing options...
Ameshi Posted January 6, 2015 Share Posted January 6, 2015 Here is a video that shows the strange behaviour I'm getting... (notice how placing the a new copy of the prefab from the asset library seems to fix the corrupt copies) This is a serious problem, that than messup the entire project. I the team behind the engine looking at this issue? Quote Link to comment Share on other sites More sharing options...
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.