StateMachineBehaviour not found into a dll since Unity 2017.2

Hello,

When a class inherits from StateMachineBehaviour into a dll, Unity 2017.2 doesn’t reference it. Does anyone encounter the same issue ? What should be my mistake ?

Steps to reproduce:

  • Create an Unity 2017.2 project.

  • Under Visual Studio 2017, create a C# Class Library (.NET Standard).

  • Set the target framework to .NET Framework 3.5

  • Add to references:

  • Unity-2017.2.0f3\Editor\Data\Managed\UnityEngine\UnityEngine.dll

  • Unity-2017.2.0f3\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.dll

  • Unity-2017.2.0f3\Editor\Data\Managed\UnityEngine\UnityEngine.AnimationModule.dll

  • Create a script that inherit from StateMachineBehaviour.

  • Build the solution and copy the dll into Assets folder of the Unity project.

  • Try to add as component the script into a StateMachine.

I tried to use Unity dlls from other folders without success and the issue is the same with UWP project or .NET Framework 4.6.

The attachment contains Unity project and VS solution.

3270905–252694–StateMachineBehaviourIssue.zip (250 KB)

Maybe you need to submit a bug report.

It’s already done but I hope for a quick solution or turn around.

I don’t suppose you’re running on a Mac do you? I’ve had numerous issues with it each time I create a new script or append a new namespace. I’ve had to restart VS and rebuild the project to get it to recognise everything.

No, indeed, I’m running on Windows 10.

I’m having the same problem… I also hope this problem will be resolved soon.

The workaround is to create a StateMachineBehaviour that inherits from the dll in Unity.

If you have a SMB named myNamespace.MyStateMachineBehaviour into a dll, you create a script named MyStateMachineBehaviour.cs inside Unity that contains:
public class MyStateMachineBehaviour : myNamespace.MyStateMachineBehaviour {}

The “joke” is that, according to the documentation, Unity never supports SMB into a dll. It’s a side effect that was “corrected” in the last version.

Extract of the documentation
Classes that derive from MonoBehaviour can be dragged onto Game Objects like ordinary scripts. Non-MonoBehaviour classes can be used directly from other scripts in the usual way.

I’m having the same problem with the version 2017.3.0f1.