Answer by ransomink
You are declaring the var lGround twice: (1) at the top of your script, (2) inside the Start() function. Anything you declare inside of a function will exist **only** inside the scope of 'that'...
View ArticleAnswer by ransomink
I found this webpage recently and it's possibly the best way to learn and get into programming/scripting for Unity. It is something you can always come back to and reference in-case you forget how to...
View ArticleAnswer by ransomink
What he said. I 2nd his response/answer. Always try to check the numbers as they tell you what line the error was found on. At least it's only a typo...
View ArticleAnswer by ransomink
1. You are referencing the script properly, but inside the inspector, you must add/drag the GameObject (using the CamBob script) into the bobscript (empty slot). 2. Make sure your spelling and casing...
View ArticleAnswer by ransomink
This is an easy script that will switch the camera upon entering the trigger and revert back to the previous camera when exiting the trigger. Attach this to the trigger GameObject. // INSPECTOR...
View ArticleAnswer by ransomink
Cambob script public function DoSomething () { Debug.Log ( "You should be doing something..."); } Script that calls the function // this variable will show up in the inspector // place the GameObject...
View ArticleAnswer by ransomink
You need to create a variable to hold the total amount of spawned balls and a variable for the current amount of spawned balls. Also, use a variable in place of '8' when checking the timer because you...
View ArticleAnswer by ransomink
Make sure you do **not** place this script on the light GameObject; any other will do. using UnityEngine; using System.Collections; public class ScriptFlashlight : MonoBehaviour { public Light...
View ArticleAnswer by ransomink
To answer your question (out of curiosity), use this when looking for a tag on a single/specific GameObject: // check if the GameObject has a certain tag if ( TheNameOfYourGameObject.tag ==...
View ArticleAnswer by ransomink
Because your while loop only creates a random integer once (then breaks), during your for loop, it's setting every integer in your array (randomNumbers) to the same value: randomFace. // if randomFace...
View ArticleAnswer by ransomink
Use OnTriggerExit2D when an object leaves a trigger collider. You should **not** just set onHand = false; You will need to check if the GameObject that left is tagged "Hand" because any other...
View ArticleAnswer by ransomink
You should create 2 animations (from the Animation window): **Default** and **ChangeCondition** (or whatever makes sense). The **Default** animation will have your original/default sprite (drap and...
View ArticleAnswer by ransomink
1. Check if the player has collided with a spawned body 2. If so, spawn a new cube 3. After the cube is spawned, add it to the array spawnPoint on the CubeSpawner script is used as the position of the...
View ArticleAnswer by ransomink
First off, no one can help if you can't properly tell us the names of your scripts. Adequate info is necessary. Secondly, [@ThomasMarsh][1] gave you the correct answer for accessing a variable from...
View ArticleAnswer by ransomink
First question: You can create two variables: one which controls the rate of fire (rateOfFire), and the other holds the time of the last shot fired (lastFired). public var rateOfFire : float; // Rate...
View ArticleAnswer by ransomink
Looks like you're using Built-in Arrays; you cannot resize them, so attempting to remove an item from the array will not work.
View ArticleAnswer by ransomink
Make sure "FireFrom" is spelled the same inside the hierarchy and the script. Also check that the script is attached to the TurretHead gameobject (just as a formality). I would throw an debug exception...
View ArticleAnswer by ransomink
You're not disabling the MeshRenderer correctly. It's suppose to look like this: objects[i].GetComponent().enabled = false;
View ArticleAnswer by ransomink
Dunno what language you need or prefer, but I use JavaScript (UnityScript)...so...yeah. The first method uses StartCoroutine: this is a good/great? workaround if you need to use a parameter(s). public...
View ArticleAnswer by ransomink
Change: `public GameObject projectile` variable type from GameObject to projectile_Controls: `public projectile_Controls projectile` This way, you can access public variables like: `projectile.decay`...
View Article