Countdown script problem...plus zoom in/out...
I solved the code: (^_^).bvar Num : int = 5; function Start () { Readyfunc(); } function Update() { if (Num > 0 ) { CountDown(); } else if (Num == 0) { CountDown(); } } function CountDown() { if...
View ArticleUsing if/else statements in GUI
HI, I have a GUI script which has a line if (GUI.Button (Rect (20,70,80,20), "Weapon 2")) { Target.SelectWeapon(1);Then i have another script with a static var MyScoreCounter : int = 10;line. How do I...
View ArticleError "There is already a local variable with the name 'obstacle'."...
Hello. This is the part of my script Unity hates. I can't assign "obstacle" more than one time. How can I fix this and let it work? Thank you!if(whichToSpawn == 0){ var obstacle = Ob_1; } else...
View ArticleMouselook enabled on Rightmouse hold down
Hi there, i have a problem with this script, im only a beginner, i found this script in a comment but it doesn't work for me. I get unexpected symbol error for "else" altho i have tho clue what im...
View Articlescript help needed
how do i do this??function Update () { animation.Play("Loading"); else if (animation)) animation.Stop("Loading"); Application.LoadLevel (1); }it doesnt work at all it is suposed to play the loading...
View ArticleEfficient way to assign a value from another value
Hey guys, (i'm not new to UnityAnswers, just have a new username due to the QATO port) OK, i have a script that places objects on a certain X co-ord objectCopy.transform.position.x =...
View ArticlePower-Ups scripting error
Hey, I'm currently working on a space shooter and I'm starting to add power-ups to it. I had a power-up that gave you an extra life but then i switched from lives to health and I'm having a bit of...
View Articlemaking a variable (var) false when not colliding with a trigger.
hi, i have this script which is meant to have 'OnLand' true when inside the trigger collider (which it does fine) but i want it to be false when not inside the trigger collider. this is my script: var...
View ArticleScript not working, any help appreciated.
Ok so I have done a complete revamp to the script including all of the changes made via suggestions in this question and another I have. The new and improved script is below. The only thing I think I...
View ArticleCan I use multiple If/else in 1 function?
I am trying to create a trigger that has 4 different things that can happen based on the state in which the trigger is in. Can this be done with If, else, else, else? or is there a better way to do it?...
View ArticleChange a Variable on Key Down
I've been trying this with no success :*( if anyone can help me find what im doing wrong that would help alot. Neither attempt I've tried to make is actually changing the variable, Healthbars is Always...
View ArticleUnity Script help for on/off switch code.
I have been trying to create a code for entering and exiting a vehicle. I have been using the following: `var carCam :Camera; var walkCam : Camera; var on :boolean; function Update() {...
View ArticleHow to write a "or "statement & a if Else with or condition?
Hi Guys, I have 2 questions, 1) How do i insert a Or Random Range insert this function? function ResetPosition () { transform.position.y = 71; transform.position.x = Random.Range(-11...
View ArticlePlease help I don't understand what is wrong.
Okay I am trying to make a GUI pop up after completing a set number of laps but I'm getting all these errors with the coding that I have put in saying to put something in instead of what I have and...
View Articleif else statement ignored ??
I've been up for too long already and I need some fresh eyes to look at this simple snippet of code and see if I am doing anything too stupid here. First off let me explain what I am trying to...
View Articleerror CS0103: The name `wing' does not exist in the current context
I'm using a code that is working fine to change the wing's color of a butterfly, through texture's offset value. Here is the code: using UnityEngine; using System.Collections; public class...
View Articleif(x > 0){ if(x
(2d game) I'm trying to manipulate the sprite animation script on a CharacterController via a Vector3 that I'm using for its velocity. The velocity.x varies from -4 to 4 (which I've verified via...
View ArticleIf, else statements seemingly in Raycast not working.
Hello once again Unity Answers. ***Long story short,*** The RayCast will do what's in the "if" statement when the Raycast hits but won't do what's in the "else" statement when it misses despite having...
View Articleif\else structure fails
Hi, i have this code: if(NextMapPartType==2)//chek corner situations { Debug.Log(CurrentMapPart.transform.rotation.eulerAngles.y); if(CurrentMapPart.transform.rotation.eulerAngles.y==180) {...
View ArticleI'm wondering with if function working
Hi! I have question with if function, about is condition if I have 2 variable var A: float; var B:int; and I make if(A>B) or if(B>A) if this function work? if if-function can compare with 2...
View Article