#💻┃code-beginner

1 messages · Page 708 of 1

naive pawn
#

the collider?

rich adder
#

yea

naive pawn
#

and not any of the other colliders or casts?

#

also Rect which is basically 2d Bounds

rich adder
#

I think most of the Physics2D option do have a zDepth for hits

naive pawn
#

huh, yeah

#

i thought they all just ignored Z

#

my understanding was that Rigidbody2D and all that it entails just used Vector2 so Z isn't taken into account

rich adder
#

yeah pretty much

#

ig Box2D has no concepts of Z space

#

its the only "true 2D" thing unity has

sour cape
#

anyone use gaia? cant get it to do anything

rich adder
#

this is a code channel

sour cape
#

yeh no one answering in there

naive pawn
#

not much of a better chance here

rich adder
#

how you figure coders would know anything about a specific terrain asset

sour cape
#

figured there would be more people

naive pawn
#

not people that would know about that

rich adder
#

why not ask the asset makers?

sour cape
#

waiting for response

sour cape
#

yeh reckon its just broken

rich adder
#

its really costly but hell with that money you should be getting direct IM responses..

sour cape
#

yeh just broken out of the box too

#

archaic forum

rich adder
#

tragic

sour cape
#

lol got it going, its terrible.

ember tangle
#

Is this good singleton code or would this cause problems moving back and forth between scenes?

{
    if (instance != null && instance != this)
    {
        Destroy(instance);
    }
    else
    {
        instance = this;
    }
}```
#

instance is the static instance of the class

naive pawn
#

ideally you would not have the singleton move between scenes

#

you would have it DDOL or in a persistent scene

ember tangle
#

I'm having huge behavior problems moving out of the "GameScene" and back into it, but everything works the first time I enter the scene. Trying to track down what would cause it and think it may be this code I have in all manager singletons.

naive pawn
#

you don't really move in or out of scenes, they get loaded and unloaded

frail hawk
#

what kind of huge problems

naive pawn
#

is the singleton in a scene that's getting unloaded? it shouldn't be (hence the above recommendation)

wintry quarry
naive pawn
#

oh yeah wtf

wintry quarry
#

Normally singleton code should look like this @ember tangle

private void Awake()
{
    if (instance != null && instance != this)
    {
        Destroy(this.gameObject);
        return;
    }

    instance = this;
}```
naive pawn
#

why's the instance != this needed? Awake's not gonna run again after instance = this;, no?

wintry quarry
#

correct

#

but it's harmless so I left it

ember tangle
#

the static instance survives between scene cleanup, no?

wintry quarry
#

well no not in this implementation

naive pawn
wintry quarry
#

you need @ember tangle :

private void Awake()
{
    if (instance != null && instance != this)
    {
        Destroy(this.gameObject);
        return;
    }

    instance = this;
    DontDestroyOnLoad(this.gameObject);
}```
grand snow
#

unless you clear it in OnDestroy the object wont be gc'd

naive pawn
ember tangle
grand snow
#

no c# object magically vanishes

wintry quarry
#

Most singletons never get destroyed period so it's not an issue most of the time (except when the application shuts down)

grand snow
naive pawn
#

the monobehaviour instance will still exist, but the underlying structure will be destroyed as part of the scene unloading, so the monobehaviour won't actually be valid & active

floral garden
naive pawn
#

no

ember tangle
naive pawn
#

gameObject and this.gameObject are the same thing

naive pawn
ember tangle
#

But there is only one of them and they give static access to other systems?

floral garden
grand snow
#

singleton pattern: fuck it ill use a static field and destroy duplicates :/

naive pawn
rich adder
naive pawn
#

could probably just Awake -> set static reference, OnDestroy -> if static ref == this, set to null

#

instead of trying to shoehorn the singleton thing in i guess

#

you seem to just be confusing yourself there

floral garden
wintry quarry
floral garden
#

ok

#

I need to change it then

stuck palm
#

my brains a bit fried with the maths atm, but basically i wanna do something here where i loop over like 100 times so i can get a trajectory. does this look good for parameters required?

wintry quarry
stuck palm
#

yeah i thought i was missing that too

wintry quarry
#

Unless you can guarantee that it will always be static across the whole application and can access it statically

stuck palm
#

this is just for a custom editor thing

#

but yeah i can do that

foggy yoke
#

Hey guys! Can I ask about the astar pathfinding project here?

timber tide
#

there's a discord for it

fading barn
#

how can i recreate the bioshock infinite hook and rail mechanic in unity?

frosty hound
#

How do you want someone to answer that?

#

If you're just wanting to know what it uses, the answer is splines.

zealous talon
#

can you tell me why, when i attach this script to a GO, i can't change and drag-drop values from the inspector? they are public

keen dew
#

Can't change as in the fields are grayed out? Or not there at all? Or the new values don't persist? Or something else?

zealous talon
#

like they are not there

#

i attach the camera follow script to the main camera, but the public values don't show up

keen dew
#

Errors in the console?

fading barn
#

what scripts do i have to right

zealous talon
zealous talon
keen dew
#

You have to fix all errors regardless of where they are

grand snow
#

Why? It has to successfully recompile to include your new changes

frosty hound
fair scarab
#

brain exploded

#

;-;

long matrix
zealous talon
long matrix
#

Thanks asgore

zealous talon
#

i have uploaded a mixamo model for my pg player and implemented a little controller (nothing too difficult), i have attached the rigid body component but when he moves he collaps on itself. i think i'm missing something on the rigidbody component on a 3d model that is not mine, what could it be?

#

btw the movement is this, i used linearVelocity before but the tutorial i was following used velocity so i tried using that one

zealous talon
glacial cobalt
#
using UnityEngine;

public class Regular_Placing : MonoBehaviour
{
    private Vector3 mousePos; 
    [SerializeField] private GameObject toSpawn;
    [SerializeField] private LayerMask spawnArea;
    private bool inArea;
    private RaycastHit2D hit; 
    private Menu_Item_1 script;
    private GameObject menuItem;
    [SerializeField] private string name;
    // Start is called once before the first execution of Update after the MonoBehaviour is created\
    void OnMouseDown() 
    {
      if(hit)
      {
      script.howManyToSpawn -= 1;
      Instantiate(toSpawn, transform.position, transform.rotation);
      Destroy(gameObject);
      }
    }
    
    void Start()
    {
      menuItem = GameObject.Find(name);
      script = menuItem.GetComponent<Menu_Item_1>(); 
    }

    // Update is called once per frame
    void Update()
    {
      
      //following cursor
      mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);    
      mousePos.z = 0f;
      transform.position = mousePos;

      // raycast for checking if in spawn inArea
      hit = Physics2D.Raycast(transform.position,Vector2.up,0.1f, spawnArea);
    }
using UnityEngine;

public class Regular_Placing : MonoBehaviour
{
    private Vector3 mousePos; 
    [SerializeField] private GameObject toSpawn;
    [SerializeField] private LayerMask spawnArea;
    private bool inArea;
    private RaycastHit2D hit; 
    private Menu_Item_1 script;
    private GameObject menuItem;
    [SerializeField] private string name;
    // Start is called once before the first execution of Update after the MonoBehaviour is created\
    void OnMouseDown() 
    {
      if(hit)
      {
      script.howManyToSpawn -= 1;
      Instantiate(toSpawn, transform.position, transform.rotation);
      Destroy(gameObject);
      }
    }
    
    void Start()
    {
      menuItem = GameObject.Find(name);
      script = menuItem.GetComponent<Menu_Item_1>(); 
    }

#
    // Update is called once per frame
    void Update()
    {
      
      //following cursor
      mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);    
      mousePos.z = 0f;
      transform.position = mousePos;

      // raycast for checking if in spawn inArea
      hit = Physics2D.Raycast(transform.position,Vector2.up,0.1f, spawnArea);
    }
#

Trying to destroy object after it spawned another object

#

but Destroy(gameObject) doesnt work

#

everything else in if(hit) works

#

object it self is spawned prefab

wintry quarry
glacial cobalt
#

just warning

#

caused by this

#

[SerializeField] private string name;

wintry quarry
#

Component already has a name property. You're hiding that property by declaring your own name field

#

Add some Debug.Log to your code

#

to make sure it's getting to where you think it's getting

#

Also make sure you're expecting the right object to be destroyed.

glacial cobalt
wintry quarry
#

That will destroy the GameObject the script is attached to

glacial cobalt
#

cuz i see howManyToSpawn going down

stuck palm
#

how can i access static fields in a script from the inspector? is this possible?

glacial cobalt
#

with every click

stuck palm
#

shite

wintry quarry
teal viper
wintry quarry
stuck palm
#

is there a way to get a gameobject from an asset path?

wintry quarry
stuck palm
#

this is purely for editor side stuff

#

and i dont want to make a property field for it

glacial cobalt
#

Warning seemed to be a problem , didnt exactly understand what it was saying thx

stuck palm
neon glade
#

trying to make a game similar to this duck life minigame, wondering how I make the obstacle spawn in a set position?

or if im doing this completely wrong pls help

wintry quarry
#

That's not valid code

neon glade
#

uhh im not sure

wintry quarry
#

well you wrote it didn't you?

neon glade
#

i saw a tut for an endless runner cuz lowkey closest thing

#

but im sure i dont need a random range for this

wintry quarry
wintry quarry
neon glade
#

nono i just pulled it out of nowhere

wintry quarry
#

why would you do that? Can you explain what you were trying to do?

neon glade
wintry quarry
neon glade
# wintry quarry so what do you need?

What i need is the object spawning in that location (ish), continuing to move left perhaps, having a maximum of like 4 obstacles for better performance, and that if the obstacle reaches this border, the object(s) would stop moving

#

I think maybe a moving camera but I dont know if I need that or not

wintry quarry
#

one thing at a time

neon glade
#

Its hard to explain sorry

#

ok

wintry quarry
#

you're trying to spawn an object

#

where do you want to spawn it

neon glade
#

yes

neon glade
wintry quarry
#

when you say "in that location", what location are you talking about? And when you say "ish" that does imply some randomness

wintry quarry
neon glade
wintry quarry
#

that's the most straightforward way to do this.

neon glade
#

oh ok

wintry quarry
#

Is that a question or a statement?

neon glade
#

I dont know

#

sorry

#

i have like the idea of what the game would be like but have no idea how to implement the logic/code

#

so if it sounds odd thats prolly why

wintry quarry
#

THat's a very common position to be in

#

you are doing something really common which is your mind is running way ahead of itself

#

slow down and focus on one issue at a time

#

start with just spawning objects in a desired location

#

take it from there

neon glade
#

ok

#

I've made it spawn in the location of a spawnlocation game object, and it looks like this, but I don't know what to do now

neon glade
#

it does

wintry quarry
#

This will spawn in the location of the object the SpawnObstacle script is attached to.

neon glade
#

yes

wintry quarry
#

ok so... now you need to ask yourself what's next for your game

fierce fog
#

How do I get AI agents to avoid trees?
I have a 2km x 2km forest area with about 15 different tree prefabs. All of them have capsule colliders and I can't walk inside them but the navmesh doesn't recognize them at all and the agents walk through them. I tried writing a script that creates empty gameobjects in their positions with navmeshmodifiers set to "not walkable" but the navmesh generates ignoring them. I'm not sure what to do at this point

north scroll
#

if "select dependencies" shows nothing but the script im looking for, that means its not being used anywhere in the entire project and is safe to delete right ?

wintry quarry
neon glade
fierce fog
spring otter
wintry quarry
#

Or manually placing them?

fierce fog
#

terrain

neon glade
spring otter
#

This was in the tutorial you were trying to follow probably

fierce fog
#

I'm confused though

#

This creates a visible object for every tree but it's sort of what i was doing earlier

#

did i screw up the navmesh config

#

i'm kind of new to this

#

fair enough

neon glade
#

im trying to figure out how to stop the camera movement after it collides with the border but continue moving if not

wintry quarry
#

shouldn't it be attached to the camera?

#

also why would a camera collide with anything?

neon glade
neon glade
wintry quarry
#

What kind of game is this?

neon glade
#

wait let me find a vid for you

wintry quarry
#

Endless runner? So which object(s) are moving, the player?

#

shouldn't the camera just follow the player?

#

with the player being the thing that might collide with stuff?

neon glade
#

its not exactly like this cuz no immediate loss and its keys not UI you click

wintry quarry
#

also this game doesn't need physics

#

Another thing... you actually don't need to move the player or camera at all for this

#

just move the stones

neon glade
#

im so confused

fierce fog
#

if you move the stones it's gonna look like the player is moving

wintry quarry
#

games are smoke and mirrors

fierce fog
#

and you don't have to care about generating more ground

wintry quarry
#

well in this video at least you will need to "move" the ground but that can be done simply by tiling a wrapping texture for example

neon glade
#

ok so what should my first step be

wintry quarry
#

the background is static, as is the camera. The player just does a little jump animation

neon glade
#

no camera and no gamemanager parent?

fierce fog
spring otter
# neon glade no camera and no gamemanager parent?

The player and the camera are static, all objects just flow to the left (or right) and this creates a simulation of movement
You can aditionally make the ground's texture scroll, which will help sell the idea of movement
Also parallax on the background

rich ice
#

not a code question

neon glade
#

now what

wintry quarry
#

antialiasing

fierce fog
#

delete it when it's offscreen

wintry quarry
#

well yeah for pixel perfect isn't the idea to see every pixel?

#

it's not conducive for diagonals

#

where are you looking to see this?

#

is your game window zoomed in?

#

make it 1x

#

this is a code channel

neon glade
#

doesnt work, it js keeps spwaning, not each second or whatever input i add in the public float

wintry quarry
#

is yours on the right or left?

neon glade
#

right

#

it says

#

The name 'Spawn' does not exist in the current context

wintry quarry
#

you need to fix that error - namely you need to actually add the Spawn() function

neon glade
#

how do i do that

wintry quarry
#

basically your code doesn't match the tutorial

#

make it match

wintry quarry
#

but right now your code looks different from the tutorial

neon glade
wintry quarry
#

Look at the Update function and the Spawn function

#

yours are totally different from the tutorial

neon glade
#

i dont know what im missing is all

wintry quarry
#

The spawn function

#

you are missing the spawn function

#

and you're calling Instantiate directly in Update

#

which the tutorial is not doing

neon glade
#

oh yes ty

#

it works now

#

now whats next

spring otter
neon glade
spring otter
#

You don't need a float like that to keep track of the time and keep increasing it

wintry quarry
#

it's just another way to solve the problem you already solved

spring otter
#

Yes, it does that thing you just finished doing

#

You can use that instead if you want to experiment

neon glade
#

oh ok

spring otter
#

Throw it on Google and find the Unity Documentation page for InvokeRepeating, try to read if and see if you can swap it for what you already did just now

sour fulcrum
rich adder
#

InvokeRepeating pretty trash

#

learn a coroutine at least

spring otter
#

One step at a time guys

#

It's still good for quick prototyping

rich adder
#

its a noob trap

spring otter
#

You think so? Why?

rich adder
#

easier to use at first , if you run multiple and need to stop 1 goodluck with that (unless cancelinvoke actually does work? dunno)

#

no parameters, using strings as method name, spelling errors, inefficient if you have a lot etc

#

oh if you need to change the repeat timer once started, nope

#

why use something bad when you can learn something better? and its not that much more difficult in comparison

spring otter
#

Well when you start you tend to use bad but easy things, these things you can understand at least and increase complexity little by little, I wouldn't recomend them to try Coroutines, not yet, they just Instantiated their first object I think

lofty mirage
#

I feel like Coroutines aren't that difficult tbh

#

like it's not a big step

sour fulcrum
#

imo

lofty mirage
#

Is there a way to "insert" a new layer like at layer 7?

#

If I just move each one 7 onwards 1 by 1

rich adder
lofty mirage
#

then my existing gameObjects in my scene are going to be assigned to the final index layer (which is not their "correct" layer anymore)

spring otter
lofty mirage
sour fulcrum
#

Not to throw a whole new problem your way but you are potentially misusing the ideal intent of layers here

lofty mirage
#

Basically it's just that I only want certain collisions

north kiln
#

so you'll have to go across your whole project and update those indices

lofty mirage
spring otter
north kiln
#

you don't, because it's an operation that has the consequences i'm trying to communicate to you

lofty mirage
#

so I wondered if there was another way

sour fulcrum
# lofty mirage Wdym?

Usually they tend to be used for a lot more broader, generic groupings, particularly for an initial first pass of collisions.

Then you would be abit more "specific" with what interactions you care about via programming logic (eg. tags, getcomponents etc.)

lofty mirage
spring otter
#

I meant moving, clicking and dragging it down

#

I think

lofty mirage
#

but then if I want to have all my "enemy" layers together

rich adder
lofty mirage
#

and currently the enemy layers are 7-10 let's say and I have 15 total layers

sour fulcrum
#

Ideally your enemy layers should probably just be a enemy layer

lofty mirage
#

then making the new "enemy" layer index 16 feels bad

spring otter
lofty mirage
#

and the flying enemies fly over the brushes

#

but not the ground ones

#

for instance

spring otter
#

I'm probably spreading fake new, forget what I said before
||lmao||

north kiln
#

An option is to open ProjectSettings/TagManager.asset and sort the list via text editing.
You would only do this in the case where you are comfortable going across your entire project and swapping every layer and layermask on everything serialized that use those layers

lofty mirage
#

so it's "feasible"

#

just feels suboptimal

#

but if there's nothing better it's ok I guess

sour fulcrum
#

Why do your flying enemies need to be tagged as a flying layer in order to fly over the bushes?

Also in that example how are you utilising the Bushes layer in order to handle that logic?

It's possible Bushes could be broadened to Foliage or Obstacles for example

rich adder
#

spend 30 mins making a script to do it for you

lofty mirage
lofty mirage
#

so I figured if I make an AerialEnemies layer and a brushes layer

#

and deactivate the collision between those two layers

#

problem solved

sour fulcrum
#

Here's some sauce for you

#

rigidbodies and colliders have layer overrides 😄

#

You can broaden Bushes to Foliage or Obstacles etc. to make it more usable in other situations then have the flying enemy explicitly ignore that in their colliders

sour fulcrum
#

makes one layer more usable and removes another

lofty mirage
#

so then I would have to add the layer overrides to each of the aerial enemies?

#

isn't that more work than assigning them the aerial enemy layer?

sour fulcrum
#

Yes

#

I am not suggesting the fastest solution, I am suggesting a preferable one 😛

spring otter
sour fulcrum
#

You could even do this via code

wintry quarry
sour fulcrum
#

Sidenote would kinda be nice if those layer override classes were a scriptableobject so you could do presets. that would be fun

lofty mirage
#

Multiselect I do that already

#

but I don't use prefabs so much

#

that's true

sour fulcrum
#

Gotta use prefabs homie

lofty mirage
timber tide
#

Making a Layer class to expand out variants is an idea too, so via OnValidate will swap to those layers depending on say an enum you set in that script

deep minnow
#

With Jump PlayerInputAction new input system, is it a positive and negative binding?

deep minnow
#

or 1D?

lofty mirage
#

I'm not sure what your mean by OnValidate

deep minnow
sour fulcrum
deep minnow
timber tide
deep minnow
#

Thanks

timber tide
#

LayerVariant.Ghost -> Ignores Obstacle Layer, Ignores Geometry Layer

lofty mirage
#

I gotta go guys rn

#

But thanks a lot

#

I really appreciate it

#

Have a good day / evening y'all 🙂

fossil plaza
#

does anyone have the patience to teach me unity?

#

im kinda dumb

rich adder
#

hire a tutor

fossil plaza
#

im poor

wintry quarry
rich adder
eternal falconBOT
#

:teacher: Unity Learn ↗

Over 750 hours of free live and on-demand learning content for all levels of experience!

fossil plaza
#

like 10 bucks in my bank account

raven pilot
#

✅ Internet
✅ Computer

What're you waiting for, get that 🍞 up

spring otter
#

You should be asking "How do I do X?"

#

Then people would be more willing to help

#

Kinda weird to explain tbh

#

You have to show interest

spring otter
#

You're basicaly asking people to go out of their way to teach something to a random stranger

raven pilot
#

"I'm trying to do X But it's not working, I've tried the following blah blah blah What am i doing wrong?"

mystic flume
#

obama have dih

fossil plaza
#

well yeah but i dont wanna lie

fossil plaza
naive pawn
#

there is no off-topic chat here

#

we can do without..whatever that is, thanks

mystic flume
#

so mature

fossil plaza
#

bro '

#

I NEED SOMEONE TO BE MY FRIEND

#

im a lonely boi

#

and depressed

#

SO IM FUCEKED

mystic flume
#

yo dm me

eager spindle
#

there is no friend-making in this server, its just for help with unity

frosty hound
#

There's no off topic, as mentioned already, thanks.

lost maple
#

Hi
i've 2 structures say:
public struct MyStruct(){
public int var1
public int var2
}

how to can I make comparsion of my structs with zero struct (when all variables =0) like this
if( _myStruct==MyStruct.zero){
//do something
}
?

rich ice
#

!code

eternal falconBOT
foggy spade
#
using UnityEngine;

public class Instantiate : MonoBehaviour
{
    public GameObject FloorPrefab;
    [SerializeField] private float Timer;
    [SerializeField] private float FloorZ = 6;
    // Start is called once before the first execution of Update after the MonoBehaviour is created
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        Timer += Time.deltaTime;
        if (Timer >= 10f)
        {
            InstantiateFunc();
            
        }
    }

    void InstantiateFunc()
    {
        FloorZ += 212;
        Instantiate(FloorPrefab, new Vector3(0.6f, 0, FloorZ), Quaternion.identity);
        Timer = 0;
    }
}``` for some reason instantiatefunc continues to run forever after the timer changes back to zero
lost maple
#

or add condition

#

like this^
if(Timer!=0)Timer+=Timer.deltaTime;

foggy spade
#

okay!! ill try it out thank u

rich ice
#

could also do this if you're determined to use ==

public static bool operator ==(struct1 s1, struct2 s2) 
{
    return c1.Equals(c2);
}

public static bool operator !=(struct1 s1, struct2 s2) 
{
   return !c1.Equals(c2);
}
lost maple
foggy spade
spring otter
#

public struct Stuff
{
int x, y;
string name;

public bool IsThisStructZeroed()
{
bool temp = true;

  if (x != 0 || y != 0)
     temp = false;
  if (name != zero)
     temp = false;

  return temp;

}
}
This

mystic flume
#

anyone have something

rich ice
mystic flume
#

i dont know

north kiln
mystic flume
#

uh oh

rotund root
#

should the winning condition be under the score text section or the score counting section?
which one is the easier way to maintenance/read?

silk night
rotund root
#

asking because unity tutorial's method is the pic one but i personally prefre putting it under the score part
since in the future i might work with other classmate and i dont want to have any bad habits

silk night
#

yeah, text doesnt have anything to do with a win condition so keep it seperate

dull grail
#

Why unity refuse to see files after 1st one? I've tried to execute same method in normal cs file (w/o unity) and it worked fine

var fileNames = System.IO.Directory.GetFiles(path, "*.evg");
        foreach (var fileName in fileNames)
        {
            Console.WriteLine($"{fileName}\n");
        }
#

I've tried to remove search pattern and delete 1st found file and in both case unity just returned next file

keen dew
#

Show the Unity code that doesn't work, not the console code that works

eager elm
keen dew
#

Also there's an error so it's not going to continue after that

dull grail
#
public string[] FindAllSaves()
    {
        var saves = Directory.GetFiles(_dataPath, "*.evg");
        return saves;
    }

void Start()
{
_fileDataHandler = new FileDataHandler(Application.persistentDataPath, fileName, useEncryption);
        var saves = _fileDataHandler.FindAllSaves();

        foreach (var save in saves)
        {
            Debug.Log(save);
            var saveData = Instantiate(savePanel, savesList.transform);
            saveData.GetComponent<TMP_Text>().text = save;
            saveData.name = $"WorldData: {save}";
        }
}
balmy vortex
#

Hey so like I'm trying to spawn a sphere prefab inside my player and make it move forward in the direction the camera was facing when it first spawned in but I can't figure out how to actually fetch the players position to decide where the sphere is supposed to go (and making it a child of the player kinda just breaks everything). I also can't rly figure out how to properly store and use the camera values I get so I'm literally just storing it in a var atm
my fuckass prefab code rn --> https://paste.mod.gg/dqlwubwwycwc/0
spawner code --> https://paste.mod.gg/ewvtretzjsvr/0
tbh I can't even figure out how to actually grab the prefab to make copies of it but ya

keen dew
eager elm
grand snow
#

Or crazy idea, use a debugger

dull grail
eager elm
dull grail
acoustic frost
#

For people who have Idea, is it possible to make a code that runs a audio (Live audio like radio) into unity audio source? Tried a lot of methods and asked for a lot of help, nothing helpt. If someone has expert and Idea, would be great to know how is this implemented

If any answers, I would like to get mentioned :)

balmy vortex
modest dust
modest dust
# balmy vortex ok but how do I put it at the players position?

By referencing the player's GameObject/Transform/SomeOtherComponentOnThePlayer, and calling .transform.position on it, or just .position if it's a reference to the Transform, and instantiating it on that position or via the Init method if you prefer so

#

But Instantiate allows to set both the position and rotation

thorn kiln
#

So, I got a question about the code in the unity tutorials. The game you make where you make balls bash into each other and push them over a ledge, the code it has you do in the tutorials is enemyRb.AddForce(lookDirection * speed);, but when you're given a project after for a football game, their code given for enemy movement is enemyRb.AddForce(lookDirection * speed * Time.deltaTime);, but that way of doing it makes the enemies move very slow unless you crack up the speed variable into the hundreds. I'm just wondering what best practises actually is.

#

Just weird that there's a discrepancy between two near identical projects they've given you, and I'm not sure if * Time.deltaTime should be considered one of the bugs I have to fix or not

keen dew
#

Multiplying by deltatime there is incorrect

thorn kiln
#

What is the criteria for when deltatime is correct or incorrect?

silk night
#

I would assume either savePanel or savesList are null

dull grail
#

Yeah, it is. I thought its relate to part which i didn't moved to another script yet and ignored

keen dew
hot wadi
#

I don't get it. I set the velocity to zero, but it keeps updating (Yvelocity in the Animator)

{
    rb.linearVelocity = new Vector2(horizontalMove * speed, rb.linearVelocity.y);

    if (OnGround && horizontalMove == 0 && Mathf.Abs(rb.linearVelocity.y) < 0.01f)
    {
        rb.linearVelocity = Vector2.zero;
    }
}```
silk night
hot wadi
#

Update()

silk night
#

set it to fixed

hot wadi
#

Well I mean the animation is fine. It's the velocity I want to freeze. It keeps slipping on slopes

silk night
#

I would assume that your code runs and exactly after that the physics step executes, which applies gravity, the update then picks up the y value after gravity application

#

maybe move your Yvelocity update to the fixedupdate

#

right after you set it to zero if its too small

thorn kiln
#

Hmm, Im trying to figure out how to addforce to the player's rigidbody in the direction the camera is facing. Modifying vectors based on other vectors is still confusing to me

silk night
thorn kiln
#

Ah. I thought I'd have to do some "player position minus camera position" or something

silk night
#

yeah you can do that too

#

your camera forward is not always equal to that vector you are describing, depending on if you look exactly at the center point of the player (then it would be the same)

thorn kiln
#

Just because the way enemies work is Vector3 lookDirection = (player.transform.position - transform.position).normalized;, so I thought it might be another case of needing that

silk night
#

yeah if you do that with the camera you get the camera's origin point to players origin point direction

hot wadi
#

I'm resorting to freeze constraints, as long as it lasts

silk night
#

why dont you just apply the values to the animator before the physics step?

#

no freeze tricks needed then

hot wadi
#

The animator receives value directly from the rigid body

silk night
#

uhh how does that work, wouldnt a script have to do that?

hot wadi
#

Basically just this
anim.SetFloat("Yvelocity", rb.linearVelocity.y);

silk night
#

yeah, move that command to the fixedupdate that you have shown above
Just after you set stuff to zero

#

oh wait, im stupid, you also wanted that gravity doesnt push you down while on the slope

#

dont you want to slip at all or just not with tiny slopes?

hot wadi
#

That command line only gets the value of the velocity, it does not change the velocity itself. The sliding movement happens because gravity is forcing the rigid body, making change to the velocity continuously

silk night
#

mhh you should look at adding a high friction physics material to your character and ground, aswell as trying some linear dampening

#

that should stop gravity from slipping you off slopes without any freezing

hot wadi
#

I guess that can work

#

I have to separate the walls and the ground into different tilemaps

boreal violet
slender nymph
boreal violet
#

Thx

slender nymph
#

modding discussions are not permitted here

cosmic meteor
#

It's not modding

#

It's just a script

slender nymph
#

for a game that is not your own. therefore modding

cosmic meteor
#

Wha... huh?

#

This is literally just trying to automate something in RRS

#

It's not like I'm hacking the game

slender nymph
#

that's cool. we don't support that game here

rich adder
#

Rec Room Studio is a game, thats considered modding

cosmic meteor
#

I was told by someone who works in RRS all the time to come here

slender nymph
#

nobody said anything about hacking. this is not a support server to assist with modding third party games, this is for developing your own games

cosmic meteor
#

How is a script modding 😭

#

I don't understand

slender nymph
cosmic meteor
#

Ok, sorry

rich adder
slender nymph
cosmic meteor
#

It's not changing behavior though

#

all it's doing is adding files to a registry

slender nymph
#

and yet it's still not your game you are seeking help with. you are creating content for another game which is literally what modding is

cosmic meteor
#

I guess I misunderstood... I apologize

deep minnow
#

void Update()
{
_horizontalInput = _moveAction.ReadValue<float>();
_Jump = _jumpAction.ReadValue<float>();

if (_jumpAction.triggered && isOnGround)
{
    Jump();
}

}

my Jump(); isn't firing my Jump Action, it states that when I press Space it goes to 1 so that works

#

but the actual jumping isn't working

#

public void Jump()
{
_playerRb2D.AddForce(Vector2.up * _Jump * jumpForce, ForceMode2D.Impulse);

audioSource.PlayOneShot(jumpSound);

}

rich adder
eternal falconBOT
deep minnow
#

_jumpAction = InputSystem.actions.FindAction("Jump");

slender nymph
#

have you actually confirmed that the if statement is true?

rich adder
#

would help if we need to also see how you move rigidbody . You could be overriding the AddForce with velocity

wintry quarry
#

I don't see isOnGround being set anywhere

deep minnow
#

should I do do the enables seperate?

rich adder
deep minnow
#

The variable is declared, the movement input does work

#

The junp button does work since it goes from 0 to 1 when i press

#

Bool is declared not true nor false

#

jump method is in update, whilst movement method is in fixed update

#

this may be the issue

#

Figuired this out lol

deep minnow
#

I am currently using tiled, turns out it's my OnCollissionEnter2D not firing

#

to trigger said Bool

#

I already have collissions within tiled to be imported, imported into a sprite type collider

#

Still the same result

#

oh wow, I fixed it, nice

#

If you are working with Tiled, do a tilemapcollider 2D with your Tiled map grid that has said collider, get a CompostileCollider2D and in tilemapCollider set comps to merge

dull grail
#

How can i pass variable to new scene? I've made save selection scene and all i need is to pass string with save name to next scene to load data from respectative file. I saw i could make scriptable object to pass it as it not bonded to single scene but game as a whole but i think it'd be a bit of overkill

thorn kiln
#

How do I reference a variable in another script?

timber tide
dull grail
#

Thank you

timber tide
#

SOs is an idea too as they don't live in scenes, but if you're writing data to it at runtime I wouldnt suggest that method

vast matrix
#

I am getting an error "The namespace Rendering does not exist in namespace UnityEditor" This error only exists when im trying to build the game and if I try to change it, none of the textures load.

#

I need help quick I need to submit this in 30 minutes

timber tide
dull grail
#

Thank you again

vast matrix
timber tide
#
#if UNITY_EDITOR
    Debug.Log("Unity Editor");
#endif
vast matrix
timber tide
#

Show me the script that's having problems

vast matrix
timber tide
#

remove using UnityEditor.Rendering;
Does that throw any errors in your script

thorn kiln
#

I can't just drag my spawn manager into the enemy prefer to be able to reference it, so I'm kinda lost

vast matrix
#

no

timber tide
#

try compiling again

#

should work now

vast matrix
#

Yeah it did

#

thanks

#

now hopefully nothing else goes wrong in these next 20 minutes

timber tide
#

Assuming you're dragging enemy prefabs into the spawner

thorn kiln
#

The challenge says "The enemies’ speed should increase in speed by a small amount with every new wave"
And the hint is "You’ll need to track and increase the enemy speed in SpawnManagerX.cs. Then in EnemyX.cs, reference that speed variable and set it in Start()."

timber tide
#

So first off I would never edit prefab data from your directories (at runtime), unless I am creating a whole new prefab. Now for this problem you'll be wanting to cache all the enemies into some data struct when you spawn them instead of letting them loose in the scene. This way when you increase the speed value you can iterate over this List/Array and increase each one of these enemies.

#

So at minimum you'll need:
SpawnManager (Doesn't need to be a prefab and can exist in your scene)
Enemy (Prefab as you'll be making duplicates)

thorn kiln
#

Well the enemies are being generated in waves. They're just balls that move towards a goal and you have to stop them, then once thye're all gone, it spawns the next wave

timber tide
#

Yep, sounds fine

#

Need to keep track of everything when you instantiate them

thorn kiln
#

Right... I still don't know how to create a variable in my spawnmanager script and then reference it in my enemy script though...

ember tangle
#

show some code

timber tide
#

Create an Enemy Monobehaviour script
Make a gameobject on the scene and slap a Enemy component on it
Drag this gameobject into your asset directory -> becomes prefab

Create a SpawnManager script
Make a variable in this script called Enemy (make it public)
Make a gameobject on the scene and slap a SpawnManager component on it
Drag your Enemy prefab onto this gameobject on the scene into the Enemy property

thorn kiln
#

Okay, I think I need to make it clear that I'm at the end of this project and am just trying to do this last thing. I dont need "step 1, create an enemy script"

deep minnow
# thorn kiln How do I reference a variable in another script?

This tells you in the junior programming pathway, but in unity 6, if you want to reffrence a script,

put in the script name inside of the script you want it to reffrence too and put the method after placing the reffrenced sprit into a variable like this

public JumpScript _jumpScript

_jumpScript.MethodName()

#

vice versa

timber tide
#

Well, all the steps are there so if you've any more questions

thorn kiln
frail hawk
#

you can´t reference scene objects in prefabs

thorn kiln
#

I am aware

frail hawk
#

you can do that when instantiating the prefab and assign the field with some kind of injection

timber tide
thorn kiln
#

Okay, I'll try and rephrase this.
My SpawnManagerX.cs script has a variable called "enemySpeed"
How do I reference this variable in my EnemyX.cs script?

timber tide
#

Enemies don't need to know about any reference to the manager

deep minnow
#

Yh... Enemies don't want to know my location lmfao

hexed terrace
#
[SerializeField] private Enemy enemyPrefab;

Enemy newEnemy = Instantiate(enemyPrefab);
newEnemy.speed = enemySpeed;```
timber tide
#

They need them in an array list too

#

The problem reads as it's updating all current enemy speeds

thorn kiln
hexed terrace
#

use a paste site 👇 !code

eternal falconBOT
frail hawk
#

this line in the update is not a good idea , just as a sidenote
enemyCount = GameObject.FindGameObjectsWithTag("Enemy").Length;

timber tide
#

Instantiate(enemyPrefab, GenerateSpawnPosition(), enemyPrefab.transform.rotation);
You get a reference to this new object constructed as the return value which you want to cache

thorn kiln
timber tide
#
Enemy enemy = Instantiate(enemyPrefab, GenerateSpawnPosition(), enemyPrefab.transform.rotation);
enemy.Speed = currentGameSpeed```
#

But remember, if the speed increases it has to change all enemies speeds

#

so how do you figure out how to reference the previous enemies

deep minnow
deep minnow
#

Do how you did with the learning module

#

since that's basically debugging

#

I basically had 2 issues with that pathway, had to reffrence the script directly rather then using the modular approuch

thorn kiln
#

Okay, I don't feel like asking here is productive anymore

timber tide
deep minnow
rich ice
deep minnow
thorn kiln
#

Okay, I dealt with it by putting
spawnManagerScript = GameObject.Find("Spawn Manager").GetComponent<SpawnManagerX>();
in my enemy.cs Start() and making the speed
enemyRb.AddForce(lookDirection * spawnManagerScript.enemySpeed);

deep minnow
thorn kiln
#

I mean it's hard to tell really

deep minnow
thorn kiln
#

The game they have you make feels awful to play, so I can't really tell if they're getting faster each weave, but I used Debug,Log and the number is certainly going up

deep minnow
thorn kiln
#

No, I mean, I think they're going faster, it's just hard to actually tell

deep minnow
#

or spawn rate inside of a for loop

thorn kiln
#

I don't even know what you're talking about anymore

rich ice
#

i think they're saying you should make a timer to check

rich adder
#

blind leading the blind

deep minnow
gilded glacier
#

Hi everyone, is there an (official) tutorial on how to make and import a package from github? My package will have some scripts + a couple of image files; so far I could only make a big mess... 😅

rough granite
undone pier
#

how do I listen to an eventInfo callback regardless of the event parameters?

deep minnow
rough granite
deep minnow
rich ice
#

should just be able to press the + in the package manager

rough granite
deep minnow
undone pier
rich adder
undone pier
#

kinda like event += (_) => FooBar(); but reflection

gilded glacier
rich ice
#

seems like a problem with the scripts then, not the package

#

in order for a script to be added as a component in unity it has to derive from MonoBehaviour

#

make sure there are also no compile errors

gilded glacier
#

Well everything worked fine before; these scripts were part of my project initially (yes, they derive from MonoBehavior, no errors, etc.)
But now I want to package them so I'm testing on the same project

rich adder
#

still sounds like UI Toolkit..

#

or are you talking about System.Reflection

snow jewel
#

Hi I'm working on a Unity project and having some trouble with spawning fireballs continuously. I've got a powerup system where players can collect different power ups, including a fireball, but the fireballs aren't spawning as expected. Fireballs should spawn every 5 seconds after the player collects the fireball powerup. the fireball spawns once but doesn’t spawn again.

The first class is responsible for handling the fireball powerup in the game. When the player collects the fireball powerup, it starts spawning fireballs at regular intervals.

The second class handles the logic for applying powerups based on the player's response. It interacts with all my power ups, including the fireball.

https://paste.ofcode.org/NXs5nsvQExV8iTq7mb2LrA - Both classes are in this

hazy slate
#

can we discuss errors related to vs community here?

rich adder
undone pier
fossil plaza
#

what is an array

rich adder
rich adder
hazy slate
# rich adder only if they are related to unity.

yes ofc, I'm trying to run my game with universal windows platform but this error always shows for some reasons
UnityException: Build path contains XAML build which is incompatible with D3D build type. Consider building your project into an empty directory.
PostProcessWinRT.CheckSafeProjectOverwrite () (at C:/build/output/unity/unity/PlatformDependent/MetroPlayer/Extensions/Managed/PostProcessWinRT.cs:300)
PostProcessWinRT.Process () (at C:/build/output/unity/unity/PlatformDependent/MetroPlayer/Extensions/Managed/PostProcessWinRT.cs:132)
UnityEditor.UWP.BuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at C:/build/output/unity/unity/PlatformDependent/MetroPlayer/Extensions/Managed/ExtensionModule.cs:86)
Rethrow as BuildFailedException: Exception of type 'UnityEditor.Build.BuildFailedException' was thrown.
UnityEditor.UWP.BuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at C:/build/output/unity/unity/PlatformDependent/MetroPlayer/Extensions/Managed/ExtensionModule.cs:90)
UnityEditor.Modules.DefaultBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <e2ec61eabaea4cfa8892d65208615f30>:0)
UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.Int32 subtarget, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <e2ec61eabaea4cfa8892d65208615f30>:0)
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()

Build completed with a result of 'Failed' in 4 seconds (4458 ms)
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun ()

UnityEditor.BuildPlayerWindow+BuildMethodException: 2 errors
at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlay

snow jewel
rich adder
rich adder
rich adder
snow jewel
rich adder
thorn kiln
#

I've got a smoke particle effect attached to my sphere player that play when I boost with the space bar, unfortunately it rolls around with the sphere so it doesn't really look like a boost. How do I keep it behind the sphere?

rich adder
#

paste these in links !code

eternal falconBOT
hazy slate
#

sorry for the long message Imma put it as a txt

snow jewel
rich ice
rich adder
hazy slate
rich adder
# hazy slate here the error

that doesnt really answer my previous question btw
Which folder is the project path located, and which folder are you building the game into ?

snow jewel
# rich adder WaitForSeconds doesnt work if timescale is 0. you need WaitForSecondsRealtime i...

wait lemme explain. so a question pops up if the player collides with a power up and if the player answers the question correct then the applypower method gets called for whichever powerup the player collides with. i set timescale = 0 when the question is up and im pretty sure i set it back to 1 after the player answers the question correct or incorrect. do u think i forget to set it back to 1 or is it some external problem with some of the objects components or maybe another script

rich adder
#

there are two questions there

rich adder
#

just switch it to WaitForSecondsRealtime and see if still does it

snow jewel
rich adder
snow jewel
hazy slate
snow jewel
dusk shuttle
rich adder
#

uhh wasnt there a command for this

rich adder
dusk shuttle
#

so what i must do?

rich adder
dusk shuttle
#

yea

#

and i must change something on my script or in my object

#

but i don't know if the ui throw me the error or player code

dusk shuttle
#

ok i try

#

thanks

scarlet skiff
#

why is this code, bugging out debug.log its not the same name anymore, how do i amke it stop giving this error

scarlet skiff
#

wait nvm its cuz i kept that one as "Debug" oops

dusk shuttle
#

and last question i do a script and i can look up and down but no left and right.Whad i do wrong?

burnt perch
#

Im trying to make a pixel 2d UI with a 570x320 image. Its native size is 570x320, its set to that in the image, the camera has pixel perfect camera with 32ppu, the canvas resolution is 570x320 with 32ppu and scale with screen size, yet the logo is too big in game

#

I always have a hard time with UI stuff

rich adder
eternal falconBOT
dusk shuttle
rich adder
dusk shuttle
#

i don't know

#

just

rich adder
#

also next time post the !code properly

eternal falconBOT
dusk shuttle
#

!code

eternal falconBOT
rich adder
#

the point was to use links, not spam the bot message again

#

* Time.deltaTime should not be used on mouse inputs btw

dusk shuttle
#

so what i must to change

rich adder
#

well first get rid of that

dusk shuttle
rich adder
dusk shuttle
#

nope

#

i don't use ai

rich adder
#

huh ? where did you get script from cause it looks exactly like others I've seen here

dusk shuttle
#

from youtube

rich adder
#

hmm k.. did you assign all the fields, did you check console

dusk shuttle
#

yea

#

nothing

rich adder
#

that Rotate looks wrong

#

what did they write on video cause that shouldn't work afaik

dusk shuttle
#

so what i must change

outer canyon
#

hi, sorry to interrupt, i have a probably very simple question- it keeps throwing an error here at line 21 saying theres a missing semicolon somewhere and i can't figure it out =( https://paste.mod.gg/fcrvitskfoyp/0

rich adder
dusk shuttle
#

so i must change something in code right?

rich adder
#

transform. and playerbody should not be assigned to the same object

#

transform is supposed to be the camera object, usually child

rich adder
eternal falconBOT
dusk shuttle
rich adder
#

the structure is usually
-Player
--Camera
--BodyCapsule

dusk shuttle
#

can be cylinder?

rich adder
#

the Root shouldnt have any graphics on it, only scripts and collider/rb or cc, graphics go on child , it doesn't matter if its a cylinder or capsule

outer canyon
rich adder
#

screenshot the IDE

dusk shuttle
#

now this shit

rich adder
#

whats with you and cropped screenshots

#

anyway open the console you will see if its an editor failure or

outer canyon
rich adder
#

thats where the issue is

#

look at your code and the code from the lesson, you can easily compare that section for differences

dusk shuttle
#

ok

floral garden
#

Oh sorry

#

He was learning 😓

outer canyon
#

looks like i did miss the =, thanks both of you -i was hung up on it saying i missed a semicolon i didn't even see it </3

floral garden
rich adder
outer canyon
#

good to know, will keep in mind

rich adder
#

as far its consered it has no clue what you want to do with transform.postion

#

its like just saying red apples out loud lol

strange kelp
#

Sup guys, so I'm trying to do basic physics for a space game. This is basically my first time using Unity(1-2 hours in).
I want to get all the children of an empty object in the scene. From there on, I want to get the properties in a mono behaviour script attached to those objects. How do I do that?

floral garden
rich adder
#

depends though, its much easier to make specific references in inspector and assigning the components there

floral garden
#

My teacher said it is not a recommended way to do getcomponentinchilden, the best is assign it directly in the inspector as if the children doesn’t exist or is placed in different index then you will get an error or not the component you want. UnityChanThink UnityChanThink UnityChanThink

strange kelp
#

I'm gonna assign the folder of the planets in the inspector, then get all the children of that(basically my planets) in the script

#

Stupid question: how do i make an array of gameobjects?

floral garden
rich adder
#

lookup "make array c#"

#

its the same regardless of type

#

GameObject is just a type like any other c# type

floral garden
#

Stackoverflow has a lot of tuto , i think it will be the first thing you will get

strange kelp
#

Thanks. These questions might be pretty stupid but I came from Roblox Studio where everything is a bit "simpler"

rich adder
#

best do the c# basics though through Microsoft learn site & others like w3schools

floral garden
#

If it the first time you are coding, learn first what is a array before using it

strange kelp
#

W3schools is goated

strange kelp
rich adder
#

its okay the microsoft one is better but should get you started on the basics

floral garden
strange kelp
#

mainly python and lua, but also a bit of cpp

#

But I stopped cpp after not understanding why it's giving me linker errors lol

floral garden
#

Haha c++ is harder than lua or python basically but all three is used for different purposes

strange kelp
#

To be honest, I like that c++ is so "free" compared to Python or Lua
(not it terms of money)

rich adder
#

🤔

floral garden
#

Python is for beginners as it is very easy but the syntax make it hard to understand for higher programmers because you don’t have {} to delimit function range or something to tell you what type is a variable

strange kelp
#

Yeah, Python with {} and ; would be better

rich adder
floral garden
#

(If i look back a the tower defense i have done 1 year ago in python) i am going crazy with all the if notlikethis notlikethis )

#

Btw , for a custom pool manager, what is the best way to get a GO?

rich adder
#

I would just go with the Pool unity has

#

works right out the box

floral garden
#

But i need to use with addressables

strange kelp
#

Why isn't it finding planet_folder

floral garden
rich adder
strange kelp
#

Yeah gameobjects, I know

floral garden
#

Point your mouse on the function and it will give you exemple in the doc

rich adder
#

its not a param

floral garden
#

It a type of:)

rich adder
#

GetComponents is Generic function, it expects a T not really a specific instance of t

#

did you look at the docs

strange kelp
#

Oh I remember templates from c++, it was traumatising

floral garden
#

More easily to understand, when you see function<T>(params)
T is a class or a structure (not sure for struct)

#

It can be gameobject as personalscriptclass

#

(If it can’t accept it then the ide will tell you)

rich adder
#

basically any script that is on a Gameobject is a Component

strange kelp
#

Oh god roblox studio seems like python compared to c++

rich adder
#

you should mainly be looking for scpecific scripts , its pretty rare you need to use GameObject

floral garden
rich adder
#

not sure how thats relevant here lol

floral garden
#

Or majority

strange kelp
#

C++, C, C# or rust

rich adder
#

C# is a cakewalk

strange kelp
#

Wait nvm

floral garden
strange kelp
#

I'm not a native english speaker, so I don't understand everything directly lol

floral garden
#

still, you hasn't answer me, if I want to use addressables with unity pool system, is it possible ? or not ? (I made my custom pool system but just to know)

floral garden
#

I made my personnal pool system thinking unity don't have it

#

cost me a lot of time lmao

#

!code

eternal falconBOT
strange kelp
#

Eh, you can still fill the pool with water

white crag
#

i would suggest learning some data structures and algorithms

strange kelp
#

Wasn't a complete waste of time imo

white crag
#

idk why im really here i used to make games w unity and switched to software engineering

#

ig i just wanted to say learning dsa would make game dev easier

floral garden
#

yeah like, you know more exactly what you are doing

white crag
#

definitely you reminded me of when i made my first object pool

#

it looked so complicated back then

floral garden
#
    #region Fields
    private readonly Dictionary<GameObject, Queue<GameObject>> _unactifPoolableObjects = new();
    private readonly Dictionary<GameObject, HashSet<GameObject>> _actifPoolableObjects = new();
    private readonly Dictionary<GameObject, int> _dynamicPoolTracker = new();
    private readonly CancellationTokenSource _cleanupTokenSource = new();

    private readonly Dictionary<GameObject, GameObject> _instanceToPrefab = new(); // Copy instance
    private readonly Dictionary<string, GameObject> _prefabsByKey = new(); // For addressables
    #endregion

this is the Fields of my pool system UnityChanBugged

floral garden
#

it hard asf

#

event more when game designer don't use it like how it should be

white crag
#

whats up with the _ naming convention did you used to be a c/c++ programmer?

floral garden
#

before going on C#

#

but I learn it in my school haha

white crag
#

lol i did the opposite C# -> C -> C++

grand snow
#

Java > js > c# > cpp > rust

floral garden
#

i will never understand js, and java, rust I don't know

white crag
floral garden
grand snow
#

its unique so should be fine

#

but may cause some gameobjects to never be gc'd

floral garden
#

gc d?

grand snow
#

garbage collection

floral garden
#

ahh

#

ookk

strange kelp
#

Unity is for tomorrow, sleep is for today

floral garden
#

I remember my nightmare in C was the memoryAlloc notlikethis

floral garden
strange kelp
# floral garden sleep ? what is sleep ? haha good night

Schlaf ist ein Zustand der äußeren Ruhe bei Menschen und Tieren. Dabei unterscheiden sich viele Lebenszeichen von denen des Wachzustands. Puls, Atemfrequenz und Blutdruck sinken bei Primaten und anderen höheren Lebewesen im sogenannten NREM-Schlaf ab und die Gehirnaktivität verändert sich. Das Schließen der Augen während des NREM-Schlafs unterstützt diese Funktion.

#

Anyways, cya all

grand snow
floral garden
white crag
#

smart pointers are still annoying

#
std::vector<
        std::shared_ptr<server::SPSCQueueT>> 
        m_response_queue_list;
#

i am seg faulting trying to resize this

grand snow
#

the vector resize is segfaulting?

white crag
#

yup

floral garden
white crag
#

its super weird the way im getting a ref to it might be the issue but it shouldnt be

floral garden
#

what a nightmare

grand snow
#

yea how did you make the shared ptrs?

white crag
#

thats a long story 😂

#

it would need some tea its a trading engine project

floral garden
#

hahaha

grand snow
#

Hmm sounds like your fault 😆

floral garden
#

do you know if it is possible to increase the speed of compilation ? as unity recompile each time you update a script and sometime it take longer than 1min ?

#

as it compile on one thread if i am not wrong

grand snow
#

use asm defs
get better computer
cry

floral garden
#

i have a i9 14900 hx

grand snow
#

the setting is to disable domain reloading but that requires lots of things to be done to manually deal with the effects

white crag
#

yea

#
Uncheck Reload Domain and Reload Scene. This prevents Unity from recompiling all scripts and reloading the entire scene every time you enter Play Mode, drastically speeding up iteration times, especially when making minor code changes. Be aware that disabling Domain Reload requires manual re-enabling if significant script changes (like creating new classes or renaming files) are made, as these changes won't be reflected without a domain reload```
floral garden
#

ugh

grand snow
#

no it only recompiles when code changes

#

ai bullshit?

floral garden
#

think, it is some usefull way to update old script

#

or testing a class

rich adder
#

use domain reload off all the time.. the only thing to watch for is explained in the docs its mostly harmless , mostly static need to be manually reset / cleaned properly

floral garden
#

hmm ok then I will keep it unable then haha yes

#

it not like 30s of compilation is long (30x multiple time)

rocky canyon
#

you can jump around scripts in the code editor and jump over to unity when ur done bulk-editing

floral garden
#

fak just because I forget to save the file

rich adder
floral garden
rich belfry
#

i set LineRenderer.sortingOrder = -1 but it still appears in front of a SpriteRenderer.sortingOrder = 0. how do i get the line renderer to appear behind the sprite?

floral garden
#

maybe you should move all from +1 ? UnityChanThink

#

change the Z position of you lineRenderer

rich belfry
#

i moved the sprite to layer 2 and the line rendere to layer 1 but it's still on top for some reason. are you saying change the z transform of the gameobject the linerenderer component is on?

rich belfry
#

it's 2d

#

this my code for the line rendere

    protected virtual void Awake()
    {
        lineRenderer = gameObject.AddComponent<LineRenderer>();
        //lineRenderer.material = new Material(Resources.Load("Assets/Materials/AimIndicator.mat", typeof(Material)) as Material);
        //if (lineRenderer.material = null)
        //{
            //Debug.LogWarning("LineRenderer material is null");
        //}
        lineRenderer.positionCount = 2;
        lineRenderer.startColor = Color.red;
        lineRenderer.endColor = Color.blue;
        lineRenderer.startWidth = 0.01f;
        lineRenderer.endWidth = 0.01f;
        lineRenderer.useWorldSpace = true;
        lineRenderer.sortingOrder = 0;

    }
#

this is the player prefab

rough granite
# rich belfry it's 2d

well few things you can do first when running make sure the line renderer is never in front -z axis of the sprite

#

you dont want the opposite of this photo

#

or do you want the line renderer above the sprite?

rich belfry
#

behind the sprite
right now the line is on top

hazy slate
#

hello, uuh for some reasons I can only build my game (UWP) with build type executable only, when I select d3d project I get those errors

rich ice
#

not a code question

rough granite
hazy slate
#

what does error MSB4057: The target "MarkupCompilePass1" does not exist in the project. even mean

rich ice
#

again not a code question. please stop asking in this channel

rich belfry
#

ah okay, if there is no material assigned it appears in front, if there is a material assigned it appears behind. i wonder why

floral garden
#

how can I profile memory to find memory leak ? UnityChanThink

#

like if it has memory leak after closing app

north kiln
#

Closing the app like, sending a mobile app to the background, or closing an executable on PC?

north kiln
#

Nothing is open when you close an executable, all the memory is released

#

Memory leaks occur within a program's lifetime

floral garden
#

oh

#

I see

north kiln
#

(unless you're doing something non-standard that's reaching out to other programs in a way that doesn't link processes)

floral garden
#

I can't check memory leak of my pool system and addressables manager then...? maybe changing scene but the pool is not reset btw scene

north kiln
floral garden
#

thanks for the answer

mystic flume
#

Anyone know how to get the high definition 3d option it’s not appearing for me

rich ice
#

might depend on the editor version but it should just be there by default when creating a project.

#

also not a code question

native seal
#

anyone know how the lighting is done here? especially at 0:52 where the light floats "up and down" and changes the shadows cast by the rocks above? https://www.youtube.com/watch?v=lMFaTxcCgx0

with shadow caster 2d, it just creates infinite shadows, are they doing some sort of 2.5d? could I make a script that does this in pure 2d?

We’re so proud to be sharing our first long-form gameplay video. This video shows off the first 15 minutes of our “alpha” demo. There are a few things to note when watching the video.

  • It does not show all the features or content in the game.
  • There are some missing elements like UI and UX polish.
  • We have cinematics planned for the...
▶ Play video
timber tide
#

2d shadows seem neat and no clue how they work

#

but 2.5D is pretty automatic

#

with unity's currently lighting modules

native seal
#

do you believe thats what they're doing?

#

that light is just offset from the tilemap and the rocks have an invisible extruded form that casts a shadow?

timber tide
#

they have a lot of self-shadowing going on so I'd say so lel

#

Actually it does make sense to self-shadow in some of this stuff

native seal
#

what do you mean by self shadow?

#

not just baked in shadows

timber tide
#

But looking into it more it looks intentional cause day scenes they do shadow properly without affecting the sprite

#

pretty neat though if it is full 2.5D

native seal
#

i wonder how hard that would be to make

#

i hate how top down lighting looks so bad in base unity2D

timber tide
#

It's pretty simple, especially if you're not rotating the camera

native seal
#

since theres no perspective of how tall something is

#

like take this for example, idealy the shadow would be cut off since presumable the light is super high in the sky at an angle

#

not directly next to it

timber tide
#

they aren't directly upwards. Everything is tilted by some degrees

#

similarly, you tilt the directional light to compensate

native seal
#

this is from a spot light, directional lights dont seem to work in 2D unless im doing something wrong?

#

i assume they are 3d only

timber tide
#

im talking 2.5D. No clue how 2D lights work

#

some voodoo magic for all I know

native seal
#

ah i see

#

yeah this is pure 2d haha

timber tide
#

Thing which makes me feel like it's 2.5D is they alpha cut all the sprites

#

meaning there's actualy depth sorting

native seal
#

yeah

#

the material on their stuff is also called sprite lit depth

#

not sure if thats relevent

#

i asked in the discord 🤷‍♂️

native seal
timber tide
#

2.5D is just a 3D project

native seal
#

how would I have tilemaps then? theres no option to create them haha

wintry quarry