Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

ScriptableObjects / Assets with dll in Unity5

Discussion in 'Scripting' started by iNoMore, Mar 8, 2015.

  1. iNoMore

    iNoMore

    Joined:
    Oct 13, 2013
    Posts:
    64
    Hi!

    I have a problem with unity5, that worked with unity4

    I created a plugin that uses ScriptableObjects to save the data
    When I use the c# files in unity, everything works fine, no errors, the asset reads my data script and everything is happy
    But when I build a dll with the files, and try ad direct the asset to read the script from there, it says that it cant load the script and I have to fix the errors. I dont have any errors shown on the console.
    It happens only with the dll, and the scripts are working fine when I try to access the functions from the dll

    I tried my old (Unity4.6) dlls, and I tried to rebuild them with the Unity5 dlls as reference, but I got the same result

    what have I missed?

    Thanks!
     
  2. Meta-tron

    Meta-tron

    Joined:
    Oct 22, 2015
    Posts:
    19
    Yes, exactly I have the same problem
     
  3. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,489
    I also have a plugin that saves data as ScriptableObjects and that class is defined in the DLL. I don't have any issues.

    Are you saying you cannot create the ScriptableObject after its been defined in the DLL, or are you saying your old ScriptableObjects that were created when the class was in a script broke when you moved the class to the DLL? Classes defined in a DLL have a different FileID than those created in scripts, so Unity cannot automatically rebuild the references. (You can do so by editing the prefab/asset file manually if using text-based serialization though.)
     
  4. Meta-tron

    Meta-tron

    Joined:
    Oct 22, 2015
    Posts:
    19
    I am saying that after I create a DLL, that the ScriptableObject created via the CreateInstance/CreateAsset from the DLL will consider it invalid next time I close Unity and try to reload it.
     
  5. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,489
    That definitely does not happen to me. My asset Rewired makes liberal use of ScriptableObject for storing all kinds of data. All of those classes are defined in a DLL. I've never seen this issue.

    Are you creating your DLLs with MonoDevelop, Visual Studio, or something else? What is the .Net/Mono target set to? I compile with VS, .NET 3.5.