r/Unity3D – Telegram
r/Unity3D
266 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
I hate this part. (Camera explanation and mini rant in the comments.)
https://redd.it/1gsqxg3
@r_Unity3D
Sliding panel doesn't work

I'm tring to make the panel slide when i click the button, and when i click the mouse (end of the action). the first time works, but after that it just stops working. why?

Here is my code:

    IEnumerator Slide() {
        Vector3 temp;

        if(!hidden) {
            temp = panel.transform.position + new Vector3(0, -150);
        } else {
            temp = panel.transform.position + new Vector3(0, 150);
        }

        hidden = !hidden;

        while((panel.position - temp).sqrMagnitude > Mathf.Epsilon) {
            panel.position = Vector3.MoveTowards(panel.position, temp, 400 * Time.deltaTime);
            yield return null;
        }

        panel.transform.position = temp;
    }

https://i.redd.it/f0o3ki46ka1e1.gif



https://redd.it/1gsr3ur
@r_Unity3D
Issue with Inspector/Hierarchy

Hi, so I'm pretty new to unity and its suuuper frustrating. I'd be very happy if someone could help.

I have an object that is called "Vessel" and a Script that controls interactions with said object. I need to assign the object to the Player Interaction Script so that the noscript knows which object in the scene I want the player to be able to interact with.
But when I try to drag and drop the object from the hiearchy into the Inspector of the noscript, it doesnt work. Neither does searching for it on the button next to None (Game Object).


Here's the noscript:
using System.Collections;

using System.Collections.Generic;

using UnityEngine;



public class InteractionScript : MonoBehaviour

{

[SerializeField\] private Transform player;

[SerializeField\] private GameObject[\] interactableObjects = new GameObject[3\];

[SerializeField\] private float interactionRange = 3f;

[SerializeField\] private Animator animator;

[SerializeField\] private GameObject vesselObject;



private int objectsFound = 0;

private bool allObjectsCollected = false;



void Update()

{

if (Input.GetMouseButtonDown(1))

{

foreach (GameObject obj in interactableObjects)

{

float distance = Vector2.Distance(player.position, obj.transform.position);



if (distance <= interactionRange && obj.activeSelf)

{

TriggerInteraction(obj);

break;

}

}



if (allObjectsCollected && Vector2.Distance(player.position, vesselObject.transform.position) < interactionRange)

{

TriggerVesselInteraction();

}

}

}



private void TriggerInteraction(GameObject obj)

{

animator.SetTrigger("Inspect");

obj.SetActive(false);

objectsFound++;



if (objectsFound == interactableObjects.Length)

{

allObjectsCollected = true;

Debug.Log("Alle Objekte gefunden! Du kannst jetzt mit dem Vessel interagieren.");

}



TextManager.Instance.UpdateProgress();

}

}

funny thing is, it worked just fine before I worked on something else and tried to undo the other actions, but somehow the ctrl+Z just deselected everything in all of my Inspectors. I just don't get Unity.



https://redd.it/1gsu9ms
@r_Unity3D
I'm a beginner at 2d game developeing and i want to learn from some group projects. Anyone interested?



https://redd.it/1gsuv63
@r_Unity3D
GUIDs are amazing, especially when saving objects.

I just started making a saving system for my game, and using GUIDs for all of my objects makes everything so easy. It especially makes saving noscriptable objects easier. All I do is, generate a GUID for all of my noscriptable objects in the noscriptabe objects inspector, and when I load the game, I load all the noscriptable objects using Resources.LoadAll and add them to a dictionary with their GUIDs, and Instantiate the ones that were saved by finding their IDs from the dictionary, and then setup all of the instantiated objects with their saved GUIDs as well. I don't know if there is a better way of doing this, but this works fine for me. I use GUIDs for my shop system and inventory system as well, it makes everything so easy so I started using them for most of my systems. Do you use GUIDs in your games?

https://redd.it/1gstg4v
@r_Unity3D
Media is too big
VIEW IN TELEGRAM
Now imagine you're building something like that in a hack-and-slash game like Hades! Do you think it feels enough like a power fantasy, or is it too generic? It’s a bit hard to understand at first, but it’s not too difficult if you pay attention. And yes, I added these subnoscripts just for you :D

https://redd.it/1gnoscriptjc
@r_Unity3D
Building for IOS

Hi, for building for IOS i’ve heard that you need a Mac to build it on alongside a developers license. Is it possible to build via github actions or another alternative since apple hardware is usually not cheap. Any suggestions?

https://redd.it/1gt26g4
@r_Unity3D
This was the result I achieved when trying to code a motorcycle in first person. What do you think?

https://reddit.com/link/1gt5wwv/video/6w6uifu26e1e1/player



https://redd.it/1gt5wwv
@r_Unity3D
Hello everyone! How do you make in unity when character goes up the stairs to change the y bias. I encountered one YT short, but no detailed explanation. Thanks in advance!

What is Y bias? And do I need to make a separate noscript that controls the player movement or I add the code line in my character movement noscript?

Here is the yt short:
https://youtube.com/shorts/-rJgj82x3xA?feature=shared

Sorry if the question is stupid.
Thanks a lot! 🙏🏻

https://redd.it/1gtaot3
@r_Unity3D
Implementing Multiplayer - All new logic?

Hello all,

I'm in the process of making my very own game, and so far have a decent-sized prototype running. However, i want to include Multiplayer, and have started looking into it.

Is it normal to completely "re-write" your logic into multiplayer, and essentially have 2 different "game" - where one is single player, one is multiplayer?

A lot need to change like making everything into Network Objects and modifying the code. I don't see a way of having 1 single code-base for it.

I just wanna make sure i get it right, but for me, it seems like that is the way. For instance, i can't use the same prefabs for "Enemies" because the need to have different compontents attached to them.

Do i get it right? xD

https://redd.it/1gtcb3z
@r_Unity3D
Hold: Plays the Timeline instance once and holds on the last frame until playback is interrupted.

What do they mean by "interrupted"? Our current problem is that after playing the timeline the player gets sent back to it's original position from before that timeline starts playing. We want the player to be at the position in the end of the timeline when the timeline is finished. It seems that using Wrap Mode "Hold" on the Playable Director can solve this but I'm not sure what the interrupting means for this scenario. Also are there any other side effects of using "Hold"?

https://redd.it/1gtczrx
@r_Unity3D
Media is too big
VIEW IN TELEGRAM
Now You're Thinking With Portals (Advanced Shaders & VFX)

https://redd.it/1gte2mx
@r_Unity3D
Media is too big
VIEW IN TELEGRAM
This week they are giving away for free in the asset store 🎁 Hand to Hand Set

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