Get object in custom script

Slate Forums Support Get object in custom script

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #2064
    tsorapa
    Participant

    Hi!

     

    Because custom scripts are not from monobehaviours I cannot use Start() to get GameObjects.

    Is there an other way ?

     

    Thanks.

     

    Regards.

    #2065
    Gavalakis
    Keymaster

    Hello there,

    You can override and use the OnInitialize method in your custom ActionClip.

    Notice that you need to return true or false (usually true). True if the initialization was successful, or false if it was not.
    OnInitialize is called when the cutscene is initialized

    Another way would of course be to do things you want to do in the OnEnter override, which is called every time the ActionClip is entered.

    Let me know if that works for you.

    Join us on Discord: https://discord.gg/97q2Rjh

    #2066
    tsorapa
    Participant

    Hi,

     

    Thanks very much it is working.

    I used the code this way : protected override bool  OnInitialize()

    I think OnInitialize is missing in the documentation.

    Yes I could use OnEnter but is it not better to get path at the begining to call it further ?

     

    Regards.

    #2067
    Gavalakis
    Keymaster

    Hello again,

    Indeed. I have now just added this in the documentation page.
    Yes, it would be better to use OnInitilize if you only want to do something once when the cutscene initializes. OnEnter would be more adequete if you want to do that every time the clip is entered of course. So it depends on the use case 🙂

    Thanks!

    Join us on Discord: https://discord.gg/97q2Rjh

    #2068
    tsorapa
    Participant

    Hi,

    Thanks for your help.

    Regards.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.