r/Unity3D – Telegram
r/Unity3D
265 subscribers
12.7K photos
15.6K videos
14 files
48K links
News about the Unity engine and project showcases from Reddit. Made possible with @reddit2telegram (@r_channels).
Download Telegram
Help with Physics2D casting

Hi,

I’m making a top-down shooter and I’m trying to use Physics2D.CircleCast around the player to detect whether there is anything in the way, to stop the player from being able to move.

Currently the player moves by calling new Vector3 on update, so using Unity’s Rigidbody2D system wouldn’t work.

This is the way I tried using circlecast (will paste more code if needed):

>

My idea was if the circlecast returns true (colliding with something), it disables input.

The editor did not throw any errors with this so I assumed it returned a bool and it was fine, however it would not interact with any of the other colliders in the scene.

I’m sure the process would be very easy by just making the player with a Rigidbody2D and applying velocity instead of changing the vector position. However I wanted to make this game without using Rigidbodies.

If anyone would be willing to share any insight about CircleCast or any alternative way of going about this, I’d greatly appreciate it!

Thanks

https://redd.it/1gmgf46
@r_Unity3D
Doubts about tilemap animations. Is the animation culled when outside the camera?

Hey everyone, I have been making some touch-ups for optimization with the tilemaps.

I've expected to be able to control the culling mode for the tilemap animations (just like with animators), but, based on what I researched, it doesn't seem to be possible.



With that in mind, is the animations from the tilemap already culled when outside the camera?

And if is not, it is at least optimized (not my case, but this sounds even worse if the tilemap collider is changin with the animation, taking even more resources to update the composite collider of the tilemap) or is their a way to disable the animations with noscripts?

https://redd.it/1gmh8m1
@r_Unity3D
Are there good dev habits to avoid a disaster like this?
https://redd.it/1gmi5ss
@r_Unity3D
Canvas and TMP texts in Unity 6

Hi, I was doing a prototype of a twin stick shooter in unity 6 and I needed a few quick ui elements. Canvas and tmp texts are a true nightmare to use compared to the previous lts release, so either Im doing something wrong or they really broke it. Im switching back to a previous version but I cant just believe its broken like that. Anybody else had troubles moving texts, organizing elements on canvas, visualizing it, and so on?

https://redd.it/1gmlgy3
@r_Unity3D
This media is not supported in your browser
VIEW IN TELEGRAM
I'm working on an 'infinite resolution' (textureless, procedural) portal shader.

https://redd.it/1gmhn8y
@r_Unity3D
Extension Kit for Unity

I made an Extension Kit for Unity developers which simplifies usage of 150+ functions by letting you call them with a single line of code. It is 50% off and expires in three days.

Get it now

What is Extension Kit?

Extension Kit is a powerful collection of 150+ C# extension methods designed to simplify Unity development. Each method is well-structured, editable, grouped, and providing single-line access.

Reach me out via dm if you would like to have a free version to review.

https://redd.it/1gmssxb
@r_Unity3D
Is there a way to get my model to look like this in Unity?
https://redd.it/1gmrhcy
@r_Unity3D
Random.Range doesn't work

Hi Guys,

So I'm currently new to Unity and programming in general, and I wanted to try making a visual memory game where you have to remember a pattern and right at the beginning I stumble to a problem i couldn't fix. so my plan was that i get a random number from the Blue Tile int and i gave each Tile a bnr (Box number) in an order which a calculator would have. And my plan was just to get 1 number and that if the Blue Tile int had the same number as one of the 9 Tiles it would be Blue

https://preview.redd.it/b5vpmihvdrzd1.png?width=2560&format=png&auto=webp&s=f022f1d05796e23c78e85af046a873a13aedeced

https://preview.redd.it/riav6olxdrzd1.png?width=2560&format=png&auto=webp&s=2ec8e345da7869601bb7d1b12d5c451bba7d4507

https://preview.redd.it/v53hws3zdrzd1.png?width=2560&format=png&auto=webp&s=8f0f47ce0236b5d4f3f583d17a8636aa5f81ce37

Now my Problem is that sometimes 2 Boxes or 3 Boxes get Blue or sometimes even noone, but I can't figure out why. Im thankful to anyone who comments under this post.

https://redd.it/1gmvqiz
@r_Unity3D
Help for absolute beginner with C# and Unity

Hi Guys,

I'm an absolute beginner and I'm really stuck on this. I was following a tutorial to make a 2D game in Unity. I cannot make a drop down for 'Animator' appear in the noscript window in Unity (see below - highlighted in purple). Below is the code I've written. Can someone please tell me where I'm going wrong?

https://preview.redd.it/17c0yq5ywrzd1.png?width=1158&format=png&auto=webp&s=5077132966b3bd98d465c37cce505c97c423bc3a

https://preview.redd.it/mzk80m6xxrzd1.png?width=416&format=png&auto=webp&s=5137c2d1932909ae58159f15e60bc136e3881bba




using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Player : MonoBehaviour
{
    // Start is called before the first frame update
    public float moveSpeed = 5f;
    public Rigidbody2D rb;

    Vector2 velocity;

    public Animator animator;

    }

     void Start()
    {
    }

    // Update is called once per frame
    void Update()
    {
        velocity = Vector2.zero;
        velocity.x = Input.GetAxisRaw("Horizontal");
        velocity.y = Input.GetAxisRaw("Vertical");

        UpdateAnimation();    
    }

   
    void UpdateAnimation()
    {
         if (velocity != Vector2.zero)
        {
            animator.SetBool("Walking", true);
            animator.SetFloat("Horizontal", velocity.x);
            animator.SetFloat("Vertical", velocity.y);
        } else
        {
            animator.SetBool("Walking", false);
        }
}

void UpdateMovement()
{
    rb.MovePosition(rb.position + velocity moveSpeed Time.fixedDeltaTime);
}








https://redd.it/1gmy6zd
@r_Unity3D
I'm so proud of this shot
https://redd.it/1gmum9v
@r_Unity3D
Apply generic border to a tiles in a tilemap for procedural generation

I am making a topdown tile based game in unity, currently I am generating a heightmap and using that heightmap I am assigning it to layers of tilemaps. Eg at height 4 I assign a dirt tile to tilemap 1, 2 and 3 and then a grass to 4.

But due to this there isnt a way to differentiate different heights so i would like to apply a generic black outline as well as a collider to all tiles based on whether or not there is a neighbouring tile on that tilemap. I had a look at unity ruletiles but from what I've read it seems that for every single new tile I add I would have to redo all the tile rules just to gain the same affect (I have also heard of the idea of overlaying another tilemap on top of the pre exsisting one with the borders added but this seems inefficent and I am already layer tilemaps). Ideally I would want all tiles to inherit a generic way of generating an outline. What would be the easiest way of going about this am i overlooking something?

https://redd.it/1gmyfci
@r_Unity3D
How can I make an Animation freeze on the final frame instead of looping?

https://preview.redd.it/6ajzhnjr4tzd1.png?width=1232&format=png&auto=webp&s=353aca5845a5573844b7cba6222e90a3f99eca3d

In accordance to all of the documentation I have found, I changed the following settings to 'Clamp Forever' but that made absolutely no difference.

Additionally, I even tried having this function fire at the final frame of the animation, and it does fire as the logs show me, but again, the animation just continues to loop as normal.

// Pauses the Animator
public void FreezeAnimation(){
print("STOP ANIMATIOR");
anim.speed = 0;
}

This feels like it should be extremely simple but I've spent over 4 hours trying to get this to work

https://redd.it/1gn2jo2
@r_Unity3D
Prefab text bleeding over into another Prefab

A quick explanation of my use case. In my Unity App, I have a button that when clicked prompts the user to put in two fields of text. After that, I have a Prefab that is created to display the text.

The Prefab is an empty object, that has Four Children. (See attached Image)

The first child is a Canvas that has a Content Fitter (Vertical Fit: Preferred Size). It then has a child that has a TextMeshPro Text (Date), and another child that's a TextMeshPro Text, this is where the text the user put in is displayed, (Content Size Fitter: Preferred Size) As well there is an Image and a TextMeshProText (Title)

The second child is a Canvas that has a Content Fitter (Vertical Fit: Preferred Size). It then has a child that has a TextMeshPro Text (Title), and another TextMeshPro Text, this is where the text the user put in is displayed, (Content Size Fitter: Preferred Size) As well there is also an Image.

The third child is an Image

The fourth child is a button.

ISSUE:
The issue is the text that is being displayed is bleeding over into the next prefab created (see attached image). Does anyone know how to prevent this from happening?

https://preview.redd.it/dbk2za35otzd1.png?width=524&format=png&auto=webp&s=3d2bf5834a03670271905de443793710edc86c31

https://preview.redd.it/d5mfodc6otzd1.png?width=524&format=png&auto=webp&s=1dc30e3b6eb8407e30fd8f8f3a214da249baa8b4



https://redd.it/1gn47xs
@r_Unity3D