I followed CGCookie’s Achievement System and trying to use it for a notification system.
The problem is the script is spawning the GUITexture, 1100 ish width and 1100 height ish, instead of righto utside the screen so it can slide in. Can anyone see what might be causing this here?
var playerSpawnedTex : Texture;
private var playerJustSpawned : boolean;
private var edgeMargin;
function Start() {
edgeMargin = Screen.width * .01;
}
function playerSpawned() {
if(!playerJustSpawned) {
unlockNotification(playerSpawnedTex);
playerJustSpawned = true;
}
}
function unlockNotification(notificationTex : Texture) {
var go : GameObject = new GameObject("Notification Object");
go.transform.position = Vector3(0,0,0);
go.transform.localScale = Vector3(0,0,0);
var guitex : GUITexture = go.AddComponent(GUITexture);
guitex.texture = notificationTex;
guitex.pixelInset.width = notificationTex.width;
guitex.pixelInset.height = notificationTex.height;
guitex.pixelInset.x = Screen.width * 1.1;//Screen.width - notificationTex.width - edgeMargin;
guitex.pixelInset.y = Screen.width - notificationTex.height - edgeMargin;
var notificationScript : NotificationScript = go.AddComponent(NotificationScript);
notificationScript.edgeMargin = edgeMargin;
}
Or perhaps anyone have the exact script he wrote? Thanks in advance, I cant seem to fix this myself.
Here is the tutorial if anyone wants it: CG Cookie | Learn Blender, Online Tutorials and Help - CG Cookie | Learn Blender, Online Tutorials and Feedback