unity activex control in windows forms

hi
i want to embed unity games in windows forms.
how can i do this
i tried to embed unity’s activex control (IE web player) but it told me that can not download the file.

Have the same problem. I need to embed in a (don’t laugh) Visual Basic app (for the many things the existing code provides, like talking to custom peripherals etc., and have Indie version).

I actually had this working for a brief time earlier this year, I swear I did. Then went with embedding an HTML control which loads a page which loads the player. But I want to go back to directly embedding the player on the form. Trying this today, I get the error. I don’t know what’s changed.

hi
HTML solution is not good for me because i want to use any DLL and work out of the internet’s sandbox and don’t want to have those security issues
i think just unity staff can answer us
if any other user want this we can make a feature request in feedback.unity3d.com

The work is being undertaken. You will see this in v2.6 The question is, when 2.6 will be available - hopefully before the end of this year.

I’m trying to embed Unity into my own ActiveX container, mainly as a test. While I can host most controls just fine, Unity3D crashes when I try to embed it, inside CAxHostWindow::OnInPlaceActivateEx() (which was called straight from Unity, which in turn was called from CAxHostWindow::CreateControl(), ending up calling OLEIVERB_INPLACEACTIVATE).

The crash is becaues CAxHostWindow turns around and gets a IOleInPlaceObject from Unity, which seems to go OK, but then it calls SetObjectRects() on it which crashes on the line of the call – possibly with a bad vtable or something.

Curiously, though, I can “Insert Control…” into the ActiveX Control Test Container application. Even more curiously, I’m just using a plain vanilla ATL CAxHostWindow-in-a-CFrameWindow setup.

Any other ActiveX control I’ve tried (Calendar, some ATL ones, QuickTime, etc) have worked just fine, so this seems like it could be a bug in the Unity3D ActiveX control. Any clues or help?

Guys,

Unity 2.6 is soon going to be ready as a release candidate, so will not be long before it arrives. (Would be good to have this shipped and in the hands of our customers before Unity '09, don’t you think? Otherwise we’ll get beaten up.)

I guess I have a few notes of caution to raise here.

  1. Our OCX used to work, and then somehow got broken. The 2.6 version can be embedded in a standalone application. However we do not recommend or support this approach. We are fixing this because it is reasonable to assume that an OCX can be embedded.

  2. The only way that your customers can get the OCX onto their machines is to download and install our webplayer.

  3. We test the webplayer in a large number of OS and browser combinations. We are not planning to add any tests beyond this.

Hope this helps,
Graham

Unity2.6 is out and I just tried but it’s still not working. My winform just displays static unity loading screen.
The release note explitly said it’s fixed but it’s still no go.

What’s am I doing wrong?
I’m setting src property of the activeX control to unity3d file generated for web.

Are there anything else I’m missing?
I waited for this feature for so long.
Please help.

Thanks.

What sort of deal is there that 2.6 fixes UT as ActiveX?
There isn’t any mention anywhere how to use it.
Can someone please help?

I’m including the source to see it yourself.
I’m referencing a unity file, example, c:\temp\island.unity3d but nothing happens.

Thanks for your help.

216349–7903–$unitywinform_486.zip (45 KB)

That is because the ocx is expecting a web server to feed it the unity3d file. Your best bet is to just embed a browser window and have it point to a page with the unity file on a web server.

The whole point of all this waiting is that 2.6 enables ActiveX be used in WinForm. There is big problem using it through browser and I won’t go into details. Please read 2.6 release note saying that ActiveX is enabled.

Well, you are definitely right, it is in the release notes and it is available as a COM component, and is easy to add to the VS tool box, and easy to add to a form, but setting the “src” to the unity3d file built from a web build does nothing, I have no clue how to use it or how it works, but as it is, you got me, took me all of 30 seconds to find it, set it up, add it to a form, all without any documentation on how to do any of that in visual studio 2008.

What I don’t get or understand, is what we need to do to have our program in it or pass values to and from it, can’t find that in any documentation. Good luck with that, maybe your enthusiasm will garner an answer on how to use the thing and where to find docs about it.

217517--7925--$unityactivex26_485.png

The point of 2.6 in relation to this and that was stated that its just that, was to ensure that the ActiveX webplayer works again as before 2.5.

It doesn’t offer any communication to the outside for this reason other than the website javascript ↔ unity webplayer communication as it isn’t designed for anything but the standalone, dashboard widget or webbuild.

Unity is not a rendering backend that you can put in another app to use for this purpose. This whole thing basically just happens to exist due to internet explorers “very not very secure” plugin system using ActiveX.

@dreamora

Yes I think it does, UnityWebPlayer ActiveX offers SendMessage() and Invoke() method for two way communication. Whether it will work as advertised or not is still in questions though since I can’t load unity file yet.

SendMessage IS the javascript way :slight_smile:
Invoke is likely nothing else than an expanded SendMessage that invokes a function without you having to do it in the called function.

What I meant was real communication and exposure in one or both directions

I think I read from G somewhere that they officially do not support this, so this could be why I can’t find any documentation on how to load a .unity3d file into the control or how to send messages to it or receive messages from it. Maybe if they added that to the documentation, you could use the thing, but since their is no offical documentation on how the thing works, there is no way to really figure it out. It is just a pretty box on a windows form.

Hello,
I am basically an Actionsscript 3.0 developer, and don’t really understand what you say. But the client says: “We want your Unity Bike game embeded in our c# forms, we need a dll to do so, or no money for you”;

So are there any kinda activeX “dll” file i can hand over to them? I don’t know how to use it, i need quick help!

And there is a way of embeding it using the webbrowser component, but can i actually send an EXIT massage to the hosting webpage? can i let the c# application know when the player has finished playing?