Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Resolved Adding a Public Function to an Event

Discussion in 'Scripting' started by RealDragonHours, Mar 4, 2021.

  1. RealDragonHours

    RealDragonHours

    Joined:
    Feb 7, 2021
    Posts:
    4
    Hi, I have a function from a script that I'm trying to add to an event from a different script. I've looked at some similar posts and had no luck there.
    This is the function:
    Code (CSharp):
    1. public void Onlanding ()
    2.     {
    3.         animator.SetBool("IsJumping", false);
    4.     }
    Screenshot of the event dropdown:
    QA.png
    Apologies if I've left something out or not shown something as I'm a first-time poster and new to unity.
    Thanks in advance for any responses

    EDIT [SOLVED]: It's fixed now. For whatever reason, Unity wasn't showing me some compiler errors in a different part of the script. After a restart and a few edits, it displayed the function in the dropdown where I expected it. Thanks for all responses so far.
     
    Last edited: Mar 4, 2021
  2. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,722
    Which script is the Onlanding function you shared here on?
     
  3. RealDragonHours

    RealDragonHours

    Joined:
    Feb 7, 2021
    Posts:
    4
    It's in the PlayerMovement Script
     
  4. LethalInjection

    LethalInjection

    Joined:
    Jan 25, 2015
    Posts:
    36
    can you confirm the class name and the name of the file containing "OnLanding" method is the same ?

    any errors in the console ?
     
  5. RealDragonHours

    RealDragonHours

    Joined:
    Feb 7, 2021
    Posts:
    4
    Not quite sure what you mean by class, sorry. I can tell you that all of the names/capitalization and similarities are all the same across everything. Also no, there are no errors in the console either.