Issue with GetSdkInstance();

0 favourites
  • 3 posts
From the Asset Store
Wind effect
$2.49 USD
Animated wind effect for objects, grass, trees, etc.
  • Hey all,

    So I've been having issues with some calls.

    For example, I see GetSdkInstance(); under behavior instance, in the manual, but when I call the function,

    this.GetSdkInstance();

    it doesn't work

    I have to do:

    this._inst.GetSdkInstance();

    I know _inst is supposed to be private, but I get an error when I do:

    this.GetInstance().GetSdkInstance();

    In both cases the error listed in the console is that there are no functions found.

    It must be said, I am a complete moron with js coming from c++ and c#, so this might be a simple noob mistake. is it supposed to be "self.whatever..." instead of this?

    Also, when making a call during the constructor, I get null for some of those. I expect that is because the order of initialization isn't guaranteed? But is there a place to call such things during creation that would be good for creating dependencies?

    Thanks a bunch!

  • It depends on the type of the thing that you call GetSdkInstance() on... and whether it's editor or runtime code. It's hard to tell from your post.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Sorry for the lack of clarity.

    I am working on behaviors, so this is all runtime side. It would be in instance.js. Now that you ask that, I am curious, I should probably be setting up that reference to at a different point? I've read the manual, but I'm still pretty shaky when it comes to the architecture the general flow that happens when objects are created, when the code gets accessed, etc...

    For my purposes, it is to set up cross communication between behaviors and other behaviors, or other plugins.

    This way I can use behaviors to create modular behaviors, with a "handler" behavior that ties them all together. Then, all I have to do in the editor is attach whatever behavior modules I want, attach the handler, and it all gets interfaced through the handler in event ACEs.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)