I want to display "test" on the console when I click Plane (2) using Event trigger in unity (c #).

The problem i am experiencing

I completed the program and added an Event trigger to Plane (2).
I chose the script from the newly appeared tab.

However, the function could not be displayed where the function was put.

Error message



What I tried

When I clicked on the place where it was written as monosucript for trial, a field where new characters can be written
It was displayed, but I could not solve it even if I put a function in it.

Supplementary information

The version is from 2019.

  • Answer # 1

    I will answer assuming that the method "is not displayed" has been resolved.

    Drag and drop your object from the hierarchy to the target of EventTrigger and select the WASD class Event method.

    Strictly speaking, "where to choose the script" in the question is "where to select the target instance".
    What an instance is is an "thing" that exists in the scene.

    The object you dragged and dropped from the Project panel or selected in the Select Object panel does not yet exist in the scene. "A blueprint for the objects that may be present in the scene and the underlying concept".
    On the other hand, if you attach a script to a GameObject, it becomes an "thing" (= instance) that exists in the scene at that time.

    For example, if Plane (1) and (2) have WASD scripts respectively,
    "Plane (1) WASD" and "Plane (2) WASD" are "separate existence (= different instances)".
    As a general rule, the script will not work unless it is an instance.

    Since the target specification of EventTrigger is "which instance, which class, which method is called", the method can be correctly specified by specifying "Event method of WASD class of Plane (2) (= instance of self)". Will be called.

    * The concept of instance will continue to be essential in the future, so I think it will be easier to develop later if you investigate until you understand it.