0

I created a C# plugin that uses event listeners and delegate, and now I have a Unity C# script which contains one event listener that I am trying to attach on to the main camera.

What I am trying to do is to get the camera frame data from a webcam, and using the event listener, set the main camera's texture accordingly to verify whether it is working properly or not.

When I drag the script to the main camera, it gives the error "Can't add script behaviour CallbackExecutor. The script needs to derive from MonoBehaviour!"

I already haveClass: Monobehaviour, so does that mean EventCallBacks cannot be used with Monobehaviour? If so, how should I go about this problem?

Taylor
  • 286
  • 4
  • 18
  • Is it same as it is? [https://answers.unity.com/questions/1501466/cant-add-script-cant-add-script-behaviour-visualco.html](https://answers.unity.com/questions/1501466/cant-add-script-cant-add-script-behaviour-visualco.html) – Noblight Oct 19 '18 at 22:27
  • No, it is not the same. All my scripts have no compile errors. Seems like Class:Monobehaviour isn't working too well with event handlers... – Taylor Oct 22 '18 at 13:52
  • Fixed it. It must be a bug within Unity. All the posts about class name being different from file name is incorrect for my case. After reopening Unity multiple times and waiting for a bit, it fixed on its own. – Taylor Oct 22 '18 at 17:14

0 Answers0