How to calibrate accelerometer according to start ?
I think i have a "should be" working code but i don't know why it is not working. With this code too i have to hold the phone straight to get it to work. My present code is below. Any help is...
View ArticleTrigger enabling component works in one statement but not another?
For the death/win screen of my game I've added a depth of field script that works for the win screen but not the death screen? It's the exact same code in the if statement and I've tried debugging it...
View ArticleUnable to disable a C# script with a JS Script
I can't seem to disable "DepthOfField.cs" with my "Bino.js" script, this is the code used: #pragma strict var zoom : int = 20; var glassesVision : int = 80; var normal : int = 90; var smooth : float =...
View ArticleUnknown Identifier : Hunger?
Hello! I am very sorry that I am probably asking a very basic question. I am not that good at scripting in Unity. I am trying to create a script that will display when hunger = 0, the game restarts....
View ArticleChanging a texture when the player is close
So i am trying to make a camera system with 2 different feeds, i have a thin box collider on the player and when the box collider touches the collider of the camera changes the texture of something if...
View ArticleHow does the SendMessage function in WebGL JavaScript work?
The [manual][1] says I can call methods in Unity from JavaScript in my browser using SendMessage: SendMessage ('MyGameObject', 'MyFunction', 'foobar'); However, I'm really confused about how to use...
View Articleformatting issues
i'm writing a script in unity to simulate a future arduino project for a 4 axis robot arm, to make sure the kinematics work out i wanted to simulate it in unity. however, i'm having some formatting...
View ArticleWhy won't this variable change even when the if part is true?
This code is in the update function. I tested some stuff out and instead of -= or +=, i just did = and it worked. Is there something wrong with the code? if (Input.touches[0].position.x < 100) {...
View ArticleScript.Enabled does not work in Unity 5+
Hello! I've read all topics about it but somehow I cannot make it work. How can I disable a script using javascript in Unity 5+? ScriptName.enabled = false; GetComponent("ScriptName").enabled = false;...
View ArticleInventory System: NullReferenceException Error
Hey guys, i seem to be non stop getting this NullReferenceException Error for nearly every single thing i code, ive asked numerous times on this forum and no one has ever replied, First it was with...
View ArticleGameobject reference disappears at start
My game has objects falling and the player moves (a cauldron) to collect them and gain points. I am trying to make a Slider into a progress bar by setting its value equal to the score. I also have some...
View ArticleTile Slide
I'm trying to make it so that when the screen is swiped a certain direction (left, right, up, down), the player, which is a tile, slides down a certain amount. I've tried many different numbers using...
View ArticleWhy is my script only running when object has been selected beforehand?
This piece of Javascript is giving me troubles. var originalPosition : Vector3; var osHeight = 0.05; var delay = 0; function Start () { // when the object starts, we record its initial position...
View ArticleResources.Load(filename) as Sprite is returning null
The path-name is correct. public var pic : Sprite; function Start(){ pic = Resources.Load("Targets/1") as Sprite; //pic becomes null }
View Articlehow can i control a float in Javascript with a UI Slider
here is my script i want to control Factor Var with a Slider from unity UI kina like a power meeter #pragma strict var factor = 100; private var startTime : float; private var startPos : Vector3;...
View ArticleObsolete API updating can't work, errors not fixed
Hi, I download a project, for sculpt at runtime, the script seems to be obsolete but the API updating can't work because the code presents some errors. It's java and I don't have enough experience to...
View ArticleArray bug or script error
Hello, Yeah array script are famous on unity answer, but this is wierd for sure, here's the begining of my script: var Gauche:boolean[]; var Numero:int; function Start () { Numero=0;...
View ArticleScriptable Object Syntax in Javascript
Hey folks, I'm trying to make some scriptable objects to contain variables and functions for different tools in my game. However, I can't find how I'm supposed to make 'em in Javascript so that my...
View ArticleScripted tank track bones behave strange
Rigged and scripted Tank track mesh and bones behave strange when tank rotating. Actually bones are problem.I'm using existing script i found on internet and slightly edited it. I'm 3D designer but i'm...
View ArticleAudio Endless Loop c#
When script plays an audioclip when the timer runs out, however it keeps playing the sound endlessly on every frame and it sounds bad and makes the game lag. I have the audio's loop value set to false....
View Article