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

Check if List contains specific object values (JS)

I'm trying to optimise my code: for (var a = 0; a < GhostObjects.Count; a++) { if (GhostObjects[a].name == "GhostObj Pos_" + Current_Pos && GhostObjects[a].transform.position.x < 1) {...

View Article


Why is this boolean value changing?

Is it not possible in UnityScript to change the value of a boolean variable with the NOT operator? This is what I would expect: var x = true; var y = true; var x = !y; //variable x is now false Is this...

View Article


Passing variables' values between two or more scripts

I have two scripts that share variables. One is called Hourglass.js and the other is HourOfTheDayCalculator.js. I have no problem getting HourOfTheDayCalculator to see the variables in Hourglass, but I...

View Article

Tried to set animation speed: Type 'UnityEngine.Component' does not support...

When I try to set an animation speed I get this error: Type 'UnityEngine.Component' does not support slicing. This is the code I have: var WalkSpeedModifier : float = 8; var WalkAnim : String = "Walk";...

View Article

Would it be better to just combine these two scripts?

I've got these two scripts that are supposed to share variables, but I'm having a ton of trouble getting the first (Hourglass.js) to pull the values from the second one (HourOfTheDayCalculator.js)....

View Article


while pause, Y rotation of First Person Character Controller(C#) is moving !...

After pausing the game, all the components got freeze except Y rotation of First Person Controller. I have tried implementing lock the mouse look but didn't work. what I have observed while play mode...

View Article

This not reading folders in the Windows Store

My script does not work in Windows Store, but running inside the Unity it works. PS: Sorry my english static var CaminhoAux :String= Application.dataPath+"/LastSurvivor"; function LerPastas(){...

View Article

transform.rotation.z gives different value than expected

I'm got a game object that has it's z-axis rotated to a new position when the scene starts, based on the time of day. I want the color of the game object to change depending on how many degrees the...

View Article


2D Sprite animation - How do I jump to the next frame?

I need to make a script so that whenever I press a key an animation jumps to the next frame. How would I do this?

View Article


How to check an element of a string array with a string

I am having an issue checking a specific element of a string array with a string of my choice. Here is the idea: Array[0] has a string value which is read off the first line of a text file. I have the...

View Article

2D animation problems: Sprite wants to finish first animation before moving...

I am animating a 2D escapists sprite which works ok. By pressing the arrow keys or wasd you go in the direction you want and the animation points in that direction but the thing is, it wants to wait...

View Article

Switch GameObjects Tags with javascript

So I'm trying to close and open multiple doors with a script and here it is basically I'm just trying to switch tags but the tags won't switch. Please Help Thanks! `function Update () { var hit :...

View Article

Static Variables Issue

I want to change all the problematic static variables to non static, but I can't seem to make it work, I've already tryed with the...

View Article


Rectangular Cube is sinking in floor rotating at 90 degree

Okay so I am trying to make a game like "**bloxorz**" in which a rectangular cube is rotated at 90 degrees. But when I try to implement it the cube is half sinking to the floor at 90 and then fully...

View Article

GetComponent not working inside OnTriggerEnter half the time

var myZone : int; function FixedUpdate(){ myZone = this.gameObject.transform.parent.gameObject.GetComponent(EnemyHealth).zone; } function OnTriggerEnter(other : Collider){ if(other.gameObject.tag ==...

View Article


OnCollisionEnter not working.

var myZone : int; function FixedUpdate(){ myZone = this.gameObject.transform.parent.gameObject.GetComponent(EnemyHealth).zone; } function OnCollisionEnter(other : Collision){ if(other.gameObject.tag ==...

View Article

Command "GetButton" not working well

I was making a Firethrower script on JavaScript, and I read that the command "GetButton" sets "true" when the key is holded, and sets "false" when not. But in my case, when I press the key, becomes...

View Article


Want to add JavaScript to Monodevelop but need reference.

So i want to add Javascript as a language to monoDevelop. According to the Monodevelop reference it should be entirely possible. But i need a reference so if anyone knows were the files are located for...

View Article

Button OnClick Applied To Whole Canvas?

Hello, I've recently started learning Unity and I've come into a bit of a problem that I can't seem to fix. I'm simply trying to create a UI Button that when clicked will re-focus the camera (Zooming...

View Article

How to undo cancel Invoke

So I use invoke repeating until a certain number is reached and then cancel the invoke. But is tere any syntax in JS to "reinvoke repeating" FROM A SEPARATE SCRIPT? Thank you for your time and any...

View Article
Browsing all 1875 articles
Browse latest View live


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