Using the scrollwheel
I am using the scrollwheel to change weapons in my game, and was wondering if there was a way for it to recognize which way the scrollwheel is turning. Any help?
View ArticleLimiting the time my gun can shoot
I am trying to limit the rate of fire for my gun. I use this script: function Update () { machineflash = GameObject.FindWithTag("machineflash"); // raycast settings var direction =...
View ArticleMaking a shotgun
I want to make a shotgun using raycasts. I have a script for a pistol and was wondering if I could edit it. function Update () { pistolflash = GameObject.FindWithTag("pistolflash"); // raycast settings...
View ArticleAmmunition not working
So, here's my ammunition script: var damage : float = 5; var gunshot : AudioClip; var muzzleflash : GameObject; var aclip : int; var ammo : int; function Update () { pistolflash =...
View ArticleJust a simple JavaScipt question
In JavaScipt, you can add a number to a variable that is an int by going variable ++; but is there a way to add larger numbers to this variable?
View ArticleMaking a sound play at a moving point
Hi. I'd like to make sounds that play at a moving point. Currently I use AudioSource.PlayClipAtPoint(sound,transform.position); What should I use?
View ArticleEasy explosion script
Here's the script: var explosion : GameObject; function OnCollisionEnter (collision : Collision) { Instantiate (explosion, transform.position, transform.rotation); Destroy (gameObject); } But it says...
View ArticleInvisible Audio Listener
So, in my scene I have a first person controller, a terrain, and directional light. When I try to run it, it goes to the default blue and says that there are 2 audio listeners. I have tried deleting...
View ArticleToggle camera sensitivity
So here's what I'm adding to a JavaScript version of MouseLook: if (Input.GetButton("Zoom")) { sensitivityX = 1; sensitivityY = 1; } How do I make this so that it toggles on and off?
View ArticleMaking an object move with the camera
For some reason, when I child an object to my FPS controller's camera it doesn't move up and down, only left and right. Has anybody else encountered this before?
View ArticleMultiplayer tutorial help
I am using the muliplayer tutorial, and the first code is bringing up some odd errors. Assets/connectionGUI.js(17,41): BCW0012: WARNING: 'UnityEngine.Network.useNat' is obsolete. No longer needed. This...
View ArticleMultiplayer spawning error
So here's what I'm using: var Player : Transform; function OnNetworkLoadedLevel () { // Instantiating Player when Network is loaded Network.Instantiate (Player, Vector3 (Random.Range (5, 95),...
View ArticleSpawning above the terrain
For my multiplayer game, I want random spawning. This is what I'm using: Network.Instantiate (Player, Vector3 (Random.Range (5, 95), transform.position.y+4, Random.Range (5, 95)), transform.rotation);...
View ArticlePlayer not deleting on server exit
So, here's a slightly altered code from the IOS multiplayer var Player : Transform; var camera1 : Camera; function OnNetworkLoadedLevel () { camera1.enabled = false; // Instantiating Player when...
View ArticleMaking a plain number range
I know about Random.Range, but I would like to say "x equals 1 to 10", and using just Range doesn't work. What do I do? [EDIT] Hmm, ok, maybe it would be better if I explained what I wanted to do. I...
View ArticleMaking a new function
I want to make a new function, but I want this function to act the same as OnCollisionEnter. How do I do this?
View ArticleColliding with a character controller
So, I have an object that I want to disappear when a FPS controller collides with it. My code doesn't work. function OnControllerColliderHit (hit : ControllerColliderHit) { Destroy (gameObject); } What...
View ArticleDestroy on range command
Ok, so here is my code: function Update () { transform.Rotate (Vector3 (0, 2, 0)); target = GameObject.FindWithTag("Player"); range = Vector3.Distance(target.transform.position, transform.position); if...
View ArticleAnimating hinges
I have a cube, with cylinders that I want to make legs. I have given them both Hinge Joints at the point I want them to pivot around, but I don't understand what I do if I want to make an animation...
View Article
More Pages to Explore .....