[BUG] Serialized fields becoming unhooked

Quasimodem

New member
Hello, I've recently updated my project to Unity 2018.3 and Behavior Designer 1.6.1. Most things seem to be working smoothly, however I'm seeing some worrying behavior with serialized fields within my tasks becoming unhooked after editing the prefab they refer to.

For example, I have a custom Spawn action that takes a prefab to spawn:

1548447328239.png 1548447108435.png

I can drag a prefab ("Down" in this case) into that field, no problem. However, as soon as I edit the "Down" prefab (via the new 2018 nested prefab editor), that field suddenly becomes unhooked! And not just in this one action, but all Spawn actions everywhere. No good!

1548447400550.png

A few observations:
  • I've verified that Down's guid hasn't changed (which as far as I understand is how serialized references work).
  • Although the type of this field (in this case) is a SharedVariable<Entity>, it still becomes unhooked even if it's a normal Entity. However, if the field is of type GameObject, Transform, or other built-in Unity types, it correctly maintains its reference. There's nothing special I can see about Entity; it's just a regular-looking subclass of MonoBehaviour.
This seems like a pretty fundamental breakage here, makes me think there's something obvious I'm doing wrong. Thank you for any help you can provide!
 
Where is the Entity component located? Is it within the scene? If it's within the scene and you have a project level asset then you're going to have to fetch the value dynamically because of the way Unity works. Take a look at this page for more info: https://opsive.com/support/documentation/behavior-designer/referencing-scene-objects/

If the Entity is located on the prefab itself though that should work. In this case if you can list the steps to reproduce from a fresh project I can take a look.
 
Hey Justin, thanks for the reply. I was able to repro the problem with a new project

There's an external tree with a custom TestAction class that takes a reference to a TestComponent which should be pointing to the TestPrefab prefab. Life is good until you take TestPrefab into prefab edit mode and twiddle its value which causes the reference to suddenly become unhooked.

Let me know if there's anything else I can do to help solve this one!
 
Please do not directly link to the project as this is a public forum and not everyone has Behavior Designer. You can send the project to me via PM or email, or if you just include the prefabs/scenes that would also work.

I was able to reproduce the issue though and when the behavior tree loads the Unity object is null so there's no chance that Behavior Designer will be able to find it. I'll open a support ticket with Unity to see if this is a bug in Unity or if there's a different way to do it in Unity 2018.3.
 
Sorry about that! Was thinking it was a private forum.

Hopefully Unity's able to provide some insight, otherwise it might be back to 2017 for us. It's a pretty serious show-stopper...
 
FYI - The Unity team felt that they had fixed the issue in Unity 2018.3.6 addressed in the forum post that you provided Justin... However, I'm still having the issue described here.

Specifically with my enemy prefabs (named "Easy1", "Easy2", and "Easy3"), where a target is set to an instance of the player GameObject ("OverworldCharacter"), but the information is not kept in the Prefab once I move out of the prefab editing screen.

I've written and asked for assistance from the guy who has been working on the issue within the community, just this morning. If I hear back I'll post what I hear as well.
 
Top