I am doing the official tutorial “Survival shooter”. In chapter 6 “player health”, we have the following snippet at the end of PlayerHealth.cs:

public void RestartLevel()
{
    Application.LoadLevel(Application.loadedLevel);
}

Adding this function really confuses me. It is simply not explained in the video, it’s not in the official documentation, which I guess means this is a project specific function, but it’s totally hidden where is this called. I did a string search in the project folder and the only place where it can possibly be called is Assets/Models/Characters/Player.fbx.meta.

...

- serializedVersion: 16
      name: Death
      takeName: Take 001
      firstFrame: 525
      lastFrame: 650
      wrapMode: 0
      orientationOffsetY: 0
      level: 0
      cycleOffset: 0
      loop: 0
      loopTime: 0
      loopBlend: 0
      loopBlendOrientation: 0
      loopBlendPositionY: 0
      loopBlendPositionXZ: 0
      keepOriginalOrientation: 0
      keepOriginalPositionY: 1
      keepOriginalPositionXZ: 0
      heightFromFeet: 0
      mirror: 0
      bodyMask: 01000000010000000100000001000000010000000100000001000000010000000100000001000000010000000100000001000000
      curves: []
      events:
      - time: .997762918
        functionName: RestartLevel
        data: 
        objectReferenceParameter: {instanceID: 0}
        floatParameter: 0
        intParameter: 0
        messageOptions: 0

...

I tried to find this string everywhere in the inspector, but I couldn’t find it at all. What is this mysterious hidden way of specifying a string in a model file which calls the function defined in the cs script? Why is this not documented anywhere at all in the tutorial?

How can I see / edit the property of the model file where this function is called from?

When I remove the function from the cs script, I get the following error in console:

'Player' AnimationEvent 'RestartLevel' has no receiver! Are you missing a component?

Hi.
i can’t speak english, but i try to type in english.
using “google translate”…
i think that the RestartLevel()function is called by animation event.
if you go to project view - modles - characters and select player - animations tab in inspector, you can see to the “animation clip”( move, depth, idle)
if you select to death clip and drag your scroll to bottom of the inspector, you can see the “Event” panel.
there is downward-pointing arrow on right of Event panel.
if you click the arrow, Editing Animation event dialog is opened and,
RestartLevel() function is right there.

Hi
you will get the answer at chapter 7 , 8:12