Hello
How do I call a function in an event?
I created an event that describes the name of the function I want to call in Call Function, and loaded that event in Object.
This method didn't work, so please give me some advice.
Sincerely

image
image
  • You don't have an actor set up - your Call Function node image shows that there's a blank actor selected.

    Add an actor in the Event Settings node, it should be the game object that has your script attached. E.g. if it's on the same game object as the event, use the Object actor and enable Event Object.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Thank you for your reply.
    To add an actor, should I set it in the Set Player node of the attached screen?
    What is an actor's Object?
    Sorry to trouble you, but please tell me
    Sincerely
    image
  • In your Event Settings you can add "Object" Actors. Make a New Actor in the Event Settings and set it to be the Object you have your script attached to. You then can set it as the Target Object of your function in the drop down menu.
  • Does adding "Object" Actors match the red line in the image?
    Nothing can be selected from this list.
    Where should I set the selected Actor on the ork framework screen?
    Also, do I need to add a player for each scene in order to use Ork?
    For example, is it necessary to set to call again after a scene that does not operate the player?
    If you have a tutorial to help you better understand players and actors, please let me know.
    This may be a question due to lack of understanding of Unity, but thank you.
    Sincerely
    image
  • As said, select the Event Settings node, that's where you can set up actors for the event. Once there's an actor added, you can select something in the Actor popup in your Set Player node.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Sorry for the late reply.
    I finally understood from the explanation.
    I set the event like the attached screen.

    image

    image

    Another thing I would like to confirm is how to call this Event within the Scene.
    I set this Event to Object as attached, but it doesn't seem to start.
    Would you please tell me if there is an easy way?

    image
  • It will depend on the Start Type of your event interaction. You currently have it set to autostart so it should start automatically in the scene provided you have Ork initialized.

    Other options are in that list that allow you to start based on interacting with the object, entering a trigger, or you can even tie a variable to if the event will fire or not. Have you done the tutorial series? It definitely helps with all of the questions you have had.
  • Autostart events start when the scene is loaded - it might be that the player controls are blocked at that time, so enabling In Blocked Controls would ignore that.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Thank you for your reply.
    Thanks to that, I succeeded in calling function in event.

    It's different from the main subject, but please tell us about Check Game Variables Node.
    I set it like the attached image, but when I call it the second time, it will be the behavior of the failed route.
    I'm planning to set the Bool type to True in Change Game Variables, but is the setting method different?
    The variables are saved in the following order. Is there any mistake in the process?

    ①. Call Test Event1 of the image.
    ②. Save after calling.
    ③. Call the data saved in ②.

    Excuse me, but please tell me.

    image
    image
    image
  • Is the variable used anywhere else?
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • No, I'm using it only for this event.
  • edited April 22
    Ok, so if Test1 is false, it'll go the Failed route, calling your custom function.

    That looks correct to me, calling a 2nd time would in any case lead to the function being called again, since you set the variable to false afterwards as well.

    Also, not saving the variable (excluding it from save data) will have the variable be false (the default value for bool variables).

    Based on your setup, if you want the function call to not happen again, you need to set the variable to true and also save it with the save game.
    Post edited by gamingislove on
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Thank you for your reply
    I'm planning to save the variable Test1 in the save data, but isn't that the case?
    I'm thinking that I can save by entering the variable name in Save Settings. Is this wrong?
  • That depends on your setup - with the setup you posted you save all variables except for Test1 and Test2.
    So, just removing these 2 from the Save Settings will save all variables.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Thank you for your reply.
    I misunderstood that it would be saved by adding it.
    I was able to solve the problem as I was told.
Sign In or Register to comment.