transform.Translate but Transform has Rotation!=0
Hi there! I was testing enemies movements in my wannabe game, and I've noticed a behaviour that I really don't like. Basically, I got a simple translation function that should move the enemies to a...
View ArticleCheck if Exists and if so, Add it to Other List
Hi there! I've just experienced an odd issue and I'd like to be enlightened on this topic. I'm posting a piece of code in which I'm inside a switch, but that's not so important; what matters is that **...
View ArticleUnity UI image + mask has jaggies
Hi there! The new layout for GUI in Unity is amazing **BUT**, as I was playing around with it, I've found out that one of my canvas' images is rendered with jaggies and I know it shouldn't have them....
View ArticleUI RectTransform Position && Screen Resolution
Hi there! I've noticed that the cloned UI images that I instantiate at runtime are misplaced. ***Here's what I have*** I've got Prefabs that are instantiated via script at runtime at a specific...
View ArticleStateMachineBehaviour + StartCoroutine()
Hi there! I'd like to know, if it's possible, how to StartCoroutine() inside a StateMachineBehaviour script. I've tried the following: IEnumerator WaitSomeThenResetStuff (Animator anim){ yield return...
View ArticleSerializable && Lists - Items become nulls
Hi there! I'm sorry to ask such an open ended question but I'm kinda clueless again about the wonders of C# programming with Unity and I could use some help: I'll be as specific as possible. I've got a...
View ArticleCursor " Hide" is not Immediate, what's wrong?
Hi pals! I was browsing Scripting APIs to find the method to hide the mouse cursor/pointer, and found the deprecated one with Screen. A note pointed me to the updated method, which is Cursor.visible =...
View ArticleUsing Animator, How To Play an Animation Backwards
Hi there! My question is simple: - I've tried setting the Animator's speed to -1 and failed; - I've tried setting Animation's speed to -1 and found out Animation has no speed parameter; - I've tried to...
View ArticleUnity Build nullReference, but editor sees through it!
Hi there, sorry to bother but this kind of errors are new to me because I've been coding mainly inside the editor! It seems that 1 line in my Awake() returns != null when in editor, and == null once...
View ArticleStandalone build fails Application.LoadLevel() and Freezes
Hi there again! I've tracked down another bug of a line that worked fine in editor and, for some reason, it does it wrong in the build. Here's the chunk of code from the scene named...
View ArticleStatic classes and references are bad for Builds... Alternatives?
Hi there! Yeah... that sucks... I've just found out that most of the problems I've been experiencing lately with my builds are related to static classes and references. Well, static classes most often...
View ArticleMore True Randomess - RNGCryptoServiceProvider explanation required
Hay there, it's been a while but now I have a new Question!!! :D I wrote some code that needed randomness and then checked the results "UnityEngine.Random()" was returning . I didn't liked the way it...
View ArticleWeapon Swap Script
Hi there! Right now I've got a Script that consists mainly of an Array in which I plan to store all my Weapons. What I'm trying to do is to let the player swap between all weapons in the Array, just by...
View ArticleonGUI style silly problem
Hi there! Ok so, this is really a basic question, I don't know what I did wrong here: I followed Unity's Doc Tutorials and a couple on youtube, difference is they get things done, I don't! In my first...
View ArticlePixel Perfect Collision 2d
Hi there! I used to program in flash with as3 and I remember there was this awesome script originally made by Troy Gilbert, I think, that improved drastically flash's collisions. Ofcourse I'm not smart...
View ArticleFooling Rate Of Fire C#
Hi again! I'm trying to prevent my player from shooting as fast as he can press the Space Key. I'm programming in C# right now and I find Coroutines a little bit too complex to handle. Instead, what I...
View ArticleCan't Understand GetComponent C#
Hi there. I realize it's my fault here, because I'm just too dummy to understand how it works from the tons of examples everybody can easily find here or in other sites. How do I use GetComponent? I've...
View ArticleWhat do you think of this? List, Vector 3 and Update
Hi there! I know, my question may sound too much generic, let me rush to the point... Here's what I've got: using UnityEngine; using System.Collections; using System.Collections.Generic; // this line...
View ArticleHow to apply damage without Raycast
Hi there! Sorry if this question may look inappropriate but I can't find a solution on my own. First let me try to explain you what I'd like to do: I'd like my enemy to decrease its life of an amount...
View ArticleFlip a Texture?
Hi there! Allow me to ask you another newbie question please... In photoshop I flip a 2d image like this: edit -> transform -> flip; how would I do that in Unity? I mean WITH code. See, I did...
View Article