Quantcast
Channel: Answers by "Slev"
Browsing latest articles
Browse All 59 View Live

Answer by Slev

The [Animation.IsPlaying][1] field sounds like just what you need! [1]: http://docs.unity3d.com/ScriptReference/Animation.IsPlaying.html

View Article


Answer 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 Article


Answer 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 Article

Answer 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 Article

Answer 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 Article


Answer by Slev

Edit -> Preferences -> Skin Assuming you mean the editor skin and not something in game.

View Article

Answer 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 Article

Answer 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 Article


Answer 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 Article


Answer 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 Article

Answer 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 Article

Answer 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 Article

Answer 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 Article


Answer 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 Article

Answer 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 Article


Answer 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 Article

Answer 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 Article


Answer 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 Article

Answer 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 Article

Answer 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 Article

Answer 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 Article


Answer 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 Article


Answer 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 Article

Answer 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 Article

Answer 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 Article


Answer by Slev

You have a semicolon after your loop clause. That's the problem.

View Article

Answer 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 Article

Answer 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 Article

Answer 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


Browsing latest articles
Browse All 59 View Live


Latest Images