"SendMessage() Between Components" video in Argon Assault not working


I’m in the “SendMessage() Between Components” video… and my send message does not work … the code on the collisionhandler.cs is

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CollisionHandler : MonoBehaviour


    // * CODE * //

    void OnTriggerEnter(Collider other)

    private void StartDeathSequence()
        print("player is dying");

and the method on playercontroller.cs

void OnPlayerDeath()  // RENAME WARNING called by string reference in CollisionHandler.cs
        print("controls frozen");

all i get is “player is dying” in the console, so the method StartDeathSequence is called but the message isn’t received on the player controller

I’m using 2019.3.9f

I’m able to move on with the course after much help in the discord, but this does not answer my question so please do not mark solved… I was told to use

        print("player is dying");

and that works for now so I can move on, but it’s not been taught yet… why didn’t SendMessage work?

Hi Heath,

OnPlayerDeath is/was not public. Maybe that was the problem?

The solution with GetComponent is perfectly fine. SendMessage should be used for prototyping only because its performance is subpar.

See also:

that was suggestion from the discord, but didn’t work. No one over there could see why the message wan’t being received? is this a 2019.3 bug?

To which game object are the CollisionHandler and the playercontroller script assigned? To the same?

I was not able to find a bug related to your problem in Unity’s issue tracker. If you cannot find a solution, I would suggest to report a bug to Unity via Help > Report a bug.

yes same game object… thanks for all your attention… doesn’t sound like anything on my end… is there a “Mystery” marking for a thread… or just solved?

If you sent a bug report to Unity, we could leave this thread open for a while, so you can post their answer here if you want. Otherwise, I could simply close this thread and leave it “unsolved”.

This topic was automatically closed after 2 days. New replies are no longer allowed.

Privacy & Terms