Answer by Slev
The [Animation.IsPlaying][1] field sounds like just what you need! [1]: http://docs.unity3d.com/ScriptReference/Animation.IsPlaying.html
View ArticleAnswer by Slev
You have a typo. It should be: var normalmotor : CharacterMotor = FirstPersonController.GetComponent(); You had an extra period between the function and the type directive.
View ArticleAnswer by Slev
Drag them above and below each other in the list of objects in the scene. The list of objects represents the layering to a degree.
View ArticleAnswer by Slev
I think you just have your ordering wrong. I think you just want: function Update() { if (moveforward) move(); else stop(); } function move() { if (tranform.position.x <= 8) moveforward = false;...
View ArticleAnswer by Slev
The simple way would be to create a monitor script attached to an object in the level, or to the camera. Then we can use [FindGameObjectsWithTag][1] to count them i.e.: int enemy_count = 0; foreach...
View ArticleAnswer by Slev
Edit -> Preferences -> Skin Assuming you mean the editor skin and not something in game.
View ArticleAnswer by Slev
You just need to attach all the scripts to an Object and then call [DontDestroyOnLoad][1] this will ensure the object is carried with you. [1]:...
View ArticleAnswer by Slev
You're rotating around multiple axes. If I rotate 8 degrees y followed by 10 degrees x it's going to rotate based on my rotation positions after the 8 degrees y. The way I generally handle this is have...
View ArticleAnswer by Slev
Yes because each line is making a new text box. Instead what you want to do is something like: if (GUI.Button(Rect(10,500,50,50), "Click")) { num_boxes++; } And then use a loop or something to draw...
View ArticleAnswer by Slev
Ok based on the picture you're flipping the wrong piece of the vector. Try this: if (angle < 270 && angle > 90) transform.localScale = new Vector3(-0.6f, 0.6f, 0f); else...
View ArticleAnswer by Slev
Use both! With fast moving objects colliders will occasionally pass through each other. First step is to set your colliders to continuous detection that will catch more collisions. Secondly, if we...
View ArticleAnswer by Slev
Have you tried using the [Reference Resolution][1] component? That resizes while maintaining object aspect ratios. [1]: http://docs.unity3d.com/460/Documentation/Manual/script-ReferenceResolution.html
View ArticleAnswer by Slev
As long as you see the files on github/your preferred repo host, it's fine. Windows and Linux use different characters to ends lines. Windows uses CRLF which is Carriage Return Line Feed, where as...
View ArticleAnswer by Slev
All of these things can be done using solely the new UI system. However, a lot of the actual game backend would need real code. But every UI feature you described can be handled almost entirely without...
View ArticleAnswer by Slev
When Translating you need to use Time.deltaTime. This will switch your Translates to be frame-rate dependent and allow you to translate in time. For instance Translate(Vector3.forward *...
View ArticleAnswer by Slev
It sounds like you need to redefine how your code is structured. In pseudo code: Raycast verify we are allowed to plant. If yes, use HitInfo to get rotation and position of wall. Instantiate the object...
View ArticleAnswer by Slev
Similar to what Zodiarc said you can simply allow any Chunk to contain a reference to all adjacent chunks. Alternatively you could store every chunk inside of an n-nary tree structure. Both of these...
View ArticleAnswer by Slev
You may want to take a look at the [Screen.lockCursor][1] documentation. You want to add an extra boolean value or some other value as a way to make sure the cursor is locked or unlocked. The other...
View ArticleAnswer by Slev
It sounds like a logic error to me. We don't want to set the parent to null until we are sure we missed the next log. What I can see happening is you press forward, set the parent to null, then the log...
View ArticleAnswer by Slev
You can use [Screen.lockCursor](http://docs.unity3d.com/ScriptReference/Screen-lockCursor.html) to hide the cursor and lock it to the center of the screen. Your bigger question here is how to handle UI...
View ArticleAnswer by Slev
Welcome to the magic of [Tags!][1] Tags allow you to set what can collide with what. For instance in your collider code, you can simply specify that missles can collide with each other, but enemies can...
View ArticleAnswer by Slev
I believe your array class is wrong. enum getWords doesn't contain strings, it contains aliased values... [This is the documentation for how enums in C# work.][1] I believe you want: private getWords[]...
View ArticleAnswer by Slev
You're a little unclear on the breakdown here... but the gist would be... //in C# for (int i = 0; i < num_children; i++) { GameObject g = Instantiate(childObj, position, rotation);...
View ArticleAnswer by Slev
You should never redefine the constructors of classes that inherit from MonoBehaivor, it will break things. You should treat Start() as a pseudo constructor as we know it will always be called.
View ArticleAnswer by Slev
I'd recommend something like Primm's or Dijkstra's algorithm as it will find you the shortest path. You can find more info on path finding here: [Pathfinding][1] For rendering lines in Unity you could...
View ArticleAnswer by Slev
The Coroutine stops because it has reached the end of its function while (spawning == true) { //do stuff } //leave function Instead what you want to do is: while (true) { //or some other control value...
View ArticleAnswer by Slev
Very generally... using UnityEngine.UI; //Stuff void SomeFunction() { InputField[] inputs = GameObject.Find("Name of Canvas").GetComponenetsInChildren(); inputs[0].text = "Text here"; } This is rough...
View ArticleAnswer by Slev
The way I've been handling popups and inputs is to use tags. So for instance I have a check in one of my input scripts if (GameObject.FindWithTag("Popup") == null) { //allow inputs to be handled }...
View Article