- Home /
Unity is not updating my scripts
I recently have run into a problem where Unity will let me modify and create new scripts, save them, but not apply any changes in the game. For example, I modified a script that previously asked for Gameobject Variable in the Inspector to now ask for a String. The script saved, and shows up every time I look at it Unitron, but the Inspector still is using the old version of the code. I can't figure out how to get it to realize that the script has changed. This is also applicable to new code, as I can write and save new .JS files but Unity will not recognize that they exist beyond in the Project pane. I assume there is a problem with permissions but I can't figure out where. How do I kickstart Unity into reading my new files?
I have worked with this project on several computers, tried reimporting all assets, and even tried on a PC (I work with Macs primarily).
Answer by karl_ · May 17, 2010 at 01:16 AM
The problem was a misplaced semi-colon in a main menu script.
var NewGame_Level : String = "beepoc_test_level"; var Instr_Level : String = "instructions";
function Update() { if( Input.GetButton("Jump") ) { Application.LoadLevel(NewGame_Level); } //END IF NEW GAME
if( Input.GetButton("XBOX_Y") )
{
Application.LoadLevel(Instr_Level);
} //END IF INSTRUCTIONS
if( Input.GetButton("XBOX_B") )
{
Application.Quit();
}//END IF QUIT
}//END FUNCTION Update
@script RequireComponent(CharacterController) // <-- There was a semi colon here. This prohibited all other scripts from compiling any changes.
i'm having the same problem look:
var bulletTracePrefab : GameObject;
var rate : float = 8.0;
var velocity : Vector3;
var on : boolean = false;
var accuracy : float = 1.0; //1.0 to 0.0;
public var Clip : int = 36;
private var nextbulletTraceTime : float;
var ammo :GUIText;
var TotalAmmo: int=240;
var IsSentry = false;
var bulletsLeft : int;
var AmmoLeft : int;
function Update () {
if (on){
if(Time.time > nextbulletTraceTime){
rate = $$anonymous$$athf.$$anonymous$$ax(rate, 1.0);
nextbulletTraceTime = Time.time + (1.0 / rate);
var newBulletTrace : GameObject = Instantiate(bulletTracePrefab,transform.position,transform.rotation);
if (IsSentry==false)
{
Clip = Clip - 1;
if ((Clip==0)||(Input.Get$$anonymous$$eyDown($$anonymous$$eyCode.R)))
{
AmmoLeft=36-Clip;
TotalAmmo-=AmmoLeft;
Clip=36;
}
}
audio.Play();
var bulletVelocity : Vector3 = newBulletTrace.GetComponent("bulletTrace").velocity;
var badAim : float = (1-accuracy);
badAim *= newBulletTrace.GetComponent("bulletTrace").bulletSpeed * 0.05;
bulletVelocity += newBulletTrace.transform.right * Random.Range(-badAim,badAim);
bulletVelocity += newBulletTrace.transform.up * Random.Range(-badAim,badAim);
newBulletTrace.GetComponent("bulletTrace").velocity = bulletVelocity;
}
}
}
function OnGUI()
{
GUI.Label (Rect (10, 10, 100, 20), ""+Clip+"/"+TotalAmmo);
}
Answer by ref onyos · Jun 27, 2013 at 02:35 PM
You should try going to Edit>Preferences>External Then from there select your script modifier program. If that doesn't work then I don't know what to tell you :-(
Your answer
Follow this Question
Related Questions
Coroutine - events not working 2 Answers
How to detect empty slot and spawn gameobject there? 1 Answer
Code isn't Recursive in update? 2 Answers