Unity Media WordPress Plugin

For all of those people out there with a wordpress site and a will to show some unity content. Here’s your chance to shine…
You can use the plugin below to do exactly that, glad to be of assistance.

Unity Media Plugin

Unity Media Plugin allows you to upload various Unity Engine related files to your WordPress site. It also allows you to add a Unity Webplayer to your post.

Major features in Unity Media 1.0 are:

  • Uploading of FBX files, .unitypackages and .unity3d files
  • Inserting multiple webplayers into your posts

Download:

You can download my plugin here: u3dmedia.zip (878 downloads)

Quickstart:

1. Upload plugin zip to site
2. Activate plugin
3. You can now upload a .unity3d file
4. And place the following tag in a post to add a unity webplayer to it:

[UnityMedia src="<url of unity3d file>" width=550 height=344]

Let me know if you like this plugin or if you think it’s missing some important feature, your welcome to comment or donate so I can update it.

Unity Video Remake: Webcam Textures

A while back I posted something about video capture in Unity with a sad plea for beta access to version 3.5 which is now finally in public beta, so I decided to do a new post.

Setting up a Webcam Texture in Unity

Now as you may have seen in the Script Reference (the only place to actually find something about a WebcamTexture) there is no Object like a RenderTexture for a WebCamTexture which makes it a tad more harder to work with (read: not as easy to drag and drop in to materials).

Quickest way to get this working is to drop the following script on an object.

Checkout this script in action Webcam Example

Keep in mind that this in not the best way for multiple objects unless they all have the same material with the script on one object.
You can only have one WebCamTexture per webcam!

By the way.. Once 3.5 goes fully public I’ll put up a working example to give you a starting point, and so you can see yourself (if you have a camera connected of course) so keep an eye on my site 😉

If you’d like more help or a better example please donate any amount you wish and i’ll get to it..

Once you’ve got the camera running it’s possible to do all kinds of things.. I Look forward to the future of Webcams in Unity all over the internets. 😉

Issues: Cannot use web cam, since the user has not authorized this!

In your attempt at getting the webcam running you may have come across the following error: (I did at least)

Cannot use web cam, since the user has not authorized this!
UnityEngine.WebCamTexture:Play()

You can squash this little one by changing your build platform to Standalone Mac/PC. Go to Build Settings -> Select “PC and Mac Standalone” then click that little button at the bottom left “Switch Platform”, this, I think is something new.

The whole reason for this is because you probably have the Web player platform setup by default. This requires the user to first give permission to use their webcam because of privacy reasons. If you want to do this then you need to request the users permission by using the following piece of code:

IEnumerator Start()
{
yield return Application.RequestUserAuthorization(UserAuthorization.WebCam);
if(Application.HasUserAuthorization(UserAuthorization.WebCam)) Debug.Log("Authorized");
}

Same goes for UserAuthorization.Microphone. When you use a standalone platform the authorization is no longer needed.

Issues: The type or namespace name `WebCamTexture’ could not be found.

Thanks to solehome for commenting on this one. The public beta 3.5 seems to have an error when using WebCamTextures in Flash builds.
If you choose to build on a flash platform the following errors occurs:

error CS0246: The type or namespace name `WebCamTexture’ could not be found.

Are you missing a using directive or an assembly reference?

Error building Player because scripts had compiler errors
Solution to this problem… euhm dont build flash?

[ad]