AnyPortrait > Forum > How to Use

[Archive] Script error after prefab character is loaded

  • This topic has 0 replies, 1 voice, and was last updated 1 week, 1 day ago by Archive AccountArchive Account.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #1240
    Archive AccountArchive Account

      Q.

      I created a character as a Prefab and Instantiated it during the game.
      Then I called the animation play function (Play) targeting the apPortrait of the loaded character, but I got an error.

       

      A.

      AnyPortrait character script (apPortrait) goes through an initialization phase just before the first update when it is loaded.
      In this phase, the data inside is connected to each other and prepared to be executed.
      If you call a function of apPortrait (e.g. Play) before initialization, an error will occur.

      Normally, initialization is done automatically, so it is okay to call apPortrait’s functions in Update. However, in the following cases, functions may be called before initialization:

      – When calling apPortrait’s function in the Awake or Start function of an external script
      – When calling apPortrait’s function immediately after loading the character with “Instantiate”

      In this case, you need to wait until the next update frame or call the initialization function “Initialize()” directly.
      For more information, please refer to the following manual.

      https://rainyrizzle.github.io/en/AdvancedManual/AD_InitializeScript.html

      • This topic was modified 1 week, 1 day ago by Archive AccountArchive Account.
    Viewing 1 post (of 1 total)
    • You must be logged in to reply to this topic.
    Scroll to Top