nullreferenceexception object reference not set to an instance of an object
Please Help #pragma strict public var damage :int; function Start () { damage = damage; } function OnTriggerEnter(p : Collider){ if(p.tag == "Enemy") { GetComponent(EnemyHealth).HP -=damage;...
View ArticleTop Down Game - Camera Follow Player and General Scripting Question
First off, thanks for reading this! I know that there are a ton of this type of question, but because of the changes to **Unity 5**, many of those old posts don't help me. I use **Javascript** (learned...
View Articlecamera falling down when following player!!
I tried many scripts but nothing works. I will go crazy. what can i do for this?? when my player holding to rope main camera slips down. Please take a look: https://sendvid.com/mziuem3u Follow Script:...
View ArticleWhy Does This Script Freeze My Entire Unity Editor?
For some ungodly reason, whenever I try to implement this script, when I press play to test the game, it doesn't actually play. The cursor disappears and it hangs on the editor, not allowing me to do...
View ArticleA script that doesn't allow moving objects to go through non-moving objects?
I have a player, a zombie, and walls. The player does not go through walls or the zombie. The zombie goes through walls. Movement script: var target : Transform; var moveSpeed = 20; var rotationSpeed =...
View ArticleHow Do I Set A 2D Rigidbidy as isKinematic = true through a script?
#pragma strict var gameController : GameController; var rb: Rigidbody2D; function Start () { rb = gameObject.GetComponent (Rigidbody2D); var gameControllerObject : GameObject = GameObject.FindWithTag...
View ArticleStopping Moving Objects?
I need a non-moving wall to repel a moving object. Moving script: var target : Transform; var moveSpeed = 20; var rotationSpeed = 5; var myTransform : Transform; function Awake() { myTransform =...
View ArticleJava to C# and GUI Text to UI Text
I have this Unity script that I would like converted into C# but also if someone could change it so that the Old On Gui Text uses the new UI text on canvas system that would be awesome. var qSamples:...
View ArticleModel TextureBlurring Effect (Optimization)
Heya Guys My Game Really needs Some Optimizing and i Came Up With a Idea How to Do so. This is How it works: The Further Objects(FromThePlayer) are Being Disabled And On Their Place are Textures Of...
View ArticleMake player spawn at point when loading a scene.
In my game I'm making, I have a top down perspective. Its RPG style and when I have the player enter a building, it loads a new scene and starts the player at the door inside the house. Awesome. The...
View ArticleNullReferenceException: Object reference not set to an instance of an object
I am getting the following error NullReferenceException: Object reference not set to an instance of an object Coin.Start () (at Assets/Coin.js:4) This is the two scripts: Coin.js #pragma strict var...
View ArticleIm trying to check what scene my player is on, so I can tell unity what scene...
#pragma strict var maxFallDistance= -10; function Update () { if(transform.position.y <= maxFallDistance) { LoadLevel(); } } function LoadLevel () { if(Application.loadedLevelName == ("Level1")) {...
View ArticleBCE0077 - Scrolling Textures
Hi, I'm trying to make the texture on a cube scroll to the side and I keep on getting error BCE0077 - idk how good my script is but if you have any alternatives or can find the problems in it then...
View ArticleHow to access Animation using java script & attach it to the object ?
i have created the walking & idle animation for my fps player. i've added a java_script to access it. but, when i run it & press button(w), it stops & says that, the animation is not...
View ArticleAnimation doesn't work
I have a lamp and a character, the lamp starts on and the character in idle, i want to do this: when i click the lamp it turns off and the character starts the "lying down" animation, when i click it...
View ArticleIs there a way to smoothly change a float number between two numbers when a...
Building a 2D platformer. Making the camera follow the player but provide more room in front of the player's character so that there is less screen space behind them. Important details to know are that...
View ArticlePutting a game onto a cd?
How do I burn my Unity3D Game onto a disc? I want this to be pretty straightforward. I built the game, and now I want to just burn it onto a disc. No special consoles or anything, just import the game...
View ArticleRagdoll Rigidbody Array?
I have a script in C# and need to convert it to Javascript, and it involves arrays with rigidbodies. //Rigidbody[] bodies=GetComponentsInChildren(); --> C# var bodies : Rigidbody[]; bodies =...
View ArticleLookAt transform plus a y value
I have an object that I want to look at but its transform is where the bottom of the object is and I want to look at the middle of the object. I have tried adding a vector3 but it's not working. help...
View ArticleGrey screen in Roll a Ball???
I am doing Roll a Ball Project and using js script instead of C# !.Whenever I press the play button..the game in working in the game view , but everything else is grey!!Here are the screenshots. **My...
View Article