Quantcast
Channel: Latest Questions by RoboticSarcasm
Browsing all 40 articles
Browse latest View live

[CLOSED] Question about my code [javascript]

Hello people of the interwebz, as a person who is extremely new to coding and still in the progress of learning, can you guys perhaps check out what's wrong with this code? i can't get it to work. (PS:...

View Article



GUI.Label only showing variable name not value

Whenever i play the game it just shows currentHealth in the top left corner, which is the name of the var in stead of the actual value. As i am pretty horrible at coding, is there anyone smarter out...

View Article

Illogical error in code[FIXED]

var fireTimer : float = 0; var bullet : Transform; var force : float = 2000; var CrossbowShot : AudioClip; var fireState : float = 1; function Update() { if(Input.GetButtonDown("Fire1")) { if...

View Article

Code not doing anything

Hello everybody, i modified a piece of code that i found for an inventory system, and after i changed it it doesn't work anymore. The only piece of code that was modified was the following: function...

View Article

How do i smoothen this movement?

I've made a 2D movement script but when i jump it is very jittery once the gravity kicks in and you're still pressing W. Does anybody know how to smoothen it a bit? using UnityEngine; using...

View Article


How to only jump when grounded

So i have this basic 2D player code that can jump and move horizontally but the jump can always be initiated, even when already in air. How do i fix this? Code here: using UnityEngine; using...

View Article

How to find an object in children

Hello everyone, in my game there is a prefab enemy which has an empty object called 'enmshotPos'. Every enemy has this. When an enemy shoots it finds the enmshotPos. The problem here is that EVERY...

View Article

Code not working, don't know why

This code is attached to a projectile which is supposed to lock on to the closest object tagged with Enemy. I have no idea why my code doesn't work, so i am hereby asking if anybody knows how to fix...

View Article


Raycast rotating with object rotating

Hello everybody, i have a moving and rotating object that shoots out raycasts to see if there is any obstacle in a specific direction. The problem is that with my current code, the raycasts don't...

View Article


boolean never returns false

Hello everybody, in my AI code i want my NPC to, for instance, turn right if there is an obstacle left of him. I detect this by raycast and set a boolean to true so that it moves if obstacleleftofyou...

View Article

var using time.time not resetting?

so in my code i have a variable that equals Time.time that only runs when a boolean is true, and i have it set to 0 if that boolean is false. However, when i turn that boolean back on the timer just...

View Article

Weird bug i encountered with 2 screens. Any help?

This bug has occured when i set up my 2 screens. How do i fix it? ![alt text][1] [1]: /storage/temp/26484-unity+bugged+screenshot.png Basically the bar with the play button is unusable which fucks me...

View Article

NullReferenceException[C#][FIXED]

Hello fellow unity devs, i was coding away at a kind of spawning system but it just doesn't work, and i can't figure out why. It throws a NullReferenceException whenever i call SpawnStump(). Actual...

View Article


Player moves to camera Z position when not told

So as i was working on my camera code i came across a rather big issue. While i finally figured out how to move the camera to the players Y position smoothly, it happened to also place the player's Z...

View Article

Random number exclusion works only once [C#]

So for the game i'm making i want to spawn a score box randomly at any one of my preset spawn locations, however because i don't want the box to spawn at the same position as the previous one i have...

View Article


Saved int always returns 0 when loaded [C#]

Hello everybody, as the the title suggests, every time i load up the oldHighScore int in my code, it always returns 0, and i can't for the life of me figure out why the heck it's doing it. It's...

View Article

Boolean only toggleable to one state [C#]

I may be going crazy, but aftera long while of trying stuff i can't manage to see how to fix it as i don't have the slightest clue why it happens. I can either only turn the boolean to true from false,...

View Article


Teleporter teleports one way not back [C#]

Hello everybody, after the writing of this code, that is supposed to be a two-way teleporter (you can teleport to another teleporter and SHOULD teleport back), ive run into a problem. It only teleports...

View Article

Issue with seed-based generation [C#]

Hello everybody, after tinkering around with seed-based generation, i have run into an issue. I use part of a float and turn it into a string, but the string always becomes something along the lines of...

View Article

Accessing Transform that has been destroyed [C#]

Okay, so i've been trying to make this code work for a day now, but it's just not working. Whenever i destroy the closest enemy, i want to check for the enemy that is now the closest, but it keeps...

View Article
Browsing all 40 articles
Browse latest View live




Latest Images