Unity in a WindowsFormsApplication


i would like to insert the unity webplayer inside a .net C# project with Visual Studio exactly like Zumwalt did here : http://forum.unity3d.com/threads/108...ty-in-a-Window or http://forum.unity3d.com/threads/820...bleContextMenu

i’ve managed to insert the ActiveX Unity Web player inside a usercontrol without any problem . I use the Dll (AxInterop.UnityWebPlayerAXLib.dll,Interop.UnityWe bPlayerAXLib.dll)

I also manage to use the OnExternalCall and SendMessage functions to interact between Unity and a C# project.

However i can’t find the way to send the parameter “disableContextMenu” to my ActiveX and this is my only problem

has anybody have any idea about it ?

My VS solution :
link text

thank you


Do you have managed to disable the ContextMenu of the activeX ?
I’m faced with the same problem.


No, unfortunately I have not found.
I went on another solution is to embed a browser directly into my .net project.

I think I’ll do it also but how did you manage your OnExternalCall and SendMessage, through Javascript ?

Yes, through Javascript.

in c# Add :

webBrowser.ObjectForScripting = NameOfClass;

[PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
public class NameOfClass
     public void test()
          Object[] Obj = new Object[1];
          Obj[0] = "ObjectToSend";
          webBrowser.InvokeScript("nameOfJavascriptFunction", Obj);

If you want to set a parameter into disableContextMenu property in ActiveX Unity Web player, you need to prepare IPropertyBag.Read Method in your program (http://msdn.microsoft.com/ja-jp/library/microsoft.visualstudio.ole.interop.ipropertybag.read.aspx).

I made a sample C++ program (Visual Studio 2010) which set “true” parameter into disableContextMenu property. See http://www.nibiirosoft.com/download/UnityActiveXSample.zip

And using that codes, I made a player for .unity3d files (http://www.nibiirosoft.com/Product/UniPlayer_en.html).

I hope it will be helpful to you.

Thanks for the trick.

I’ve done a workaround with Message Filters but your solution is far better.
I’ll try to do it in C#.