Quantcast
Channel: Answers by "Superrodan"
Browsing latest articles
Browse All 62 View Live

Answer by Superrodan

The second bracket is in the wrong spot. it should be after your if statement not before your if statement. Like this: void Awake() { if( Application.loadedLevelName == "Level 01") {...

View Article



Answer by Superrodan

If you call the don't destroy on load function on your music player, then it won't be destroyed when you switch between scenes. The only problem is that if you return to the scene where you started the...

View Article

Answer by Superrodan

Ok, so the answer was simple and I was WAY overthinking it. Instead of using a transparent background in photoshop I just needed a layer of white beneath the decal. Now it works perfectly and I can get...

View Article

Answer by Superrodan

The way to do this is to have a variable you store somewhere globally. I did this with a playerprefs variable so that if I turned off the game and came back it would remember the volume I wanted. So...

View Article

Answer by Superrodan

Warning: This is just a guess. I don't think you want to animate the ball but I'm also not sure making it into a physics object is the right approach either. Instead you probably want the ball to be...

View Article


Answer by Superrodan

This thread might help you: http://forum.unity3d.com/threads/dynamic-draw-order-or-2d-z-buffer.220231/ Specifically this post:...

View Article

Answer by Superrodan

I'm not 100 percent sure because I'm also a novice but I think the problem is that you have the parenthesis in there. Room is not a function so you do not need parenthesis. new Room()[roomDensity];...

View Article

Answer by Superrodan

For me the easiest way to accomplish this is with "Invoke". http://docs.unity3d.com/ScriptReference/MonoBehaviour.Invoke.html Put whatever you want to be delayed into its own function and then invoke...

View Article


Answer by Superrodan

You may need to disable mip maps for the texture you are using. To do so, click the texture file itself in the editor, and uncheck "Generate Mip Maps" if it is checked.

View Article


Answer by Superrodan

What you want to do is use "transform.forward" in your code instead of Vector3.forward. Vector3.forward is in world space and always goes in one direction based on world space. "transform.forward" goes...

View Article

Answer by Superrodan

Does it work if you change this line: player = GameObject.FindGameObjectWithTag("AIPlayer").GetComponent(); to player = this.gameObject.GetComponent(); Because this script is on every enemy, I believe...

View Article

Answer by Superrodan

When you return to the menu you will have duplicate objects. Both objects have this code on them: if (FindObjectsOfType(GetType()).Length > 2) { Destroy(gameObject); } What I believe might be...

View Article

Answer by Superrodan

In this example if it can't find a float with the NAME key then it will use the 1.0f. PlayerPrefs.GetFloat("NAME", 1.0f); In this example it would return 0.0f as the default since you didn't set...

View Article


Answer by Superrodan

I think what you may want to do is have code like this pseudo-code below on the object you want to update the information in the slider: private Slider health; private Slider mana; private Slider...

View Article

Answer by Superrodan

Is your ball a class? As in the above variables are in a single script called something like "Ball"? If so, you'll probably want to use a List. Here's a tutorial about Lists that makes it easy:...

View Article


Answer by Superrodan

The below is just theory and how I would go about trying to accomplish this using the built in 4.6 UI. Step 1. In whatever script handles your input, instead of the code where you detect input...

View Article

Answer by Superrodan

The two scripts you have look a little redundant. The first one is a trigger script specifically meant to raise a specific wall. It finds an object in the scene called "verticalWall_1" and raises that...

View Article


Answer by Superrodan

You can't change an individual color value directly I can't explain why but I can tell you how to fix it. Color temp = button.image.color; temp.a=0.5f; button.image.color = temp;

View Article

Answer by Superrodan

Ok, after finally figuring out what to search for I found an answer here: http://answers.unity3d.com/questions/623878/how-to-restart-mecanim-state-animation-or-play-it.html What I needed to do was...

View Article

Answer by Superrodan

This is just a guess, but do you have using UnityEngine.UI; At the top of your script? I know when I use Text elements I need that there, but I'm not sure you would need it for a GetComponent.

View Article

Answer by Superrodan

If the point you want to point towards is a rotation vector you can use RotateTowards, I believe. Quaternion myQuat = Quaternion.Euler(transform.localEulerAngles); Quaternion targetQuat =...

View Article


Answer by Superrodan

This may not be what you're looking for since it's a really simpl fix and I have no idea how experienced you are with unity, but did you by any chance switch to the hand tool at the top of your screen?...

View Article


Answer by Superrodan

You will likely need to use floats and the time functions in Unity to accomplish this. Something like this pseudocode solution should probably work. Replace "theTimerShouldBeGoingUp" with whatever...

View Article

Answer by Superrodan

I wouldn't recommend using physics for this since you don't want gravity, and you don't want the object to be movable. What you can do is create a script that just makes an object move in the way you...

View Article

Answer by Superrodan

Then this should be extremely simple. All you need to do is create a script that moves the object downwards every frame. Here is a quick and dirty example that uses a speed per second: public float...

View Article


Answer by Superrodan

I would create a list with them. I'm relatively new at lists and haven't used them much but I would try to do something like this: public int GetANumber() { List numbers = new List(); numbers.Add(1);...

View Article

Answer by Superrodan

After reading a bit more about Lerp it's not the halfway point so much as the point represented by the third variable in the parenthesis. It's only halfway if you put 0.5 in. Still, I still believe...

View Article

Answer by Superrodan

The way I handled this in my game was to in addition to my 2d array create separate public arrays for each layer. So for you it would be 7 different arrays of ten elements each. This allowed me to have...

View Article

Answer by Superrodan

The reference to change is ".text". For example: MessageCentreText.text = "this is my text"; Of course, that's only half of it. To make a button do that, you'd need to put it in a script. Something...

View Article



Answer by Superrodan

Audio.Stop does not affect it. I have found my problem and it was a mistake in my inspector. Two floating platforms' scripts were referencing the one I was trying to move. This had the result of both...

View Article
Browsing latest articles
Browse All 62 View Live




Latest Images