Quantcast
Channel: Questions in topic: "javascipt"
Browsing all 1875 articles
Browse latest View live
↧

Attempting to make a ammo reload script in JS, trying to use switch/case with...

So like I said I'm trying to right a script that will reload the "gun" (there is no gun all it does is add and subtract from two separate variables) and at the moment I can only "reload" if the "mag"...

View Article


Rotate an Object

Hello Unity3D.I have a question about rotating an object.How can i rotate an object from another object?For example.I want my character summon an orb and then i want that orb to rotate or orbit around...

View Article


Lock camera on keypress

> I am trying to create a script where> if i press a key on the keyboard that> it will lock and unlock the main> camera and i can use my mouse to> select things on the screen. Did i...

View Article

Unsure on how to access a var from another function

Hello, I have this code here that creates and destroys a main music system. The reason I want it to destroy the music is because in my level when I finish the level I want a special jingle to play but...

View Article

WaitForSeconds in Update() function

Hello, I've been trying to make a script which makes the object "wander around" and stop for 5 seconds. After that, he wanders around again. But I'm getting an error saying: "Update() can not be a...

View Article


Problem with Cursor class: 'lockCursor' is not a member of 'UnityEngine.Cursor'.

Good night, I'm trying to use the Cursor class, but I'm having problems when using Cursor.lockState and then get the following message: "Assets / MouseLock.js (13.24): BCE0019: 'lockCursor' is not a...

View Article

Getting error transform.position assign attempt for "Player" is not valid on...

I've seen others ask about this error and some say it appears in the editor only, some say it's because 1 or more of the Vector3 values is null. I can see in the debug that my project thinks the x and...

View Article

Touching moving sprites

I am making a 2D game where I have to touch two moving sprites. Evertything works but the touch. Both sprites have a rigidbody 2d and a box collider 2D. The problem is that when I touch a sprite...

View Article


A lot of objects in 1 scene

I'm making a top down space game, and I've made a script that will generate stars in a specific area. Now if I pick a really big area, say from x-1000 to x1000 and y-1000 to y1000, and generate a lot...

View Article


Line renderer color not working

This is my script for my line renderer #pragma strict var startWidth = 0.1; var endWidth = 0.1; var startColor : Color; var endColor : Color; private var Frog : GameObject; private var Cylinder :...

View Article

Is it possible to start a game and get GUI-button act as like its already...

Hello, I have a problem because I've created two GUI-buttons that hides/disables and unhides/enables gameObjects renderer. And I need to second one act like its already pressed once when the game...

View Article

OnMouseDown not working

Good afternoon, all right? I'm having the following problem... I have a code that have attached to the player, which identifies when the player clicks the object with the tag "Box" when it is at a...

View Article

Placing object where ray collides

I have this code so far for a script that I want to have move an object to where the mouse is looking. It works on objects, but when the ray collides with any terrain or trees from the terrain, the...

View Article


Yield Never Works

Hello,I've been coding for a bit of time but I have never been able to get yield to work for me. It doesn't work. This is one of the scripts that needs to yield. #pragma strict var VictoryTheme :...

View Article

Problem with Raycast

Good afternoon, all right? I am using a script with raycast to detect when the player clicks the "Box" at a certain distance, but I'm in trouble. My code is below: #pragma strict public var boxes = 0;...

View Article


Volume Slider

I created a slider that is supposed to edit volume. How can I make it so the volume changes with the slider. I tried some things and it didn't work. I keep getting a null reference exception that the...

View Article

Pathfinding. Does not "walk" on every tile.

Hello, I'm working on a pathfinder of type A*, but I'm having some trouble trying to iterate each move. Here's the code I've got so far: while (tilesForSearching.length > 0) //While there is tiles...

View Article


UnityScript set button text

I am trying to set the text of a button programmatically that I made in UnityScript. This is way harded than it should be. Here is my UnityScript code: #pragma strict var loginButton :...

View Article

Instantiated GameObject does not have variables

Im working on a weapon pickup and drop system but the dropped weapon clone does not allow to pick it up again because the variables arent assigned to the clone! How can I fix that? I cant use find...

View Article

Can't get Animation to stop

I have this function to play an animation then wait a few seconds then it changes the Boolean to false to stop the animation. I can't get it to work, he doesn't stop looping the animation. Is there a...

View Article
Browsing all 1875 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>