Skip to content
This repository has been archived by the owner on Mar 5, 2021. It is now read-only.

Adding Behavior To Actor and then Changing Name of Behavior Script Causes Errors #134

Open
rtizzy opened this issue Aug 24, 2016 · 3 comments

Comments

@rtizzy
Copy link

rtizzy commented Aug 24, 2016

As described:

  1. Create an actor
  2. create a class
  3. add a behavior to the actor and assign the class
  4. Change the name of the class.
  5. Run the game and it will error out.

Removing the behavior and re-adding it will properly update the name of the class under the behavior tab. .

@elisee
Copy link
Contributor

elisee commented Aug 24, 2016

Hi and thanks for the report!

There can be multiple behavior classes per script so there's no reliable way to know that some text change in a script was a rename of a particular class.

In the long run, it would be nice to have support for intelligent TypeScript refactoring (press F2 to rename a class, etc.) and in that case, we could detect that the class is being renamed and update behavior components accordingly.

Another thing we've wanted to add at some point is to report errors such as a missing behavior class before running the game in an error pane, so that you don't have to discover those at runtime.

@rtizzy
Copy link
Author

rtizzy commented Aug 24, 2016

@elisee

Possible solution for at least this problem:

Make the panel where you assign behavior automatically refresh it's entire list (as if it was removed and re-added).

  1. On click determine if any files were changed.
  2. If files were changed check if there are new names and if all old names exist.
  3. Add new names remove old names that no longer exist.

@elisee
Copy link
Contributor

elisee commented Aug 24, 2016

The issue is not with the UI, we just can't equate a change in a script's text with a rename of a class. I've outlined a couple avenues for fixing this: either we could make an exception for scripts with a single behavior class in them, or we should implement TypeScript refactoring support.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants