This is my error I think it effects the lines
guitex.pixelInset.x = Screen.width - achievementTex.width - edgeMargin;
guitex.pixelInset.x = Screen.width - achievementTex.width - edgeMargin;
Operator ‘-’ cannot be used with a left hand side of type ‘int’ and a right hand side of type ‘Object’.
#pragma strict
var firstStepTex:Texture;
private var firstStepTaken:boolean;
private var edgeMargin;
function Start(){
edgeMargin = Screen.width * .01;
}
function playerMoved(){
if(!firstStepTaken){
unlockAchievement(firstStepTex);
firstStepTaken = true;
}
}
function unlockAchievement(achievementTex:Texture){
var go:GameObject = new GameObject("Achievement Object");
go.transform.position = Vector3(0,0,0);
go.transform.localScale = Vector3(0,0,0);
var guitex:GUITexture = go.AddComponent(GUITexture) as GUITexture;
guitex.texture = achievementTex;
guitex.pixelInset.width = achievementTex.width;
guitex.pixelInset.height = achievementTex.height;
guitex.pixelInset.x = Screen.width - achievementTex.width - edgeMargin;
guitex.pixelInset.x = Screen.width - achievementTex.width - edgeMargin;
}