How to shoot RayCast in center of screen?
I need some scripting help My Code #pragma strict var damage : float = 1; var bulletsinclip = 30; var bulletsperclip = 30; var clips = 3; private var nextFireTime = 0.0; var fireRate = .02; function...
View Articlehow make a for loop that makes GUI boxes ?
Hi i want to make a for loop that displays GUI boxes whatever the amount is MyCode public void LootAmountRandomizer() { LootAmount = Random.Range(0,100); if(LootAmount<=50) { Debug.Log("3 items");...
View ArticleHow to access 2d array in outside script
So here I have my code: var pathScript; var i; var j; function Start(){ pathScript = transform.parent.gameObject.GetComponent(nodecreator); Debug.Log("I'm born!"); Debug.Log("i = " + i); Debug.Log("j =...
View ArticleHow to reference another script and call a function in C# ?
So in a script *script1* I have: public void Follow(GameObject followTarget, bool snap = false) { Follow(followTarget.transform); } How can I reference this in *script2* and assign a GameObject to it?...
View ArticleCan't change Rigidbody2D mass
It seems that in Unity 4.3 you can't set the mass of a Rigidbody2D at runtime - it just reverts to it's original value. I've tested this and also found a [forum thread][1] quoting the same problem.....
View Articlepuzzel drop smoothly.
what is a good way to create smoth dropping objects in unity. I created a game where I have spawners that drop blocks if the blocks below are less then count but it uses unity physics engine and its...
View Articlewhy create dynamic mesh with shadows ?
![alt text][1] When i create mesh and uvmap with script, there is some shadows when playing game. But if i use a plane and textured it , it works great. ![alt text][2] How can i create mesh with no...
View ArticleRendertextures don't render when anti-aliasing is turned on
Hi. In my game I have a screen that shows renders of several items the play can choose. This screen works y renderering the object to a rendertexture and then displaying the rendertexture on the GUI...
View ArticleWhy would I get massive FPS drops when running built PC version (editor play...
Hello, Bit of a basic question here. When I play my game in the editor the framerate is normal and there are no issues but as soon as I build my game into a PC .exe and run it the framerate in certain...
View ArticleMissing NGUI OnMouseUp and 'OnHoverWhileOnPress' Events
I've asked [this same question on NGUI's forums, but it got no traction][1]. So I decided to ask here (and also I hate forums). Using **NGUI 2.7.0** here. About the [NGUI Events][2], I've missed 2 kind...
View Articlechanging a lightmap at runtime
Hello! i am trying to change a lightmap at runtime. in my example i change the lightmap with index 0. i am run this code at keypress but nothing is happening... the lightmap assigned is still the...
View ArticleHow to Deserialize an XML textasset?
So I have this code: var serializer = new XmlSerializer(typeof(MyClass)); using(var stream = new FileStream(path, FileMode.Open)) { return serializer.Deserialize(stream) as MyClass; } Basically, it...
View ArticleHow do i access a SphereCollider added by RequireComponent?
Hi all Im trying to access a SphereCollider that i added to my gameobject by using the RequireComponent. What i essentially want to do is set the colliders radius to my range variable as shown in the...
View ArticleHowcome the keyboard doesn't open? (using script from docs)
Hi, I grabbed this from the scrip reference page, but it won't open my keyboard? the debug messages told me it was open. var inputURL : String = "http://www.unity3d.com"; private var keyboard :...
View ArticleCamera matrix shifting is moving my skydome
Dear community, I'm using a script on my camera that moves the projectionMatrix so my perspective changes with the player moving in front of a big screen. I've simplified the script so only the matrix...
View Articlebone animation from 3dsmax to unity
Hi I have a character animated with .Bip files I loaded and changed to carry a bone animated "Gun". It works great in 3dsmax but if i export to unity only the character is animated. please help.
View ArticleI'm doing the Roll-A-Ball tutorial and I entered the Player Controller script...
![alt text][1] [1]: /storage/temp/18091-screen+shot+2013-11-11+at+8.34.17+am.png
View ArticleSave EditorWindow to disk
Hi, Is there a way to save an editor window using **AssetDatabase.CreateAsset()** ? What I have is a class that inherits *EditorWindow*, and it include multiple **ScriptableObjects** as its members. I...
View Articleerror CS0266: Cannot implicitly convert type `UnityEngine.Object' to...
hi i am trying to Rock Dorpper and after 5 seconds wait, but I keep getting Error CS0266 public class RockDorpper : MonoBehaviour { // Instantiates prefab when any rigid body enters the trigger. // It...
View ArticleWeird collision bug
Hi, I have a weird bug, I create a mesh dynamically during runtime, and I update the MeshCollider "sharedMesh" every fixed moment in order to update the collider. As my player start touching the mesh,...
View Article