Quantcast
Channel: Questions in topic: "js"
Browsing latest articles
Browse All 373 View Live
↧

Update Gui Text with Score

in the script below, it changes the guitext the next time the level is loaded, but can someone help me update the text when the score is updated. here is the script var Counter : int = 0; function...

View Article


Save Timer HighScore

I have a script, which has a timer and i want to make a highscore system for that timer. I have already made a script but it won't save the highscore. It only updates the score, so if the score is 45...

View Article


Changing a Sprite when Collision occurs

Hi, I've been trying to figure out how I would do a code that would be for my University project on a 2D Sidescroller Spaceship game. The way this works is when the spaceship crashes in to a collider,...

View Article

Match the GUI scale and In-Game Object scale

Hey, I have a GUITexture that I want it to have a scale that matches the size of the in-game object. No matter what screen size I'm playing on. everything is 2D. Thanks :)

View Article

Google play games in Javascript?

Hi all, when I almost finish my game in JavaScript (I choose JavaScript because, my background programming language based on Java and Js.) then I decided to add Google play games feature so far so...

View Article


Network (gameobject)player list JS

how to get acces to all players in the server or gameobjects? i just want to use that list to get access all of them to do stuff like scoreboard... i did check the tutorials...first i dont understand...

View Article

How do I change the text of a gui image text

I'm trying to change the GUI's Text but the script gives me this error ![alt text][1] [1]: http://gyazo.com/943e6f7275671cd5934537aee6352273 and heres my script #pragma strict static var currentScore :...

View Article

[JS - 4.6 - UI issue] my script doesn't allow me to change the items text

so I have a gameobject named _GM and I have a game master script that controls when the player gets a coin and when that happens I want it to go to a GUI but it doesn't I have the Image with the text...

View Article


How to make a scene load more random than others?

Here is a working code where a random scene is loaded via trigger etc between 2 and 5. However I want scene 4 to less likely appear than the others, I hope this is not too complicated, thanks in...

View Article


Find Location via script query

Hi guys I've been stuck on this for about 2 weeks.. I'm using Unity 4.6 open beta. I'm making a type of interactive word search game. What I need to do is find the x and y coordinates of a word in my...

View Article

When I reload a scene, my timer doesn't reset.

This is the code I'm using to reload the scene function Update () { if(Input.GetButtonUp("F")) { Application.LoadLevel("Disco strobe physics"); } When I hit "f" the scene loads with out trouble, but my...

View Article

update highscore if current is higher than previous score

in the script below, the highscore doesn't update at the start, if you have any help it will be appreciated. #pragma strict var High : int; function Start () { High = PlayerPrefs.GetInt("Highscore",...

View Article

How to disable animation.Play? (FPS)

Well, i'm making and FPS, and i'm having trouble with the Aim Down Sights thing, well, i'm my gun script, i have this lines, that play animation and sound when i shoot (press Fire1):...

View Article


How do i call a variable from another script?

So, in a game i'm working on i have a money system and it is in a script attached to a camera, i also have a onTrigger event that takes money away. But i don't know how to call the money variable to...

View Article

An instance of type (Script) is required to access non static member (Script)

-JAVASCRIPT- Well, first of all, sorry about my english, hope you can understand and answer, but let's go. I'm making an FPS and I have an Ammo Box, and an MedKit, but i'm having problens with the...

View Article


Kill player when hit Groung (JavaScript)

Well, i'm making an FPS the map is like a roof, so when you fall and hit the ground, you die, i tried lot's of methods i found here in Unity Answers but none of them worked, so, basicly, when I hit the...

View Article

Script translations

Hi all, I've found this C# and it works pretty well, but I only use JS. Well, I have no knowledge of C# so my question is if someone knows how I can translate the C# into JS. Please help. It's about a...

View Article


error CS0246: The type or namespace name

Assets/FemaleLocomotionPackage/Scripts/MixamoFemaleLocomotionControlScript.cs(4,67): error CS0246: The type or namespace name `Mixamo' could not be found. Are you missing a using directive or an...

View Article

making a progress bar in javascript

the bar is not filling up and also one number is displayed in textblock and level loads.. code: #pragma strict var levelname:String; var loadingscreen:GameObject; var emptybar:GameObject; var...

View Article

How to edit a fade screen script to change color on demand?

**Here is the Fade Screen code; I want to be able to change the color of the fade screen to be a different color depending on how the script was triggered, by dying(RED) or entering a secret...

View Article

How to do transform.LookAt() from a different part of object?

So basically I want to use transform.LookAt() with my sprite but it faces it in a way that it's impossible to see from 2D view.![alt text][1] (don't ask about name of photo I couldn't be bothered to...

View Article


What's wrong with my code? (Collision, JS)

In my FPS you have like a plataform and if you fall from it you're supposed to die when you hit the ground, so i made a box with a collider (removed mesh renderer and added "FallDead" tag) then i...

View Article


Indirect Coroutine Behaviors with UI Buttons, Animator, and SetActive

I've got a menu system setup using UI animations as transitions that overlap (becoming visible/invisible states when they're done), but since they're all still active while invisible so transitions can...

View Article

What's wrong with my script?

Here's the script. #pragma strict var enemy : Transform; private var spawnArea : Vector2; private var canSpawn : boolean = true; function Update () { if (canSpawn == true) { Instantiate (enemy,...

View Article

(Answered)Random.Range Problems?

Here's some of my script function Update () { var spawnArea = Vector2 ((Random.Range(Screen.width, 0)), (Random.Range(Screen.height, 0))); } So I want it to spawn anywhere on the screen but instead it...

View Article


Randomizing Audio

I'm just gonna ask a quick question, If I have for example 6 sounds, how would I be able to randomize what sound should play every half second? I think it can be something like this so this is what I...

View Article

wrong localScale on instantiated object unity

I have a prefab called "element" and it has a re-sizing scale script on it. function Start () { var width = sr.sprite.bounds.size.x; var height = sr.sprite.bounds.size.y; var worldScreenHeight =...

View Article

Sprite with rigidbody2d wont "glide" when gravity is 0

I have a flying plane(sprite) that has a box collider2d, controller script(named Pilot), and a rigidbody2d ![Image1][1] [1]: /storage/temp/38324-inspector.png The plane has an empty GameObject as a...

View Article

Cant acces function in other script

Hi i am trying to acces function in other script on other object but i am getting this error: Assets/selecting.js(12,32): BCE0019: 'ToggleSelection' is not a member of 'UnityEngine.Component'. When...

View Article



localScale not working on my mobilephone

var player : Transform; var left : boolean = false; var right : boolean = false; var arrow_r : Texture2D; var arrow_l : Texture2D; function Update () { if(right == true) { player.transform.localScale =...

View Article
Browsing latest articles
Browse All 373 View Live


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