First thing you have to do is create a gui text. Aligned it to the object that you want the text to be placed on and then child it to the object. From here you basically use a OnMouse function for it to do various things.
Function OnMouseEnter()
{
Renderer.material.color = Color.green;
}
When the player places his mouse over the text, it will turn it green.
Function OnMouseDown()
{
Renderer.material.color = color. red;
}
When the player clicks the text, it turns red. Basically all these mouse states can be used to assign various actions to them. However, returning back to what I had to do, the problem still remain… how am I going to get the buttons show up on cue and in the camera face in their set positions. I tried coming up of different ways of doing it and I tried messing around with GUISkins. I don’t even know where to start with this. I applied it to an object and I don’t know what else to do with it at first. There was a bunch of options to mess around with. I then found the option to apply texture to it. Using the png that I have created, I inserted into the texture slot. Took me a bit to figure out how to apply the skin into the script but reading the reference thoroughly, I was able to do so.
Var guiSkin : GUISkin;
Function OnGui
{
GUI.skin = guiSkin;
Now every gui button created after this will use the skin. To turn it off or to stop the gui you have to null it.
GUILayout.Button(“TESTESTESTETSET”);
GUI.skin = null;
}
Buttons created after the null will now use the default skin instead of the guiSkin. At first I think finding this was great and I began to apply it right away then I realized that I have to apply the guiskin and null for every single button. Making the script very long and redundant. After researching for awhile, I then came across guiStyles.
With guiStyles, you can have every button use the style within the script line and that would save you several lines of code. So after setting up several guiStyles and inserting the png, it looks like something like this.
private var buttonWidth:int = 125;
private var buttonHeight:int = 50;
private var spacing:int = 100;
static var paused = false;
static var startPrompt = false;
var continueStyle : GUIStyle;
var optionStyle : GUIStyle;
var redBlueStyle1 : GUIStyle;
var redBlueStyle2 : GUIStyle;
var aStyle : GUIStyle;
var bStyle : GUIStyle;
var switching = false;
function OnGUI()
{
if(Input.GetKey(KeyCode.Escape))
{
paused = true;
print("paused");
}
if(paused == true && startPrompt == true)
{
Time.timeScale = 0.0;
if(GUI.Button(Rect(Screen.width/2 - buttonWidth/2, Screen.height/2.50 - buttonHeight/2 - spacing, buttonWidth, buttonHeight),"Continue", continueStyle))
{
paused = false;
Time.timeScale = 1.0;
}
if(GUI.Button(Rect(Screen.width/2 - buttonWidth/2, Screen.height/2.15 - buttonHeight/2 - spacing, buttonWidth, buttonHeight),"Option", optionStyle))
{
print("This is Option Bitch!");
}
if(GUI.Button(Rect(Screen.width/2 - buttonWidth/2, Screen.height/1.9- buttonHeight/2 - spacing, buttonWidth, buttonHeight),"redblue", redBlueStyle1))
{
varSwitch = 1;
if(switching == false && varSwitch == 1)
{
switching = true;
varSwitch = 0;
print("switching");
}
if(switching == true && varSwitch == 1)
{
switching = false;
varSwitch = 0;
print("not switching");
}
}
if(GUI.Button(Rect(Screen.width/2 - buttonWidth/2, Screen.height/1.70 - buttonHeight/2 - spacing, buttonWidth, buttonHeight),"A", aStyle))
{
print("die!!");
}
if(GUI.Button(Rect(Screen.width/2 - buttonWidth/2, Screen.height/1.5 - buttonHeight/2 - spacing, buttonWidth, buttonHeight),"B", bStyle))
{
print("B works");
}
}
}
I wanted to try using GUILayouts. I haven’t spend much time with it but there were a few errors where the button wouldn’t show up but the text or the none of the parameters would work. I might have to tinker with it some more. Using GUILayouts, it organize the buttons nicely so you don’t have to fiddle around too much with aligning the buttons.
One of the other things I tried to do is getting the gui toggle to work. Gui toggle work with a Bool.
var toggleBool = true;
function OnGui()
{
var toggleBoolNew = GUI.Toggle (Rect (25, 25, 100, 30), toggleBool, "Toggle");
// Check if the toggle was toggled
if (toggleBoolNew != toggleBool)
{
if (toggleBoolNew == true)
{
print("Toggle On");
}
else
{
print("Toggle off");
}
}
}
This script was able to place a toggle at the top left corner and you can click it to toggle but when I placed it in the button, I couldn’t get it to work. I’m not sure whats the problem. I haven’t messed around with bools enough to figure it out atm.
For Marketing, I've came up with 2 poster ideas and slightly rendered them.


The first concept is having the head with the eye of horus, reaching out to grab the jar which contains remnants of osiris in it. The second picture is a portrait of horus in his falcon form. I wanted to make him hard to see because we aren't releasing character design/concept yet. I made his eye glow to symbolize his powers.
And I came up with 3 teaser quotes that we could use on the poster or other advertising materials.
- Events that shook the very foundation of his life that it’ll never be the same again.
- In a race against time to set things right.
- Don’t think you’ll get away that easily.
No comments:
Post a Comment