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

dll to source code

Discussion in 'Editor & General Support' started by atmuc, Sep 23, 2013.

  1. atmuc

    atmuc

    Joined:
    Feb 28, 2011
    Posts:
    1,125
    is it possible to remove a dll and place source code of this dll to a project? i have game objects in my project that uses a dll classes. when i
    create an empty scene,
    remove dll,
    place source code of this dll to the project,
    load scene

    my game object's script references lost. i can select source coded classes but i loose info in the game object script.

    how can i change to source code keeping serialized object data?
     
  2. atmuc

    atmuc

    Joined:
    Feb 28, 2011
    Posts:
    1,125
    Does unity keep script references in different way for source code and external dll? Even namespace and class name is the same it cannot match codes
     
  3. numberkruncher

    numberkruncher

    Joined:
    Feb 18, 2012
    Posts:
    953
  4. atmuc

    atmuc

    Joined:
    Feb 28, 2011
    Posts:
    1,125
    it could not set data of my script. i think it does not work for dll -> local script transfers.

    i set files as text serialization from Project Settings/Editor. i edit scene file manually. it fixes problem but it is not easy to edit many missing scripts.
     
  5. atmuc

    atmuc

    Joined:
    Feb 28, 2011
    Posts:
    1,125
    as i understand, unity generates a guid for each file. it generates it at the first time you import,create the file in your project. when you export and import packages files come with their guid. so the solution is to edit scene file. i find all references and replaced guid with the new one. and my project works now.
     
  6. xakzhong

    xakzhong

    Joined:
    Sep 25, 2014
    Posts:
    12
  7. thelocationlabdeveloper

    thelocationlabdeveloper

    Joined:
    Sep 8, 2020
    Posts:
    14
    Are you the author of DLLSwithcer? when i am trying to make dll of a specifc script, getting below error:

    BadImageFormatException
    System.Reflection.Assembly.LoadFrom (System.String assemblyFile) (at <fb001e01371b4adca20013e0ac763896>:0)
    DllSwitcher.initFileIDMappingTableOfDll (System.Boolean dllToSrc) (at <b41787182a834686a7e9a256f6bfab35>:0)
    DllSwitcher.replaceSriptReferenceOfAllScripts (System.Boolean dllToSrc) (at <b41787182a834686a7e9a256f6bfab35>:0)
    DllSwitcher.replaceSriptReference (System.Boolean dllToSrc) (at <b41787182a834686a7e9a256f6bfab35>:0)
    DllSwitcher.OnGUI () (at <b41787182a834686a7e9a256f6bfab35>:0)
    System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <fb001e01371b4adca20013e0ac763896>:0)
    Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <fb001e01371b4adca20013e0ac763896>:0)
    System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <fb001e01371b4adca20013e0ac763896>:0)
    UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at <d7545a46516941d4b2f2dec578cd41ee>:0)
    UnityEditor.HostView.Invoke (System.String methodName) (at <d7545a46516941d4b2f2dec578cd41ee>:0)
    UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition, UnityEngine.Rect viewRect) (at <d7545a46516941d4b2f2dec578cd41ee>:0)
    UnityEditor.DockArea.DrawView (UnityEngine.Rect viewRect, UnityEngine.Rect dockAreaRect) (at <d7545a46516941d4b2f2dec578cd41ee>:0)
    UnityEditor.DockArea.OldOnGUI () (at <d7545a46516941d4b2f2dec578cd41ee>:0)
    UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <a9183b39766a483caf86aaa926f3554c>:0)
    UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <a9183b39766a483caf86aaa926f3554c>:0)
    UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <a9183b39766a483caf86aaa926f3554c>:0)
    UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Boolean canAffectFocus) (at <a9183b39766a483caf86aaa926f3554c>:0)
    UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUI (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus) (at <a9183b39766a483caf86aaa926f3554c>:0)
    UnityEngine.UIElements.IMGUIContainer.HandleEvent (UnityEngine.UIElements.EventBase evt) (at <a9183b39766a483caf86aaa926f3554c>:0)
    UnityEngine.UIElements.CallbackEventHandler.HandleEventAtTargetPhase (UnityEngine.UIElements.EventBase evt) (at <a9183b39766a483caf86aaa926f3554c>:0)
    UnityEngine.UIElements.MouseCaptureDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <a9183b39766a483caf86aaa926f3554c>:0)
    UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, System.Boolean imguiEventIsInitiallyUsed) (at <a9183b39766a483caf86aaa926f3554c>:0)
    UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <a9183b39766a483caf86aaa926f3554c>:0)
    UnityEngine.UIElements.EventDispatcher.ProcessEventQueue () (at <a9183b39766a483caf86aaa926f3554c>:0)
    UnityEngine.UIElements.EventDispatcher.OpenGate () (at <a9183b39766a483caf86aaa926f3554c>:0)
    UnityEngine.UIElements.EventDispatcherGate.Dispose () (at <a9183b39766a483caf86aaa926f3554c>:0)
    UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <a9183b39766a483caf86aaa926f3554c>:0)
    UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at <a9183b39766a483caf86aaa926f3554c>:0)
    UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at <a9183b39766a483caf86aaa926f3554c>:0)
    UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at <a9183b39766a483caf86aaa926f3554c>:0)
    UnityEngine.UIElements.UIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <a9183b39766a483caf86aaa926f3554c>:0)
    UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <819de1aa368e45faa4f78e26c97c62b0>:0)