Group Group Group Group Group Group Group Group Group

Hero Script - error - Ch 3 - [Resolved by poster]

#1

I have just created the empty C# Hero script in Assets/Scripts.

The instruction is then to select MyHero in the Heirachy and drag the Hero script to it.

When I do that I get an error - “Can’t add script behaviour VisualContainerAsset. The script needs to derive from MonoBehaviour!”

Is there a simple error I am missing?

I have tried dragging the script to the Inspector but also get a different error.

#2

It’s ok - for some reason I had named it incorrectly in the first place and then renamed it. I realised I had the incorrect class ahem within the file. It now attaches correctly.

#3

hi @darthcolejoy,
glad you could resolve this. I am changing the title so that other readers do not get confused.

cheers,

Jayant