5/07/2010

Fade GUI in/out

var guiObject : GUITexture; 
var fadeTime = 1.0; 
enum Fade {In, Out} 

// Fade in the GUITexture, wait a couple of seconds, then fade it out 
function Start () { 
   yield FadeGUITexture(guiObject, fadeTime, Fade.In); 
   yield WaitForSeconds(2.0); 
   yield FadeGUITexture(guiObject, fadeTime, Fade.Out); 
} 

function FadeGUITexture (guiObject : GUITexture, timer : float, fadeType : Fade) { 
   var start = fadeType == Fade.In? 0.0 : 1.0; 
   var end = fadeType == Fade.In? 1.0 : 0.0; 
   var i = 0.0; 
   var step = 1.0/timer; 
    
   while (i < 1.0) { 
      i += step * Time.deltaTime; 
      guiObject.color.a = Mathf.Lerp(start, end, i)*.5; 
      yield; 
   } 
}

5/06/2010

Resources for Team Engine

IsPlaying syntax

animation.IsPlaying("wallcrumble");
http://unity3d.com/support/documentation/ScriptReference/Rigidbody.html


MovieTexture.IsPlaying("friends");


Resources

Twitter-room
http://forum.unity3d.com/viewtopic.php?t=41934&highlight=twitter

Drunk-effect
http://www.pixelplacement.com/iTween/


Short script for timer

yield WaitForSeconds(10.0);
Application.LoadLevel("SceneName");



Script for timer before warping back to apartment

var startTime = 30.0;
var minutes : int = 0;
var seconds : int = 20;
var fraction : int = 0;
var timeLeft = startTime;

function Update () {

//The time left for player to complete level
timeLeft = startTime - Time.time;
//Don't let the time left go below zero
timeLeft = Mathf.Max (0, timeLeft);
//Format the time nicely
guiText.text = FormatTime (timeLeft);
// Loads the level with index 0
if (timeLeft <= 1.0) {
Application.LoadLevel (0);
}
}

//Format time like this
//12(minutes):34(seconds).5(fraction)

function FormatTime (time) {
var intTime : int = time;
var minutes : int = intTime / 60;
var seconds : int = intTime % 60;
var fraction : int = time * 10;
fraction = fraction % 10;

//Build string with format
//12(minutes):34(seconds).5(fraction)

timeText = minutes.ToString () + ":";
timeText = timeText + seconds.ToString ();
timeText += "." + fraction.ToString ();
return timeText;
}


Tutorials 1
http://www.unifycommunity.com/wiki/index.php?title=Tips

Tutorials 2
http://www.unifycommunity.com/wiki/index.php?title=Tutorials

5/04/2010

GUISkin Creation Walkthru

If you are creating a GUI Skin from scratch, I can suggest this workflow:


In Illustrator:

1. Develop your style/theme and drag a few different backgrounds in for alpha testing (this is important if you make semi-transparent windows).

2. Create a mock of the complete skin including all the controls.

3. Check the transparent elements again black, white and your other backgrounds - make sure some mock text is readable with a busy background behind.

4. Switch to Pixel layout made and check the clarity of each control. Resize, and adjust as needed.

5. Create a new layer and copy the skin into it. Turn off the old skin layer - its a backup incase things get funky.

6. In the new layer, break the skin apart into functional elements (i.e. match each part to a Unity GUISkin GUIStyle.


Exporting Illust to Pshop

7. Copy each element and paste into a single new photoshop document. I usually do this by category to avoid confusion. You should have a big jumble of controls on one page with lots of layers - this is good.


In Photoshop:

8. When you paste a control in from Illustrator, it will almost never come in perfectly. There are often stray or misaligned antialiasing pixels and whatnot. You need to manually make each element "pixel-perfect". I tend to copy and rotate elements to ensure they mirror each other. In photoshop, if you paste pixels with less than 100% opacity over eachother, the effects are additive, so make sure your paste target area is empty. This care taken in this step is the difference between a polished and average GUI.

9. Cut up the resizable controls to their minimum. For buttons and windows, this just means finding the last row and column of repeatable pixels before the corners kick in, deleting what's in between and merging the results. You should leave a single line of repeatable pixels for each corner - less than this can give odd results.

10. Copy each element and paste it into a new document - I would suggest pasting each state of the same element into the same document and making sure they line up.

11. Save the PSD as the element name and then export for Web as a PNG. Make sure you have a good naming convention for each control state (like buttonNormal, buttonHover etc).


In Unity:

12. Create the GUI skin and assign the elements. I always turn off Mipmapping, as Nicholas said, and I never use DXT compression instead opting for RBGA32. Better to sacrifice a little memory for a super-crisp GUI.

13. You'll need a GUI script to see all your elements. You can use mine, if you don't mind C#. Its here - http://forum.unity3d.com/download.php?id=2330

14. Adjust the margins and borders for each of the GUIStyles - the horizontal scrollers & sliders can take a bit of fiddling - for sliders use the overflow properties to get things lined up correctly. Remember: the thumb is larger than the slider, thus; left & right overflow = (slider width or height - thumb width or height) / 2.


If you're not bad at Illust & PShop it takes around 1 day from concept to getting a skin up and running in Unity.


Source: http://www.unifycommunity.com/wiki/index.php?title=GUISkin_Creation_Walkthru

5/03/2010

How to make icon for interactive.

Try get hold of a software called Iconographer.

* Create a .icns file using Iconographer, Icon Composer or a similar tool. Save it as "UnityPlayerIcon.icns".

* Control click your built game application and choose Show Package Contents. Go to the Contents folder, then into Resources. You should see a file named "UnityPlayerIcon.png" here. This is supposed to be the default icon, but it doesn't appear (probably because it's a PNG instead of a .icns file). Don't delete it - Unity might be using it for some other purpose.

* Drop your UnityPlayerIcon.icns file into this Resources folder.

* Now for the fun bit. The Finder is notoriously bad at noticing when an application's default icon has changed, so you need to do a little dance to make it realise what's happened. Logging out and in again usually works. Alternatively, you may be able to make the new icon appear by duplicating the game from the Finder - the copy should appear with the correct icon.



Source: Unity forum

Free sounds.

Monday - Resources from Ole

How to make splash screen.



How to reduce file size. Must read for Production Team!
How to optimize performance. Must read for Production Team!





Have fun!

4/25/2010

Some stuff from the past.

I stumbled upon the 2008 The Hope of Ruins group project blog just then, and I thought it might be of use. Examples of how previous groups worked are always handy.

Blog index

Interesting to see how they documented and kept track of their assets. Seb might get some ideas from it?

Hmm

Edit: Found some more.

2007 Terra Transeo blog (lots of stuff)
2005 Invisible City blog

4/22/2010

Feat. Project Brief

John provided us with a few printed versions of the Feat. project brief. If you would like to have a read come and see me. Alternatively, you can find it on the server in the following location.

aim2010/myshare/AIM_Collab_Stud_Briefs_JP_Presentations/Feat_Brief_2010_04.pdf

Things are going really well with the initial concepts. I look forward to discussing it further on Tuesday.

Also. John's powerpoint presentations are now on the server if you would like to revisit them.

Gaming can make a better world

Interesting lecture on gaming.

4/21/2010

Games in Unity

Hi, guys! First of all I'm not suggesting we should make a game as our project, as I'm really keen on developing Jennifer's idea of using the rooms or environments as a interactive or non-interactive music video/player of some sort. But since the idea of making a game seems popular, and as a leader for the Team Engine (also known as Team Awesome), I've done some research. Enjoy!

It's IMPORTANT that the concept team and producers have a basic understanding on what is achievable and what is not! In my humble opinion at least.

Unity Tutorials(unofficial)

Unity Tutorials(official)

Website of simple 3D games playable online (as Flash games)

List of games made with Unity

What makes a game good?

Multiplayer?