Object does not match target type

Announcements, support questions, and discussion for the Dialogue System.
njg
Posts: 14
Joined: Thu Feb 12, 2015 3:10 pm

Re: Object does not match target type

Post by njg »

An Update:

Whilst driving through the pouring rain to pick my wife up from work I had an ephipany strike me square in the forehead. I have two characters sharing the same script registering the same function. Could this be the cause of the problem? After a day spent shopping I got back to the computer and removed the script component from one of the NPCs. Lo and behold everything started working again and I was happy.

Seriously, It appears that characters cannot share lua conversation scripts, however you want to phrase it as bad things happen, and I had a sub scene in the scenario with a pair of witches where it made logical sense to share, but its not doable.

Mark this one closed,

thanks for your time,

Nick
User avatar
Tony Li
Posts: 21636
Joined: Thu Jul 18, 2013 1:27 pm

Re: Object does not match target type

Post by Tony Li »

Nick,

I'm glad you got this one solved! I'll add this restriction to the documentation and highlight it. The next version will also log a warning if you try to register a function name that's already registered.

In your case, can you register the function just once and define it in a way that you can use it for all characters? I like to put my Lua functions in a script on the Dialogue Manager GameObject. Once it's registered the function, it's available for all characters to use.

To answer your question about NLua, it requires Unity 4 Pro or Unity 5 because it's written in C++. Unity 4 free doesn't allow you to invoke C++ code.
Post Reply