Quantcast
Channel: Answers by "Ricewind1"
Browsing latest articles
Browse All 42 View Live

Answer by Ricewind1

Vector3 newRotation = new Vector3(go2.transform.eulerAngles.x, go2.transform.eulerAngles.x, go2.transform.eulerAngles.z); gameObject.transform.eulerAngles = newRotation; Or the following (untested)...

View Article



Answer by Ricewind1

I haven't done much myself with audio yet, but seeing your code you're missing out on one thing. You're increasing and decreasing a value called "audio". I don't know what that will do, but in your...

View Article

Answer by Ricewind1

At least one of your 2 objects needs to have a rigidbody. Furthermore they both require a form of collider. When referencing the collider in the script make sure you have the right gamecomponent (ie....

View Article

Answer by Ricewind1

You could create a mini collision script and add it to both trees when they are instantiated. This way you'll be sure to only destroy the one triggering the collision event. You can even let this code...

View Article

Answer by Ricewind1

You could always use a list instead as a work around. public List testB;

View Article


Answer by Ricewind1

Use a separate gameObject, prefab, model or whatever you like to call it for your cover. Give it a collider and use a collision function/method in it's script. You can then say that it gets destroyed...

View Article

Answer by Ricewind1

Id recommend using a list which contains the gameobjects. Better even would be to create a custom class that holds extra information such as the required level, a cost, etc and put one of the weapons...

View Article

Answer by Ricewind1

You have to calculate things yourself for this one. Instead of having a button appear 10px from the left, you just say screen.width/20. You'll have to do this for everything though. Everything should...

View Article


Answer by Ricewind1

You need to reference the script you are using first, like below: Flashlight fLight = other.GetComponent(); //Assuming that "other" has the flashlight as a script on its gameobject...

View Article


Answer by Ricewind1

I'm no astrologist either so I'm not sure how galaxies work; but lets say each one has a sun. Start by spawning a sun and a random amount of planets around it with random distances from the sun. Do...

View Article

Answer by Ricewind1

The code below de-activates all children of the mentioned gameobject's transform foreach (Transform child in transform) { child.gameObject.SetActive(false); } Or to reference them for future use:...

View Article

Answer by Ricewind1

Throw this in the start of the player. if(!networkView.isMine) { //remove component for looking.controlling character } Or if(networkView.isMine) { //Allow input }

View Article

Answer by Ricewind1

I Managed to resolve this issue but I'm not very happy with it. It works however. Let me explain how I achieved this for anyone who needs it for future reference. I started out by making a cude, adding...

View Article


Answer by Ricewind1

Add a check that sees if Playerprefs is null or not. Just skip setting playerprefs or return null. Load and set playerprefs related fields in void Awake() or make playerprefs static and load...

View Article

Answer by Ricewind1

The following code should work (Using JSONFx 1.4) (works similar with JSONObject and other JSON variants) public static string FiletoJSON(object T) { try { StringBuilder sb = new StringBuilder();...

View Article


Answer by Ricewind1

You can take a look at http://docs.unity3d.com/ScriptReference/PlayerPrefs.html or just serialize your own data somewhere. I'd recommend using a separate class that holds the data for all the players +...

View Article

Answer by Ricewind1

"because of unsupported data on target platform." You have to find out what this data might be. An uint64 has a max value of 18.446.744.073.709.551.616 or 16.777.216 Tb I don't think that uint64 is...

View Article


Answer by Ricewind1

My guess is that 'grounded' keeps becoming true, thus the counter is rest to 0 every time. Either use the game's own .isGrounded function or `function IsGrounded(): boolean { return...

View Article

Answer by Ricewind1

"Making a GameObject inactive will disable every component, turning off any attached renderers, colliders, rigidbodies, scripts, etc... Any scripts that you have attached to the GameObject will no...

View Article

Answer by Ricewind1

Best bet is to cast an overlapsphere at the point of collision with an enemy, the hit every gameobject with the tag "enemy" within the radius of that overlapshpere....

View Article

Answer by Ricewind1

Ontriggerstay should be used. This is called every frame the gameobject is entered by the player. In the ontrigger method, you can check if the player is completely inside the object with...

View Article

Browsing latest articles
Browse All 42 View Live




Latest Images