Behavior confusion error

Nomosoft

  • Posts: 122
If you delete a behavior, then create a new one, some wires seem to get crossed in StencylWorks.

Let's say "Behavior A" is attached to the actor "Player." Now, in the "Logic" tree, delete Behavior A. Reload the project (CTRL-R, not close/open), and you'll see that Behavior A has disappeared from Player's behavior page. Now, create "Behavior B" and attach it to another actor, "Enemy." Reload the project. You will see that Behavior A has reappeared on Player's behavior list. Behavior B is on Enemy's page, just as you'd expect. If you try to edit Behavior A, it will open Behavior B. If you close the game and re-open the project, "Behavior A" will have turned into "Behavior B" on Player's behavior page.

So, it seems that deleting a behavior, then creating a new one, causes the new behavior to occupy the same space in the project as the behavior you deleted. For the most part, this just causes Player to execute Behavior B, but I first stumbled onto this because I was getting an error about Type Coercion failing, and something having to do with BehaviorManager.as when I tried to test my project. I am not 100% sure, but I think the type coercion problem might come from deleting a scene behavior, then creating a player behavior (or vice-versa), because you then end up with a behavior attached to the wrong type of object.