Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BehaviorInstance ConsoleMethods are unreachable #231

Open
capnlove opened this issue Jul 16, 2014 · 3 comments
Open

BehaviorInstance ConsoleMethods are unreachable #231

capnlove opened this issue Jul 16, 2014 · 3 comments

Comments

@capnlove
Copy link
Contributor

The function getTemplateName in file
\engine\source\component\behaviors\behaviorInstance_ScriptBinding.h
cannot be reached by script.

When called on a valid BehaviorInstace, it outputs the following error to console

"Unknown command getTemplateName"

One way to circumvent this is simply to call BehaviorInstance.template, which happily gives us the name of its template.

I suspect that this has something to do with the way Behaviors are created but this is beyond my comprehension.

I would suggest simply removing the associated ScriptBindings as the simplest solution.

@lilligreen
Copy link
Contributor

I discovered this as well while working on the behavior connection fix in 3.0.

http://www.garagegames.com/community/forums/viewthread/136971

In order for the instance to have access to all the TorqueScript functions you write for the template, it gets the template namespace assigned to it in the instances' C++ onAdd method. This has the negative side effect of removing all access to the BehaviorInstance ConsoleMethods, you get the BehaviorTemplate ConsoleMethods instead.

Would be nice to get more feedback from the community if the solution is to just get rid of any BehaviorInstance ConsoleMethods as you suggested or figure out a way to inherit namespaces better.

@greenfire27
Copy link
Contributor

Won't that also have the unpleasant side effect of causing the game to crash if somebody calls one of the BehaviorTemplate ConsoleMethods on a BehaviorInstance? This definitely needs to be rethought.

@chaigler
Copy link
Contributor

chaigler commented Dec 4, 2015

What if BehaviorInstance set its superClass to the BehaviorTemplate instead? The console should then link the BehaviorInstance to the BehaviorTemplate methods as well as any methods defined within the BehaviorInstance class' namespace.

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

No branches or pull requests

4 participants