Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Communication between script and solution's code ?

Discussion in 'Windows' started by namine, Sep 4, 2013.

  1. namine

    namine

    Joined:
    Mar 1, 2013
    Posts:
    21
    How can I call a method that I added in my exported solution from the Unity script ?
    Do I have to write a plugin for that, event if it's just pure C# ? Thanks !
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,719
    Hello. Unfortunately, it's currently impossible to do that at this time - unity script compiler knows nothing about your exported solution.

    However, there are 2 ways of making it work:

    1. Registering callbacks using delegates. You can add delegates to your scripts and you could set them in the exported visual studio solution. That way, when your scripts call those delegates, your method in the visual studio solution will be called.

    2. Compile the methods you want to call from Unity scripts to a separate .DLL file and place it under Assets/Plugins/Metro or Assets/Plugins/WP8 (depending on your platform of choice).
     
  3. namine

    namine

    Joined:
    Mar 1, 2013
    Posts:
    21
    Thanks Tautvydas I will try these methods