Jump to content

Prefab Corruption In-Game


xtom
 Share

Recommended Posts

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.

 

post-13640-0-86700300-1420397766_thumb.jpg

Check out my games: One More Day / Halloween Pumpkin Run

Link to comment
Share on other sites

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. sad.png

Check out my games: One More Day / Halloween Pumpkin Run

Link to comment
Share on other sites

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.

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

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.

Check out my games: One More Day / Halloween Pumpkin Run

Link to comment
Share on other sites

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.

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

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).

Link to comment
Share on other sites

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.

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

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.

Check out my games: One More Day / Halloween Pumpkin Run

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Check out my games: One More Day / Halloween Pumpkin Run

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...