Quantcast
Channel: Answers by "ransomink"
Browsing latest articles
Browse All 80 View Live

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

Answer by ransomink

Only the last one is shown because you're overwriting `text.text ` multiple times. It is working but each line replaces the previous one until the final call (which is the result you see)...

View Article

Answer by ransomink

You can do at least two different approaches: The first one rounds the float to two decimal places to avoid floating point imprecision. private int _iteration; private float _timer = 0f; void...

View Article

Answer by ransomink

There are Unity Assets for multiple tags. I'd check them out if you're really interested. Besides that, you can use inheritance if that's what you're thinking about. Is it something like, a sword is an...

View Article


Answer by ransomink

If it's the only camera inside the scene and tagged as MainCamera, just use View = Camera.main; to set as a reference - The easiest solution is to create a public variable and drag-n-drop the camera...

View Article

Answer by ransomink

pos = new Vector3( valueX, valueY, valueZ ); First, you set the `pos ` variable based on your *valueX*, *valueY*, and *valueZ* but they are private (not accessible in the inspector and are changed...

View Article


Answer by ransomink

Just drag the scripts back onto your game objects and everything will work fine...

View Article

Answer by ransomink

If you already know the position you want the player to move to, check if the player collided with the trigger and set it to the teleport position [SerializeField] private Transform teleport; private...

View Article


Answer by ransomink

you have to click on the sprite sheet from your project folder and change the pixels per unit. A smaller number increases the sprites' size in the scene...

View Article

Answer by ransomink

Restricted Asset means the author of the asset has their own specific license terms. Typically, if/when you download a restricted asset, a license file is contained within the package; read and follow...

View Article

Answer by ransomink

you don't need to download any assets to make a game. some tutorials download assets to use in their video/blog but it's not necessary. you can use the provided primitive shapes and create simple...

View Article

Answer by ransomink

Is your bigBrother game object already in the scene? If it is, then you just need to do: `bigBrother.SetActive(true);` when the object's collide ---------- If you want to spawn your bigBrother object...

View Article


Answer by ransomink

Your code looks fine, I believe you are using the prefab of the spider instead of the one from the scene and that is causing the issue...

View Article


Answer by ransomink

You're not getting the Slider component, it should be: `FuelShower = GameObject.Find("FuelShower").GetComponent();`. Also, if the game object is already in the scene, it's easier to drag it into the...

View Article

Answer by ransomink

The Text component has a `fontSize ` property. Make sure to check the docs for information on the class you're utilizing: [UI.Text][1] [1]:...

View Article

Answer by ransomink

You can't use a Rigidbody component with a CharacterController. The CharacterController component handles its own simulation, so remove the Rigidbody component

View Article


Answer by ransomink

If you know both points of the line you can simply use Physics2D.Linecast. Including that, either a Raycast or CircleCast will all work depending on how you want to detect the ball. [Raycast][2] is a...

View Article

Answer by ransomink

You are declaring a local `MousePos ` variable in your Update method; this value is being used in your Instantiate method because both are in the same scope. Your class variable `MousePos ` is not...

View Article

Answer by ransomink

Using `FindWithTag ` is okay is used in Awake or Start. Just best to avoid in Update, methods called multiples times per frame or often. FindWithTag will return a `GameObject ` type but your list is a...

View Article

Answer by ransomink

Easiest solution is to create a dictionary with a collider as the key and coroutine as the value private Coroutine _routine; private Dictionary _colliders; ---------- In DealDamage, after assigning the...

View Article



Answer by ransomink

Inside your foreach loop, you get the `Text ` component: this is Unity's UI Text component, not Text Mesh Pro's. First, make sure you have `using TMPro; ` to access any Text Mesh Pro class and get the...

View Article
Browsing latest articles
Browse All 80 View Live




Latest Images

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