cant pass parameter to the listener
[System.Serializable]
public class EventGameObject : UnityEvent<GameObject> { }
[CreateAssetMenu]
public class GameObjectEvent : ScriptableObject
{
private readonly List<GameObjectEventListener> eventListeners =
new List<GameObjectEventListener>();
public void Raise(GameObject go)
{
for (int i = eventListeners.Count - 1; i >= 0; i--)
eventListeners[i].OnEventRaised(go);
}
public void RegisterListener(GameObjectEventListener listener)
{
if (!eventListeners.Contains(listener))
eventListeners.Add(listener);
}
public void UnregisterListener(GameObjectEventListener listener)
{
if (eventListeners.Contains(listener))
eventListeners.Remove(listener);
}
}
public class GameObjectEventListener : MonoBehaviour
{
[Tooltip("Event to register with.")]
public GameObjectEvent Event;
[Tooltip("Response to invoke when Event is raised.")]
public EventGameObject Response;
private void OnEnable()
{
Event.RegisterListener(this);
}
private void OnDisable()
{
Event.UnregisterListener(this);
}
public void OnEventRaised(GameObject go)
{
Response.Invoke(go);
}
}
>>>>gameObject X<<<<
public class AIController : MonoBehaviour
{
public EventGameObject OnAIDeath;
private void Start()
{
OnAIDeath.Invoke(gameObject);
}
}
>>>>gameObject Y<<<<
public class SceneMapController : MonoBehaviour
{
public void OnAIDeath(GameObject entityGO)
{
Debug.Log(entityGO);
}
}
GameObjectEventListener is on a SceneManager gameobject , when I drag the Scriptableobject Event on the event slot i want to use as listener SceneMapController script and run method OnAiDeath using the gameobject parameter from AIController(which is a script on another gameobject) invoke(gameObject) (check image)
Short explanation: when gameObject X dies with AIController script, i want to pass the gameObject(which died) to a listener from gameObject Y and use the gameObject received in a script function.
What I'm doing wrong?I get this error please help Unsupported type EventGameObject https://i.sstatic.net/8btOv.jpg Most code is from here: https://www.youtube.com/watch?v=raQ3iHhE_Kk&t=2325s

