Quantcast
Channel: Answers by "ransomink"
Browsing all 80 articles
Browse latest View live
↧

Answer by ransomink

You can distinguish between multiple components by using GetComponents. HingeJoint[] hingeJoints; void Awake() { hingeJoints = GetComponents(); } They will be placed in order from top-to-bottom. If the...

View Article


Answer by ransomink

Don't use SendMessage() or BroadcastMessage(), they are extremely slow and very painful to debug because you pass in a string. They are seldom used for quick prototyping to get something up and running...

View Article


Answer by ransomink

Is this in the bullet script? Make sure both the player and bullet have the Player tag. Also, use CompareTag() instead... void OnTriggerEnter2D( Collider2D other ) { // Not the player? if (...

View Article

Answer by ransomink

Why use *transform.gameObject* for DontDestroyOnLoad(), then use *gameObject* for Destroy(), no need for using transform. Also, you call Input.GetAxisRaw() 14 times in Update(), that's bad. You need to...

View Article

Answer by ransomink

Now, you can simply click & drag a component to change its order...

View Article


Answer by ransomink

You're trying to divide a WaitForSeconds type by an integer type. You must divide by an int or possibly a float value...

View Article

Answer by ransomink

What line is the actual error on because this isn't where the problem lies. WaitForAnim takes 1 argument (anim) but you've used it—somewhere—without placing an anim parameter. - WaitForAnim takes 0...

View Article

Answer by ransomink

In Edit > Project Settings > Physics, use the Layer Collision Matrix and choose what layers to ignore each other...

View Article


Answer by ransomink

The first problem I see is setting up your variables. You create float variables, then cast them as floats, that's unnecessary. You were likely getting an error because you left out the "f" after each...

View Article


Answer by ransomink

using System.Collections; using System.Collections.Generic; using UnityEngine; public class EnemySkullMovement : MonoBehaviour { public float speed; private float distance; private float step; private...

View Article

Answer by ransomink

Did you test and see if it works? There's nothing wrong with it. No reason to create a variable only to return it on the next line...

View Article

Answer by ransomink

No problem, you'll want to check the player's previous position against their current position. If the distance is the same or minimal (using a tolerance), they're not moving. When the player moves,...

View Article

Answer by ransomink

On which line is the null reference exception? That'll tell us what variable to look for. It seems *resetCol* could be null because you say the array is empty. This is because *resetCol* must have the...

View Article


Answer by ransomink

You can import your sprite as 2D and UI, then place it on a canvas as a UI Image and use it with the button component...

View Article

Answer by ransomink

I think it could be a bit simpler. I wouldn't have so many operands at once because if one condition is not true, you won't have to check the others. A simple way to measure time, you can do: public...

View Article


Answer by ransomink

Just go to the Unity [Learn][1] section. There is an abundance of tutorials. Everything is there for you. Learn and have fun... [1]: https://unity3d.com/learn

View Article

Answer by ransomink

Vector3Int was implemented in Unity 2017.2.0 as you've stated. You are using an older version, Unity 5.6.5. That is why it does not exist. As Bunny83 mentioned, there are many versions after 5.6.5. If...

View Article


Answer by ransomink

GetComponents() will get all audio source components on the game object attached to this script. If there is only one audio source then it will only have one in the array. They will enter the array in...

View Article

Answer by ransomink

Did you download it from here: [2D Roguelike][1]. I believe It informs you of any changes from the updated version... [1]: https://unity3d.com/learn/tutorials/s/2d-roguelike-tutorial

View Article

Answer by ransomink

First, make sure the enemy has the "Enemy" tag. Also, A Kinematic Rigidbody 2d cannot collide with another; at least one of the rigidbodies must be set to Dynamic. Since your sword is Kinematic, your...

View Article
Browsing all 80 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>