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

Animation Types Won't Play

So I created an animation in blender, and I exported it as a .fbx to Unity 5. No matter what I changed the rig type to (Legacy or Generic), whenever I attempted to play it with my script, it wouldn't...

View Article


How to disable diagonal Vector3 movement of non-player object using MoveTowards?

Hi everyone, My 3D game has a NPC sprite moving towards it's target object and stopping once it reaches it. I'm after some help on how to prevent the sprite moving diagonally. I understand it must be...

View Article


Make a car change speed over time

In my scene there is a spawner which spawns car every few seconds. What i am trying to achieve is that the car gains speed every 5 sec. What happens with what i tried, is that the car always spawnat...

View Article

NullReferenceException Error

I recently started getting a "NullReferenceException: Object reference not set to an instance of an object" error on my object spawning script and I have no idea why. This hasn't happened before and...

View Article

Object grabbing system doesn't always work on first click.

So I've been using this script for a little while and it works for the most part. It's a bit finicky, as it sometimes works with a single click and other times works after a couple of clicks on the...

View Article


Why does no animation play? [Javascript]

function Update () { if (Input.GetButtonDown("Attack")) { GetComponent.().Play("SwordSlash"); } } This code is attached to my weapon which is in turn attached to my FirstPersonCharacter when i press p,...

View Article

: BCE0049: Expression 'self.berries.SetActive' cannot be assigned to.

Assets/Scripts/BushControls.js(19,25): BCE0049: Expression 'self.berries.SetActive' cannot be assigned to. #pragma strict var berriesTaken : boolean = false; var berries : GameObject; var berryTimer :...

View Article

NullReferenceException: Object reference not set to an instance

NullReferenceException: Object reference not set to an instance of an object Inventory.Start () (at Assets/Scripts/Inventory.js:25) NullReferenceException: Object reference not set to an instance of an...

View Article


how do i make an object destroy after multiple collisions?,How do i create a...

//Test Block script var health = 100.0; function OnCollisionEnter(theCollision : Collision) { if (theCollision.other.gameObject.tag == "Player") { if(health <= 100.0) { health -= 50.0; } else if...

View Article


My movement script will not work correctly?

I fly upwards when I click play. var speed : float = 3.0; var rotateSpeed : float = 3.0; var jumpInterval: float = 5; private var nextJump: float = 0; function Update () { var controller :...

View Article

Java-Multiple inheritance in Networking

I'm having trouble trying to inherit some classes of UnityEngine.Networking Java doesn't have multiple inheritance and I'm getting errors about multiple network managers if I try to put .NetworkServer...

View Article

Null Reference Exception for target in a script on a newly instantiated object

What I'm trying to do is spawn an enemy and create a marker/blip on the Minimap for the spawned enemy. I get a NullReferencException at line BlipCtrl:29. The Blips on the Minimap have a Target...

View Article

Null Reference Exception for target in a script on a newly instantiated object

What I'm trying to do is spawn an enemy and create a marker/blip on the Minimap for the spawned enemy. I get a NullReferencException at line BlipCtrl:29. The Blips on the Minimap have a Target...

View Article


SetActive doesn't work

Well i'm trying to make a menu when the player press Q . and I made the menu as a gameobject and here is my code : var gg : GameObject; private var pauseEnabled = false; function Start(){ pauseEnabled...

View Article

Help fixing a script (error BCE0038)

#Need help with this private var collided = false; function OnCollisionEnter(){ if (!collided){ collided = true; StartCoroutine(PlayAndDisappear()); } } // play and disappear after delay: function...

View Article


Change flashlight color when object is picked up,

I'm trying to make it so when you pick up a gameobject the spotlight color will change. var lt: Light; var MainCam : GameObject; function Start () { MainCam = GetComponent.(); } function Update () { if...

View Article

Adding sound to a script trigger

Hello, I got small Jump scare script that I would like to add sound to it and destroy it after one trigger. I added the variable but i just can't figure out how to get it to work. I would appreciate...

View Article


Getting A Random Between Two Doubles

Apparently in regular Javascript, there is a Math.Random() function that returns a double value between 0.0 and 1.0 so that I can get a random value between incredibly large or small values. Unity...

View Article

how can i set max lookat angle?

var lookPos = hedef.position - transform.position; lookPos.y = 0; var rotation = Quaternion.LookRotation(lookPos); transform.rotation = Quaternion.Slerp(transform.rotation, rotation, Time.deltaTime *...

View Article

Javascript; Wait for animation

I know this question is asked frequently, but none of the answers helps. I want to wait until an animation is finish. My code (not in an Update function): Animation =...

View Article
Browsing all 1875 articles
Browse latest View live


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