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?

3
  • Is it same as it is? https://answers.unity.com/questions/1501466/cant-add-script-cant-add-script-behaviour-visualco.html Commented Oct 19, 2018 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... Commented Oct 22, 2018 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. Commented Oct 22, 2018 at 17:14

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.