First Unity-based Windows screensaver

I have a working Unity-based screensaver running on Windows, complete with a proper preview window and config dialog. It may not currently work on 64-bit windows, I still have some testing to do to get rid of some issues there.

The example I’m showing is just a simple rotating cube with a texture. It’s really just a placeholder to show that it works. You can download the zip here:

http://www.mediafire.com/?d5ody1kg5n1u9rs

You can open the zip as part of or after the download, and you can launch the exe from within winzip or from wherever you saved it.

The exe is an automatic installer as well as a screensaver. If it detects it is not installed fully yet it will auto-install when launched. For the end-user they see a single file for the whole screensaver.

Just double-click the exe run it and it’ll install into the C:\Windows\System32 folder as ScreensaverFramework.scr - it will auto-launch a fullscreen demo right away and create some temporary files in C:\Windows\System32\ScreensaverFramework_Files\ which you may want to also delete later.

The app is about 7.5 megabytes but is mostly compressed data internally using LZMA compression. The basic framework is under 4 megabytes before adding media :slight_smile:

To set it as the default screensaver you currently will have to bring up your screensaver preferences and choose it from the dropdown list. I will make it automatically select itself as the current screensaver, soon.

The preview window should work and you should see the Unity graphics inside the dialog window. Config does work, internally, but this particular screensaver has no settings yet so it won’t do anything. The preview button in the screensaver dialog window should work also.

Moving the mouse or pressing a key in fullscreen will exit the saver. There is one special key, Ctrl, which will be used to enter into a special mode in the screensaver. It currently lets you enter the special mode (press Esc to exit) and offers screen grabbing - press G to grab a PNG or J to grab a jpeg. If you hold the key down it will grab a sequence of images at a fixed framerate. Holding a SHIFT modifier grabs to a folder inside your pictures folder, and holding CTRL grabs a half-sized image instead.

Let me know if you get any problems, and on what hardware/operating system.

Feedback is appreciated :slight_smile: The actual screensaver effect is nothing amazing, I just wanted something simple with minimal file size to show that it’s working. :smile:

[snip]

Yes, please :smile:

[snip]

CPU is Hot… :lol:

On a laptop? lol… that’s a good point. Or are you joking about the massive processing power required to render a cube? lol

Did it work okay for you?

Permanent file host is now here: http://www.mediafire.com/?d5ody1kg5n1u9rs

I had a nice dream last night, Unity themed!

I was outdoors somewhere and it was at some kind of Unity Technologies event. I walked over to a long table covered in books and software and stuff.

Higgy the forum moderator was standing behind it. He greeted me in a friendly and familiar manner. He told me he was getting ready for a speech he was going to give that evening.

In his hand he had a bundle of floppy disks and various envelopes which Unity users had sent in as submissions, and he looked through them and found that indeed there was a 3.5" floppy disk there with my name on it, in my handwriting. I was quite excited that they picked mine!

He showed me a list of user submissions which he was going to talk about in his speech - his speech was going to be kind of a vocally-given news update about what’s been happening in the community, like a newsletter.

He showed me a list of accepted submissions and my name was a the top of it, listing my screensaver framework. I was very pleased. He said look here, look what David Helgason (UT CEO guy) himself wrote, and proceeded to read off David’s comment (he had commented on each submission).

It said something like sometimes there is a rare moment, a turning point where technologies converge to create new possibilities, and this framework is one such moment. It was very profound sounding and I was really pleased that David himself would consider my framework to be a significant step for Unity development and that it would open up new horizons and audiences. They had listed it at the top of the list because they considered it more important than everything else.

Higgy smiled at me as I glowed happily.

Ahhhhhhhhhhh, dreams. :smiley:

Could someone with a 64-bit version of Windows possibly test this for me and tell me if it works or reports an exception error?

With Windows Seven 64 bits I have this message when I execute your program :

If I execute it with admin rights, it install well. But when I choose it from the screensaver list, I have the same error. I doubt it was related to 64 bits. Have you tried it on Vista or Seven ?

Edit: If I execute the ScreensaverFramework.scr file with admin rights, I have the rotating cube in full-screen. But generally, screen-savers are not intended to require admin rights :wink:

Thanks for doing that.

On 32-bit vista I get no problems but on 64-bit vista I get the same exception violation. It’s probably not a Unity thing… I am using some code from another language to handle the screensaver system. I’ve noticed it usually throwing the exception when I try to access a file that doesn’t exist or something like that, or it may be another issue. It’s interesting though that it ran for you with admin rights.

I wonder if it’s because I try to write files to the C:\Windows\System32 folder/subfolder at runtime. I might have to try sending the files somewhere else. Or it might be an issue with the garbage collector or something.

Thanks for testing it for me.

It’s probably that, the rights management are here to prevent developers to access to OS directories this manner. I’m surprised that it works for you with 32 bits…

With that in mind it sounds weird that it would work on 32-bit and not 64. I think it is probably something else.

What I’ve found from some tests is that it is the User Account Control (UAC) on Vista that prevents proper installation and execution. It’s nothing to do with the 32-bit/64-bit scenario… just that the 64-bit machine I tested on happened to have UAC still switched on.

I will have to restructure the application and its output folder locations to try to work around it.

no idea how you published it to the correct format for Windows to recognize it as a screensaver. I’d test it here in Win7 64, but it’s a brand new machine and I’m trying to keep it a very focused rig.

Well Unity isn’t able to create a proper screensaver so it involves creating a standard Windows exe and then embedding it - in a roundabout way - into the exe produced by another programming language. The other language handles the Unity window as it starts up and gets it to work inside the screensaver dialog window, plus various other things which are needed to make it appear to run like a real screensaver.

It’d be nice if Unity could publish direct to a real screensaver with one simple exe but some of the UT folk have said there isn’t much market for it and not likely to put in the effort to make it happen. So I figured out a way to make it work.

I have tested it on my Windows 7 64bit system that also has dual GTX480’s running in SLI and it works great.

I found your forum thread because I started thinking about making a screen-saver with Unity last night and thought I should search to see if it has been done already.

Do you plan to release your framework for other Unity developers to use?

I found that the thing which makes the screensaver fail isn’t whether it’s on 64-bit but whether the User Account Control is switched on. When it IS switched on there are significant problems with trying to access certain files, folders and registry entries, so I have do change it quite a bit to get it to avoid those obstacles.

I might release the framework at some point when it is more perfected. At the moment it requires some customization on a per-screensaver basis in a part of the framework that has to be compiled in another language. Otherwise it would only feasibly support one screensaver installed at a time, since some of the file/folder paths etc are sort of hardwired. I have to work on making it more generic, like loading paths from a file or something, before it would be useable by the general public.

Without UAC switched on though it does work fine at the moment :slight_smile: I still have to rethink the approach of the OSX version too.

it doesn’t work on multie screen
I have 2 screens and it only blacks out 1

Um, yah, that’s normal Unity behavior. I was thinking to open in windowed mode a double-screen-width window, then do some jiggerypokery to remove the borders, but I’m not sure if that’d work out.