/r/Unity3D
A subreddit for News, Help, Resources, and Conversation regarding Unity, the game engine
News, Help, Resources, and Conversation. A User Showcase of the Unity Game Engine.
Remember to check out /r/unity2D for any 2D specific questions and conversation!
Please refer to our Wiki before posting! And be sure to flair your post appropriately.
Use the chat room if you're new to Unity or have a quick question. Lots of professionals hang out there.
Unity Game Engine Syllabus (Getting Started Guide)
50 Tips and Best Practices for Unity (2016 Edition)
Unity Execution Order of Event Functions
Using Version Control with Unity3d (Mercurial)
/r/Justgamedevthings (New!)
Beginner to Intermediate
5 to 15 minutes
Concise tutorials. Videos are mostly self contained.
Beginner to Advanced
10 to 20 minutes
Medium length tutorials. Videos are usually a part of a series.
Intermediate to Advanced
Text-based. Lots of graphics/shader programming tutorials in addition to "normal" C# tutorials. Normally part of a series.
Intermediate to Advanced
10 minutes
Almost entirely shader tutorials. Favors theory over implementation but leaves source in video description. Videos are always self contained.
Beginner to Advanced
30 minutes to 2 hours.
Minimal editing. Mostly C#. Covers wide range of topics. Long series.
PS4 controller map for Unity3d
CSS created by Sean O'Dowd @nicetrysean [Website], Maintained and updated by Louis Hong /u/loolo78
Reddit Logo created by /u/big-ish from /r/redditlogos!
/r/Unity3D
Hi everyone, I am trying to make a simulation and I need to spawn in capsules (navagents) which will wander randomly trying to collect food on a plane
using NUnit.Framework.Interfaces;
using Unity.AI.Navigation;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.AI;
public class randomMove : MonoBehaviour
{
private float timer;
public float newtarget;
public float speed;
private NavMeshAgent agent;
private Vector3 target;
private Object plane;
private float x_bound, z_bound;
private float energy = 30.0f;
private int numFood = 0;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
agent = gameObject.GetComponent<NavMeshAgent>();
plane = agent.navMeshOwner;
x_bound = plane.GetComponent<MeshCollider>().bounds.size.x;
z_bound = plane.GetComponent<MeshCollider>().bounds.size.z;
x_bound /= 2;
z_bound /= 2;
//search for food
//moves once every newtarget seconds
timer += Time.deltaTime;
if(timer >= newtarget)
{
newTarget();
timer = 0;
}
//loses energy
energy -= Time.deltaTime;
}
// Update is called once per frame
void Update()
{
if(energy<=0)
{
this.gameObject.SetActive(false);
}
if(numFood <= 0)
{
//search for food
//moves once every newtarget seconds
timer += Time.deltaTime;
if(timer >= newtarget)
{
newTarget();
timer = 0;
}
//loses energy
energy -= Time.deltaTime;
}
if(numFood > 0)
{
if(checkBounds())
{
agent.ResetPath();
agent.velocity = Vector3.zero;
agent.isStopped = true;
}
else
{
//moves once every newtarget seconds
timer += Time.deltaTime;
if(timer >= newtarget)
{
newTarget();
timer = 0;
}
//loses energy
energy -= Time.deltaTime;
}
}
}
void newTarget()
{
float newX = Random.Range(-x_bound, x_bound);
float newZ = Random.Range(-z_bound, z_bound);
target = new Vector3(newX, gameObject.transform.position.y, newZ);
agent.SetDestination(target);
}
void OnTriggerEnter(Collider other)
{
if(other.CompareTag("food"))
{
numFood++;
other.gameObject.SetActive(false);
}
}
bool checkBounds()
{
var xPos = agent.transform.position.x;
var zPos = agent.transform.position.z;
return xPos == x_bound || xPos == -x_bound || zPos == z_bound || zPos == -z_bound;
}
}
its a bit lengthy but essentially I want the capsules to stop at the edge of the plane (or at the boundary) if they have collected 1 or more food but no matter how I try I just cant get it to work, the capsules do stop if they are at the edge but immediately move off again and idk what is wrong with my code
Help is very much appreciated
One day I was making my own game and I wanted the level to be generated automatically. There is a set of words, the level should generate the best random crossword puzzle. What do I mean by the word best? The crossword puzzle should look like a square. It took a bit of time, but I did it. This algorithm has been tested on 23380 levels in English and Russian languages.
https://reddit.com/link/1gn5qde/video/4l6b4bs37uzd1/player
Here is the link:
Hello everyone,
When I click on an object in the hierarchy view and then see the object in the inspector as well. Now I click on an audio file in the project view by mistake and as a result I see stuff about the audio file in the inspector. Is there a way to go back to the previous selection of the object, without looking for the object and reselecting it manually?
I asked ChatGPT and it suggested ctrl+[ for Windows, but it's not working (I'm on Unity 6).
Thanks in advance
Hello all,
I am using a forward render for my project and currently have a render texture that displays an animated 3d model. I recently added a full screen pass render feature and now the background of my render texture is blue. If I remove that feature, it goes away.
Is there any fix for this where I can keep my render feature but remove the blue background?
I am new to the Unity/C# scene. Are there any good resources on structuring a project, test cases, and other plugins/libraries that’s recommended for development? Any must have plugins, conventions etc.
I use Unity to create VR apps mainly using the Meta XR SDK
Dose anyone have a good tutorial on how to procedurally generate trees? when I look nothing works when i follow them but for the life of me i cant get it
edit: I am using Sebastian Lague's procedural generation, with a few edits to the falloff map to make it more custom and a fixed noise map. And i am using Unity 2022.3.49f1
I am trying to make a movement shooter. I'm not sure if I should use the character controller or rigidbody. I am currently using rigidbody and am not sure I should apply drag or cap the speed. When I cap the speed you can't go fast, which is the point of a movement shooter. Thanks.
Found one by zyger but it’s outdated and I can’t get it to work now, I was hoping somewhere out there there would be a in depth document or video. Something that doesn’t show me what to do but tells me why and how to do it
i just downloaded it and am new so i dont know what is going on. the project lookes like it is creating and has a loading wheel but then just deletes it self and goes to the no projects yet screen
Is it possible to modify terrain layer weights using Timeline?
Research indicates there once existed a Terrain Control Track within the Terrain Tools Package, but that this no longer exists.
I'm interested in accomplishing this either via traditional timeline or the Microverse third-party asset package. Can anyone offer possible paths for achieving the outcome of modifying Terrain Texture Layer Weights using Timeline?
Hi, I'm a beginner in game development. A few years ago, I completed some small projects, but now I need to create a program for work that imports a 3D file and does some simple calculations.Since I already have some experience with the interface, I wanted to try using Unity. I’m having trouble allowing the user who will be running the program to import a 3D file (I'm trying with .stl). I made a script that asks to select a file to import but when i do so it imports an empty object.I wanted to know if this action is possible and, if so, if you could give me any tips on which path could i follow throw to work on it. Thanks a lot in advance!
New to Unity and this forum, so let me know if there’s another place to ask this.
I need to be able to click a button, have a window pop up and autoplay a video. I would like to include standard play/pause/scrub timeline/full screen options for users. I’ve followed a bunch of tutorials on making a standalone fullscreen video, or a windowed video, but I’m failing to connect the dots and get the result I’m looking for.
So I've a fresh install of Unity Hub and trying to install Unity 6 but this keeps happening...
I've done the following in an attempt to clear the issue:
Any help would really be appreciated!
I've been building a larger level in Unity, and it's been such a struggle to make the environment look believable and lived in. Even though this shot is still very much WIP, I'm very proud of the way things look so far. What would you add to this shot?
i have this room (its a model from SCPCB), and screenshot is what i call 'cells', they will be copied and pasted over about 10 times across this room, but the problem is when if i need to change one thing about a cell.
i learned about linking, which worked fine, but in unity the naming will look terrible, which happens to be the linked objects.
(using a .blend file in unity, fbx does the same)
so what other option, or some parementer to remove these "CellCollection|Name-misc-class"?
or no option at all?
If i dont use links, and then need to change a cell, will have to change to every single one manually. I tried to use 'link' in this local project but it does not let me copy and paste the local as linked, unsure what to do im not experienced.
Hello everyone, I’m a beginner in both Blender and Unity and was wondering if I could get my model imported into Unity while still looking like this.
I wanted to have my model just be like here where light doesn’t affect the textures and I tried importing it into Unity before, but it just imported with no textures so it was all gray. I use emission for my texture here in blender if that helps.
Thank you for your time.
It might be a really dumb question but I want to know if there's a way to put database into the Unity project which could work for both iOS and Android. I can't find or most thing I found are all community based ones which is discontinued years ago.
Hey, does anyone happen to know the max amount of audio source clips allowed in Unity for a vrchat world. My audio was working great at about 140 audio sources (it's a large horror map world with 5 different sections in the woods) but now at 148 audios only about 5 of them work. I have each audio attached to a 3d cube. Can you attach more than one audio to an object and would that help or make no difference. Also I don't really understand the priority slider. All my priorities are set to 128. Would changing those help? I need them all playing at once as it's optional which section you go to. Is there a way to only get it to play when someone is near to it maybe? Sorry for so many questions. Any advice would be really appreciated. Thanks