r/Unity3D – Telegram
r/Unity3D
265 subscribers
12.7K photos
15.6K videos
14 files
48.1K links
News about the Unity engine and project showcases from Reddit. Made possible with @reddit2telegram (@r_channels).
Download Telegram
Media is too big
VIEW IN TELEGRAM
My best friend was an underwater welder on a deep-sea oil rig in the North Sea. He passed away from a heart attack just a year after he retired. I’m creating the game Weldiver to honor his memory.

https://redd.it/1gk8zce
@r_Unity3D
How do I copy a score into a different scene

Helloo I'm new to coding and I need help. I need to put the score from one scene (game scene) to another scene (respawn scene) and I don't know how to do that.

[Scene 1](https://preview.redd.it/7amd8cqow3zd1.png?width=907&format=png&auto=webp&s=4f088a6a22c4884102cd16450194693dda63456f)

[Scene 2](https://preview.redd.it/8jkes6kjw3zd1.png?width=910&format=png&auto=webp&s=c7fd178ac8b4034ba0ffbcbe7f6caa538df1f4ec)

Player movement with scoring code:
And "Scoring" Script (I tried following a tutorial but I don't get it)

using JetBrains.Annotations;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

public class Controller : MonoBehaviour
{

public Animator animator;
private Rigidbody2D rb2d;
private float moveInput;
private float speed = 10f;

private bool isStarted = false;

private float topScore = 0.0f;

public Text pointsText;
public Text startText;


// Start is called before the first frame update
void Start()
{

rb2d = GetComponent<Rigidbody2D>();

rb2d.gravityScale = 0;
rb2d.linearVelocity = Vector3.zero;


}

void Update()
{

if(Input.GetKeyDown(KeyCode.Space) && isStarted == false)
{

isStarted = true;
startText.gameObject.SetActive(false);
rb2d.gravityScale = 5f;

}

if (isStarted == true)
{

if (moveInput < 0)
{

this.GetComponent<SpriteRenderer>().flipX = false;

}
else
{

this.GetComponent<SpriteRenderer>().flipX = true;

}

if (rb2d.linearVelocity.y > 0 && transform.position.y > topScore)
{

topScore = transform.position.y;

}

pointsText.text = "Score: " + Mathf.Round(topScore).ToString();

}

}

public void AddPoints()
{
Scoring.topScore += //HELPPPPPPPP;
}

public void GetPoints ()
{
int recievedPoints = Scoring.topScore;
pointsText.text = recievedPoints.ToString();
}

void FixedUpdate()
{
animator.SetFloat("Speed", Mathf.Abs(moveInput));

if (isStarted == true)
{

moveInput = Input.GetAxis("Horizontal");
rb2d.linearVelocity = new Vector2(moveInput * speed, rb2d.linearVelocity.y);

}

if (transform.position.y + 30 < topScore)
{
SceneManager.LoadScene("GameOver");
}

}
}


using UnityEngine;
using System.Collections;

public class Scoring : MonoBehaviour
{
public static int topScore;
}


https://redd.it/1gka86j
@r_Unity3D
Media is too big
VIEW IN TELEGRAM
After a year of learning Unity, I'm excited to announce my first game: Fluff'n'Roll. Let me know what you think!

https://redd.it/1gkaecb
@r_Unity3D
This media is not supported in your browser
VIEW IN TELEGRAM
The difference switching out a directional light for just a spotlight attached to the player's head makes when skiing at night!

https://redd.it/1gkabdn
@r_Unity3D
Making a simple flappy birds game for practice and needing help with OnTriggerEnter2D.

I have a parent object that spawns a pipe prefab that I made. The prefab contains a parent object and a noscript that moves the pipes with two children object "pipes" (each with boxcollider2d). I then have a boxcollider2d that is a trigger and I want it to delete the pipes on trigger which I named "DeadZone"

I made a noscript for DeadZone , but the pipes are not even being detected. Is it because the parent object doesn't contain a collider and only the prefab's children objects? I can't seem to get it to work.


From what I understand, OnTriggerEnter2D needs two collider2D's with at least one being a trigger. What am I doing wrong?

https://redd.it/1gkgy1n
@r_Unity3D
Rpg party follows leader with navmesh

So trying to work on an rpg and I was thinking of having the party members follow the leader when not in battle. The obvious and simple method would be to have them echo what the player is doing but with a delay.

But I was thinking would it be overkill to use 2D nav mesh to have them follow the leader? I feel like it could possibly make it more organic and feel more natural?

What do you guys think?

https://redd.it/1gkhdff
@r_Unity3D
Area vs Scene

There is a scene called "City" it's a giant map with many buildings.
Some building can be entered, Eg. Convenient Store, so I'm creating a seperate scene called "Convenient Store" but some buildings are massive, for example "School", there are couple of classrooms and a gym, cafeteria, library etc etc... do you think it is good idea to divide these areas into seperate scenes or just leave it in one scene called "School".

Until now, I put everything in one scene but each area has fairly large gap in there positions eg (-80, 0) (40, 0) something like that, but I'm not sure whether I should divide it or not...

It's a pixel art game so, the image size is small, so in terms of optimisation I don't think it is a problem but I need some "experts' opinion".

Thanks :)

https://redd.it/1gkjvqb
@r_Unity3D
This media is not supported in your browser
VIEW IN TELEGRAM
Skip that last awful geometry LOD or LODs all together with Amplify Impostors!
https://redd.it/1gkirwn
@r_Unity3D
This media is not supported in your browser
VIEW IN TELEGRAM
We're working so god damn hard to make an incredible menu, so we added literally this animation to it. (You're free to share your thoughts!)

https://redd.it/1gkenxz
@r_Unity3D
Object Pooling not working

So I am following a Tutorial from Pandemonium for my first 2D jump and run game. (https://www.youtube.com/watch?v=PUpC44Q64zY&list=PLgOEwFbvGm5o8hayFB6skAfa8Z-mw4dPV&index=6)

In this part he uses Object Pooling for the fireball. I tried to implement it, but couldn't get it to work. The pooling in itself works (activating/deactivating the objects on trigger) but every second time I try to shoot, the fireball gets set to one position (2.73, -0.46, -8.82) and stays there until deactivated by collision or timeout. The position is always the same, but seems random to me. I also wonder why the z position is changed. But it doesn't seem to affect the collision detection.

I checked about everything I did multiple times, but couldn't find the problem. I have the exact same code as him. I also checked if I attached everything correct. And it seems like I did.

My last thought was that maybe it's because of the different Unity Versions. I use 2022.3 and I believe he uses 2020.1

Does anyone know why this could be happening?

https://redd.it/1gkgu5k
@r_Unity3D
animator trigger issue

I have a problem with the animator. the boolean trigger i am using for my walking animation is always being triggerd even while staying still.

my unity

https://preview.redd.it/a6tbu2aqy6zd1.png?width=2559&format=png&auto=webp&s=d3478d1bf279e132154f5899bc90de8ee92293e5

my code

https://preview.redd.it/ce5v2fwsy6zd1.png?width=2489&format=png&auto=webp&s=06bc8526fa14ae50534535cd9e06568de7fe2031

also my code

https://redd.it/1gko1k5
@r_Unity3D
Keybinds Don't Work B)

I'm following a video tutorial to change the keybinds in my game, and I really have no idea what's wrong. The print at the bottom shows the right key, which I believe means that it's set correctly, but it doesn't reflect in gameplay. Feel free to verbally abuse me because I am a moron :)

public void StartRebinding()

{

jump.action.actionMap.Disable();

rebinding = jump.action.PerformInteractiveRebinding()

.WithControlsExcluding("Mouse")

.OnMatchWaitForAnother(0.1f)

.OnComplete(operation => RebindComplete())

.Start();

}

public void RebindComplete()

{

jump.action.actionMap.Enable();

rebinding.Dispose();

print(InputControlPath.ToHumanReadableString(jump.action.bindings[0\].effectivePath, InputControlPath.HumanReadableStringOptions.OmitDevice));

}

https://redd.it/1gkq9vl
@r_Unity3D
Ping Pong and Reverse Not Working on Aseprite Importer for Unity2d?

Unity only plays my animations in "foward" mode. It just ignores any other type of animation direction that I set on Aseprite. Is it only me or the Aseprite Importer extension is currently missing that function? Thanks.

https://redd.it/1gkpvze
@r_Unity3D
Procedural Generation of 2d Tilebased Terrarin

My friends and I have recently started a project on unity. We want to make a simple sandbox / survival game with a tile based, top down (exactly 90 degree) 2d perspective. In trying to generate terrarin I've run into a few problems and being new to unity haven't been able to resolve them really and looking around online I can't find any resources on what I am trying to do (probably because I don't know what to search).

* I want it to be efficient, initially I tried with game objects but realised they aren't as efficient I probably need. I have heard the tile system in unity is good but I'm not sure where to start there as most videos covering procedural generation use meshes or game objects
* I also would want it to be able to handle height. For example cliffs running around the terrarin, but not just as an illusion of height but as an actual thing you can dig into and will have roof tiles above you.
* Lastly I would want to plan for the future with a chunk system, do I have to implement that from the start or can you save it for later?

Thanks in advance for any help, sorry if this is common knowledge I just haven't been able to find much info on the specifics I've listed. Also any additional info / tips on terrarin generation or unity as a whole would be very helpful.

https://redd.it/1gkvt30
@r_Unity3D
Some of the environments and characters we created for our Unity game Go Home Annie. CPU light baker still sucks, hope we can get Bakery to work as intended before release.

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