Why doesn't "Export Package..." export this class?

Hello

When exporting a Scene the “Export Package…” fails to export a file.

How can I export it automatically? Aka without being obliged to remember to select it manually.

Unity seems not to detect the dependency which is only referenced in another script with:

mEntity.SetBehaviour(new SteeringBehaviour());

This class is in a file SteeringBehaviour.cs

using UnityEngine;
using System.Collections;

public class SteeringBehaviour : IBehaviour
{
 ...
}

Note that SteeringBehaviour.cs doesn’t contain a script (doesn’t inherit from Monobehavior) it only contains this class.

Thanks

monobehaviours are never generated through new but by adding them to a game object. the valid reference will be the return of that AddComponent call.

as for the dependency: there is none out of unitys view as it is nowhere assigned. Pure script → script dependencies are basically “your task to remember”. (in the build it has no impact cause all code is present there)

Mh… your are just describing what I said… which doesn’t help to find a solution :wink:

The script compiler/parser knows how to find the dependencies (obviously). If no files contains a SteeringBehavior class the compiler will complain.
Hence it seems logical that the “export” uses a similar method to find the dependencies.

Wouldn’t you think it would be useful to make a feature request?

there is no script compiler.
Thats the .NET compiler and it knows that it isn’t around because all scripts are compiled into .NET assemblies and during that it can say if it is there or not.
Its not like it will detect that it is there or not.

Code unlike assets are not checked if they are used or not as it is due to reflection totally impossible to get any kind of relation out of the code.

Yes and no.

I can understand that Unity doesn’t have a “code dependencies tree” somewhere internally but it isn’t impossible to add. Quick search:

C# http://dependencyfinder.codeplex.com/Wikipage
Java http://depfind.sourceforge.net/

As the class I mentioned is required for the scene to work it seems logical that the export method be able to detect it as a dependency for the exported scene.

Granted it might require some work to do (if no preexisting tool exist) but it would make the exporting more logical imo.