#archived-code-general

1 messages ยท Page 19 of 1

coral hornet
#

well i suppose im going to look into ray marching and marching cubes and whatnot

#

see if i can get a demo of this idea down

#

if i cant ill resort to more simplistic and straightforward methods

boreal bone
#

sounds good

coral hornet
#

ray marching is neat, neat way of raycasting

#

well thats one way of doing it, only issue is that itd be heavy on the CPU, and a GPU shader wouldnt really allow for collision changes, neat regardless

void basalt
#

Is there any way to reserve a layer for my framework? Kinda what unity does with their "built-in layers"

boreal bone
#

so like you spawn 100 box colliders at the beginning and just move them as needed to cover the area

coral hornet
boreal bone
boreal bone
#

@void basalt you could have an error print to the console that checks if that layer exists

coral hornet
#

could work, but wont i still have collission faces inside?

#

ill consider this all tomorrow, i feel super sick today

#

thanks for the ideas tho

boreal bone
#

happy to help

#

get better soon

safe knoll
tawny jewel
#

im getting the Since 'pipespawnscript.spawnTargetPipe()' returns void, a return keyword must not be followed by an object expression error, how to fix that?

    {
        float lowestPoint = transform.position.y - heightOffsetTraget;
        float highestPoint = transform.position.y + heightOffsetTraget;
        var buttonspawns = new[] { Random.Range(middle.transform.position.y, -17), Random.Range(middle.transform.position.y, 17) };
        var idx = Random.Range(0, 2); 
        return buttonspawns[idx];

        Instantiate(targetPipe, new Vector3(transform.position.x, Random.Range(lowestPoint, highestPoint), 0), transform.rotation);
        Instantiate(button, new Vector3(transform.position.x - 2.5f, buttonspawns[idx], 0), transform.rotation);
    }
tawny jewel
#

fair enough

cosmic rain
#

Or change the return type of the function

tawny jewel
#

will it work if i just remove the return line

cosmic rain
#

It will compile.

#

As for wether it would work, depends on your code and what you try to achieve with it. I'd assume that if you added the return, it had some purpose..?

tawny jewel
#

honestly it was just my attempt to fix the code

#

my goal is to spawn the button anywhere in the y pos except for specific coordinates

#

never really had an occasion to experiment with that sort of thing so yea

gilded field
#

Hi so I have this player prefab setup for my multiplayer top down shooter game. (I'm using Photon as a multiplayer solution btw). The player is made to face the cursor, and will be able to shoot at it later.

My problem is that in the tutorial I am following, the person attaches a camera to the player prefab. When i do this and the player spawns, the camera begins rotating with the player, what could I do to solve this?

somber nacelle
#

don't attach the camera to the player. you're using cinemachine to control the camera anyway so there's no reason to have it attached, just make the player the follow target for the vcam and the camera will follow the player without needing to be a child of it

gilded field
#

but how will i manage that with multiple players?

#

because I can create 1 camera to deal with 1 player, but idk how to do so with more than 1 player

somber nacelle
#

delete the vcams for the networked players so that only the vcam on the local player exists

gilded field
#

oh i spawn the players at runtime

somber nacelle
#

well obviously. you can still do that though

#

just replace the word "delete" in my message with "destroy" if it's too confusing for you

#

or even just "disable"

gilded field
#

ohyea sorry im still new to multiplayer i should have mentioned

#

im not really sure what you men by local vs networked, could you please explain

somber nacelle
#

since you're using photon i'll put it in super simple terms: photonView.isMine == local player, everyone else is a networked player

gilded field
#

oh i see

#

so at runtime, it will disable all other cameras for the player locally?

somber nacelle
#

well you have to write the code that does that, but yes. disabling or just straight up destroying the non-local player's vcams will make it work

gilded field
#

ok i'll try that and let you know

#

thank you for the tip

slender urchin
#

hey there.
i have a ui that display "Step" and its "Required Tools" using one text gameobject.
for this example, the Step is [0] Jack and its Required Tools: should be wrench sz and atlanta grease
but on the text only display the atlanta grease
so what i want is on ui is:
[0] Jack
Required Tools:

  • wrench sz
  • atlanta grease

how do achieve that? thank you in advance ๐Ÿ™‡โ€โ™‚๏ธ

tired geyser
#

hey everyone, I got this weird thing where I want my player to transition to a sliding position, during which I need to change the capsule collider's direction from the Y axis to the Z axis and lower the center. Though when I do this I can Lerp the Center position but not the capsule direction? so the player ends up moving upwards before the capsule flips. Any Ideas on how to solve this dilemma?

open dew
#
    void Update()
    {
        Ray ray = new Ray (cam.transform.position, cam.transform.forward);
        RaycastHit hit;
        Debug.DrawRay (cam.transform.position, ray.direction * distance);
        if (Input.GetKeyDown (KeyCode.E)) {
            if (Physics.Raycast (ray, out hit, distance)) {
                if (hit.collider.gameObject.tag == "Door") {
                    isOpen = !isOpen;
                    playedAnim = false;
                }
            }
        } 

        if(!playedAnim) {
            if(isOpen) anim.Play("dooropen");
            else anim.Play("doorclose");
            playedAnim = true;
        }
    }

I have this code, my animate to not loop, but the door appears to be repeating the end of my door open anim

open dew
#

my code is now

if(isOpen) {
  anim.Play("dooropen");
} else  {
  anim.Play("doorclosed");
}

and now it loops just the door opening

#

i read somewhere i was supposed to hit apply after turning off loop time, i dont see no apply button

coral hornet
#

so wait, why are mesh colliders expensive?

#

like if you have a cube mesh with a mesh collider, just 4 verts, how is it different from a cube collider

open dew
leaden ice
leaden ice
#

Verts are usually duplicated per face to achieve flat shading

coral hornet
#

i am aware

#

i used the term 4 verts to simplify what i was trying to say

#

cuz you can have a cube split in half, that still visually looks like a cube

#

just specifying it was a basic cube, 4 points

#

6 sides, whatnot

leaden ice
#

Regardless of how many vertices, the computer doesn't know it's cube shaped.

#

8 points*

coral hornet
leaden ice
open dew
#

it cant see the mesh, it just knows how much verts and such it has

coral hornet
leaden ice
#

Oh course not

#

It's just a mesh

#

Like any other

#

As far as the program is concerned

#

Computers don't look at things and draw inferences. They simply do as they are programmed

coral hornet
#

i know

leaden solstice
#

OBB collision check is way easier than arbitrary polygon collision check

coral hornet
#

i suppose i was just figuring that if drawing that inference would change a heavily expensive mesh collider to a more recognizeable cube collider, that maybe it would be able to cut down on costs

#

like a mesh made out of 3 cubes, drawing that inference and having 3 recognizeable cubes... idk.. dumb question

leaden ice
leaden solstice
#

And what about sphere ๐Ÿ˜„

leaden ice
#

That would be wasted work for every mesh that isn't a box, which is most of them

#

And yes what about sphere, and capsule, and so on. Now we're doing like 8 checks for various shapes on every mesh and it's all wasted when it's none of those shapes

#

Which is most of the time

coral hornet
#

yeah i know, it was a bit of a stupid question

leaden ice
#

I mean it's not a stupid question

coral hornet
#

yeah it was

leaden ice
#

It's worthy of exploration

#

But I believe Unity made the correct trade-off

coral hornet
#

in retrospect it had an obvious answer, no matter how much costs are cut using cube colliders for certain meshes, its going to cost alot more just to check if they are cubes

#

i just need sleep

leaden ice
coral hornet
#

wouldnt it be more than a one time cost

#

if the collider is altered in any way, wouldnt they have to check again and again and again

leaden ice
#

MeshCollider needs to be recomputed any time the mesh changes anyway

#

Basically like anything else it's a tradeoff which could make sense under the right conditions

#

But, most conditions are not that ๐Ÿ˜‚

coral hornet
#

yeah, well i guess i have a new question

#

whats the best way to go about making raycasts the most efficient they can be?

#

im using capsules for my players collision and i fear that the collider might make raycasts a bit expensive, especially for how much i want to use them

leaden ice
#

Capsules are very efficient

#

Raycasts individually are fine too

coral hornet
#

i want to have simulated bullets, which right now use raycasts, but its many raycasts and i fear that it might become an issue

leaden ice
#

Unless you've profiled your game and found a problem I wouldn't worry about it

#

Don't prematurely optimize

coral hornet
leaden ice
#

You're scared your game will end up like a huge success?

#

Unless you mean something other than team fortress 2

coral hornet
#

i like to optimize everything so that going into the next step i dont have to worry about the stuff i did in the past

leaden solstice
#

Games donโ€™t need to be perfect

leaden ice
#

Surefire way to introduce bugs is to increase the complexity by trying to prematurely optimize

coral hornet
leaden ice
#

Regardless, all software has bugs

coral hornet
#

but like

#

bullets in this game will be a huge part of it

#

right now im testing out firing like 5 a second, it works fine

leaden ice
coral hornet
leaden ice
#

Your best bet is writing clean, understandable, maintainable code

#

To make that process painless

coral hornet
#

and thats what i got so far

#

but on the topic of bullets.. whats the best way to simulate them?

#

im figuring its raycasts

#

i dont need the bullet to be wide or have any kind of parameter for width

#

but i wonder how optimized unitys physics engine is, and if optimization wise its better to use raycasts or physics

pine spire
#

Itโ€™s about speed and amounts

#

If you just need one frame hit check you use raycast.

Of you have slow moving bullets and there isnโ€™t ton of them you can use colliders. With faster moving you would need continuous or speculative collisions and even with them it will never be as accurate as linecast.

If you need moving bullets and colliders donโ€™t work, you do linecast / distance limited raycast between position of this and previous frame. Apply gravity manually if needed. Starting from inside the collision donโ€™t work so you either do it from a bit more behind or two way, if they are reeaaally fast. In extreme situations nonallocating version of raycast, since this generates garbage.

If that is too heavy you go and create your own bullet projectile system.

cinder kindle
#

How do I limit the range on a raycast?

vocal cypress
#

beginner is busy rn was wondering if yall could help me

pine spire
#

@cinder kindle linecast is exactly that - raycast between two points, but raycast also has maxDistance parameter

cinder kindle
#

what does it measure in?

pine spire
#

Same units in coordinate system everything else uses

swift falcon
#

Is it possible to call a void with more than 1 parameter via button?

#

For example :
void Set(int health,int armor){}

cosmic rain
#

If you call the void for too long, the void starts to call you.

#

Please don't use the word "void" for methods/functions. It's not correct.

thin aurora
#

Think about it this way: How is the button supposed to understand how to set the parameters of something it doesn't implement?

#

What you probably want is to implement the button normally, and then call your Set method manually after getting the values it requires

young bramble
#
    void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.gameObject.CompareTag("ground"))
        {
            GetComponentInParent<player>().isJumping = false;
        }
    }

    void OnCollisionLeave2D(Collision2D collision)
    {
        if (collision.gameObject.CompareTag("ground"))
        {
            GetComponentInParent<player>().isJumping = true;
        }
    }

Would this work, or is there a scenario where this could enter and leave on the same frame or anything that would cause it to break?

swift falcon
#

Seems it's not possible via inspector

somber nacelle
somber nacelle
young bramble
somber nacelle
#

and yet it's still not a very good way to check if the player is grounded. Whoops, i bumped into that object that has the ground tag while walking on the ground and then moved away from it. guess i'm not grounded anymore

young bramble
#

I tried creating an overlapboxall, but it doesnt seem to work. is there way to display the box in the scene?

#

also, is there any difference / preferred use for new Vector2 (x, y) as opposed to (Vector2) x, y ?

somber nacelle
somber nacelle
peak jacinth
#

All prefabs in Resources folder are loaded at the start of game.

How do prefabs not in Resources folder work? Are they only loaded when you instantiate them, or are all prefabs referenced in a scene loaded at start of game?

young bramble
somber nacelle
#

yeah that makes more sense and is perfectly fine

quartz folio
leaden ice
quartz folio
#

Addressables is the way to handle that sort of thing if you want control over memory

thin kernel
#

Hello, my question is about new input system and best practice with it. So u can auto-generate a new script with all configured actions, then u should create an instance of it and then u can enable/disable action maps or subscribe to events. The question is, how do u create an instance of this script? Do u create it in every class that depends on the input system? Or do u have a god class that just gives everyone access to it? And if second, then maybe it would be more convenient to do the enable/disable logic in the god class as well, so the transactions between game modes would be easier to understand?

somber nacelle
#

dunno if it's "best practice" or whatever, but i typically go with the first option of creating an instance for each object that needs to use the input and only enabling actions that object depends on, although i also don't typically have a whole lot of objects that need input

thin kernel
#

So that's is an option too, hmm. It's just felt weird to create it over and over again, I felt like I'm missing the point of having multiple action maps in the first place, when I'm using only one in every class.. The project I'm working now will have multiple input devices in the end and a lot of different button events

alpine nova
#

(C#) Hello, I have a quick question. Using a repository in a (view)model, is this valid MVC?

main shuttle
rotund jetty
#

hey guys. I have a drag and drop function in my game and when I have an object over a trigger zone it snaps to the place it's supposed to. I've made a silly script that works given the time sensitivity of it. And basically I want it so that when it's let go it returns to its original position unless it's in the trigger zone.


iDragComponent?.onEndDrag();
        if (ObjectInBounds == true)
        {
            MaskObject.transform.position = MaskPosition.transform.position; 
        }
        if (ObjectInBounds == false)
        {
            MaskObject.transform.position = MaskOriginalPosition.transform.position; 
        }``` 
Here's the code where it checks if it's in the bounds. For some reason it works if it's true (snapping to the desired location) but it doesn't if it's false (returning to its original position)
#

ObjectInBounds is updating just fine

placid summit
#

given a pos & normal of a face, how do I know if it is facing a camera or backface?

main shuttle
placid summit
#

is it dot of face pos - cam pos & the face normal maybe...

#

used to know this but google not helping me!

#

I was right - chatgpt to the rescue, damn that is helpful...

trim mauve
#

i downloaded a zipped file and i apparently i cant delete it even if i did it from cmd and it says its in the desktop and when i go to the location its not found i only can see it recent page so i pinned it so i can see it if its gone from the recent page any help plsss

#

i downloaded a zipped file and apparently i cant delete it even if i did it from cmd and it says its in the desktop and when i go to the location its not found i only can see it recent page so i pinned it so i can see it if its gone from the recent page any help plsss

orchid oyster
#

hello guys

#

i need help

rotund jetty
#

Change Z to Y pretty sure

orchid oyster
#

hmm

orchid oyster
#

ok

orchid oyster
#

i m making my own transformers game and my question how to combine transformation animation to transform button

#

Dead

quartz jay
#

what is

#

at the end of my namespace

merry fog
#

send whole code

#

ive had this before

#

its literally just a missing bracker further up

trim mauve
#

i downloaded a zipped file and apparently i cant delete it even if i did it from cmd and it says its in the desktop and when i go to the location its not found i only can see it recent page so i pinned it so i can see it if its gone from the recent page any help plsss

quartz jay
merry fog
#

how th did u make the message into a file lmao

mellow sigil
#

You start a region with #region but don't end it with #endregion like the error message says

quartz jay
#

too many letters i think

mellow sigil
#

!code

tawny elkBOT
#
Posting code

๐Ÿ“ƒ Large Code Blocks
Large code blocks should be posted as links to services like:
https://gdl.space/, https://paste.ofcode.org/, https://hatebin.com/
https://paste.myst.rs/, https://hastebin.com/

๐Ÿ“ƒ Inline Code
Surround code with three backquotes. Not quotation marks.
To get C# formatting the first line should only contain cs or csharp.
Add a comment with a line number if there is an error message.
```cs
// Your code here
```
Do not share screenshots of code unless requested.

merry fog
#

i recommend gdl.space

#

it the goat

orchid oyster
merry fog
#

thats not what i meant

#

if u look at the file u can see he ended it with three

#

`

#

`

#

`

mellow sigil
merry fog
#

yknow

#

like u would sending it in discord

quartz jay
orchid oyster
#

hmmmm

#

huh

#

ok

#

bye

merry fog
#

#region Movement

quartz jay
merry fog
#

#endregion Movement

lucid valley
quartz jay
#

oh

mellow sigil
merry fog
#

thats the error

quartz jay
#

i see

#

Ok solved, ty

silent canopy
quartz jay
#

what does this mean

silent canopy
# quartz jay

This means that inputHandler is returning null or returns with no value..

quartz jay
somber nacelle
#

inputHandler = GetComponent<InputHandler>();
this object apparently does not have an InputHandler component on it

quartz jay
#

Oh

#

thank you, i just had the wrong file name saved

wanton flume
thick socket
#

however check your UI toolkit document

quartz jay
thick socket
#

should be able to make the background for it non-interactable which probably fixes it

bronze crystal
#

how can i put lives next to my text?

frosty widget
#

Does anybody know how to rotate/flip a particle system in Unity 2D? I want the particle system to rotate/flip to the direction that my character is facing, but I haven't been able to figure it out.

dusk apex
bronze crystal
#

can you destroy other object? Destroy(other.gameObject);

thick socket
#

ya

glad cosmos
#

what should be the if statement?

thick socket
#

it gives you the collider you collide with

#

so if this function is on your player

#

you probably want to see if the collider is ground, not the player.gameobject.collision(which I find unlikely to exist)

dusk apex
bronze crystal
dusk apex
quartz jay
#

Ok so i've created a player action map and a playercontrols script, i've made sure all my composites work

#

but whenever i play

#

nothing happens

bronze crystal
quartz jay
#

but still nothing happens

bronze crystal
#

How can i display my text and score next to eachother? void OnGUI() { GUI.textScore + ": " + score; } }

dusk apex
dusk apex
bronze crystal
dusk apex
#

The code isn't yours if you've not got something called other in that scope

cyan stratus
#

Hi Guys
I have problem. I have piano in the scene where every key is seperated GameObject.
Piano has script and in this script i first convert all keys into dictionary so i can access them from code easly. I invoke function on event when signle note in MIDI file is being played but when i try to access single key Animator it give me error that GetComponentFastPath Can be only use in main thread. Help !!!!
Here is code:

quartz jay
#

Need help with my player movement

glad cosmos
bronze crystal
#

why i get gui doesnt not have definition for scoreText void OnGUI() { GUI.scoreText = scoreText + ": " + score; }

tired geyser
lucid valley
#

also you can do $"{scoreText}: {score}";

bronze crystal
#
    public static float score = 0;```
lucid valley
bronze crystal
quartz jay
#

hi i need help with playermovement

woeful leaf
#

Don't remember exactly what it does tho

lucid valley
woeful leaf
#

Ah my bad

thick socket
#
[CreateAssetMenu(menuName = "ItemList")]

public class ItemsList : ScriptableObject
{
    public List<ItemReqs> CommonItems;
    public List<ItemReqs> RareItems;
    public List<ItemReqs> EpicItems;
    public List<ItemReqs> LegendaryItems;
    public List<ItemReqs> MythicItems;
}

[Serializable]
public class ItemReqs 
{
    public string ID;
    public Sprite sprite;
    public MyItemRarity rarity;
    [Dropdown("GetItemTypeValue")]
    public MyItemTypes itemType;
    private DropdownList<MyItemTypes> GetItemTypeValue()
    {
        return new DropdownList<MyItemTypes>()
        {
            { "armor",   MyItemTypes.Armor },
            { "helmet",   MyItemTypes.Helmet },
            { "jewelery",   MyItemTypes.Jewelry },
            { "weapon1h",    MyItemTypes.Weapon }
        };
    }

    [ShowIf("itemType", MyItemTypes.Armor)]
    public string IDHelmet;
    [ShowIf("itemType", MyItemTypes.Armor)]
    public Sprite spriteHelmet;
}

Not sure what I'm doing wrong

#

the ShowIf condition isn't working

woeful leaf
#

thic should be with two c's, so thicc

woeful leaf
thick socket
#

but they are pretty similiar

#

pretty sure the docs say Im doing it right

woeful leaf
#

Oh yeah I just got to that page

#

Lemme see

thick socket
#

shoot, that again

bronze crystal
# bronze crystal

anyone knows why i get the whole tmpro.text.mshproug i dont need that.

thick socket
#

thanks @late lion

#

so its nested because the code is inside of another list basically?

quartz jay
#

So im making a souls like movement using this video https://www.youtube.com/watch?v=LOC5GJ5rFFw&list=PLD_vBJjpCwJtrHIW1SS5_BNRk6KZJZ7_d&index=3&ab_channel=SebastianGraves

and i've done everything however nothing is happening when i press play

woeful leaf
#

define nothing

late lion
thick socket
quartz jay
#

these are the 3 main scripts he uses in the video and a playeractionmap which i've done already (WASD)

quartz jay
# woeful leaf define nothing

i press play and the character just falls to the ground slowly and whenever i use my WASD keys he doesnt move like hes supposed to

woeful leaf
#

define like he's supposed to

quartz jay
#

move around the plane without any animation and rotate whenever i press s (to move down) or w (to move up)

thick socket
#

this SO has "headers" like Equipment and Body

#

how do I do that in code?

#

(this script is DLL so can't see how he did it)

bronze crystal
#

anyone can help with ui problem

orchid oyster
#

hmm

thick socket
#

[Header("Weapons")] was what I needed ๐Ÿ™‚

devout star
#

How do you rotate a Tilemap's placed tile at runtime?

#

e.g.:

_tilemap.GetTile(worldCellPosition).rotation = ...
#

Solved

                var tileTransform = Matrix4x4.Rotate(Quaternion.Euler(0, 0, someArbitraryValue));

                var tileChangedData = new TileChangeData()
                {
                        position = ...,
                        tile = ...,
                        color = ...,
                        transform = tileTransform
                };
                
                _tilemap.SetTile(tileChangedData, false);
cedar jolt
#

Hello there!

I have a parallax effect script that I would like to use while I am in the editing mode of my game. Any idea as to how I should implement it to work in editor?

public class ParallaxEditor : Editor
{
    [SerializeField] private Parallax parallaxObject;

    void Update()
    {
        parallaxObject.UpdateParallax();
    }
}
woven kayak
#

Anyone now how to change an enum value from a Unity event on another script or object?

prime sinew
woven kayak
#

I don't have an issue attempt as its not something I can do currently. Whish is why I'm asking for help by saying "does anyone know"

leaden ice
woven kayak
#

I can give an example

leaden ice
#

please

woven kayak
#

Say you have a script with an enum, doesn't mater what it is Dog, Cat, Reindeer, etc. What ever. Then in a unity event for example on the ones on a button that fire on click. In that event you add the script with the enum by dragging it on and then you have a drop down in the unity event and you can chose things like Gameobject set active(bool) or EnumScript bool enabled.

But how can you select the enum and switch it or pass it a string to change the enum?

prime sinew
#

I think so, at least. I havent tested if enum parameters will show up

#

keep in mind you will need to drag in an object that has that script with that method attached, not the script itself

past pier
#

There is no way for me to make LineRenderer segments dissapear and reapear as needed other than creating a LineRenderer per segment or writing a complex shader, correct? Nothing like "disable segment" or "change texture for segment (to invisible)"? I'm asking becuase I'm already managing a 32x32 array of line renderers in my code and solving this problem by adding MORE line renderers would make the flow quite incomprehensable ๐Ÿ˜‰

woven kayak
prime sinew
woven kayak
prime sinew
# woven kayak

what's the script and what's the method you're looking for?

woven kayak
#

The script is HVRGrabSideLimiter
Looking for

public override bool CanBeGrabbed(HVRHandGrabber hand)
#

It uses

public HandOptions AllowedHands;

To set an enum Hand Options with Left Right or Both.

prime sinew
#

I couldn't find what the limitations are on UnityEvents in inspectors in the documentation

#

you can test by just defining a method that has a void return type and no parameters

#

then one with a void return type and that same parameter

woven kayak
#

Yeah its a odd one. Thanks for taking a look at it.

prime sinew
#

would be interested to know if you do figure it out

autumn cipher
#
public static void PlayAnimReversed(this Animation Anim, string animationName, float Speed = 1f)
    {
        Anim[animationName].speed = -Speed;
        Anim[animationName].time = Anim[animationName].length;
        Anim.Play();
    }```
Tried smth like this, didn't play anything
prime sinew
autumn cipher
#

Here's the MonoBehaviour class ```cs
if (GetKeyDown(NextWep))
{
ChangeWeapon(GetNextWeaponIndex());
}
if (GetKeyDown(PreviousWep))
{
ChangeWeapon(GetPreviousWeaponIndex());
}
}

void ChangeWeapon(byte index)
{
    Weapon wep = WeaponsInInventory[index];
    Utility.PlayAnimReversed(wep.wepAnim, wep.WepData.drawAnim.name);
    Debug.Log("Changing Weapon");
}```
#

debug log prints with no errors

prime sinew
autumn cipher
#

WeaponsInInventory gets filled when the game starts

prime sinew
autumn cipher
prime sinew
autumn cipher
#

I'm using the legacy animation player

prime sinew
autumn cipher
#

yes it does

prime sinew
#

If there really is no error message, then no clue ๐Ÿคท

kindred pike
#

anyone have any idea what unity is trying to tell me here? it's a fairly fresh project with not a whole lot in it. 2022.2

autumn cipher
#

yeah lol it's pretty weird, I'll try using normalizedTime instead

leaden ice
kindred pike
#

it doesn't seem to be causing trouble, so I assume it's safe to ignore?

#

I should try updating. i'm on 2022.2.0f and it looks like there's a 2022.2.2f

leaden ice
#

and yeah upgrading may help

#

it may also introduce new bugs ๐Ÿคฃ

kindred pike
#

sweet, thank you Praetor

leaden ice
#

If you want the most stable Unity experience stick to LTS versions

pure garden
#

any idea on

    {
        Mesh _mesh = new Mesh();
        List<Vector3> vertices = new List<Vector3>();
        List<int> triangles = new List<int>();

        int size = 20;

        for (int y = 0; y < size; y++)
        {
            for (int x = 0; x < size; x++)
            {
                Vector3 a = new Vector3(x - .5f, 0, y + .5f);
                Vector3 b = new Vector3(x + .5f, 0, y + .5f);
                Vector3 c = new Vector3(x - .5f, 0, y - .5f);
                Vector3 d = new Vector3(x + .5f, 0, y - .5f);
                Vector3[] v = new Vector3[] { a, b, c, b, d, c };
                for (int k = 0; k < 6; k++)
                {
                    vertices.Add(v[k]);
                    triangles.Add(triangles.Count);
                }
            }
        }

        _mesh.vertices = vertices.ToArray();
        _mesh.triangles = triangles.ToArray();
        _mesh.RecalculateNormals();

        MeshFilter meshFilter = gameObject.AddComponent<MeshFilter>();
        meshFilter.mesh = _mesh;

        MeshRenderer meshRenderer = gameObject.AddComponent<MeshRenderer>();
    }```
its simply not creating any mesh
leaden ice
#

also noting you haven't assigned a material to your MeshRenderer

pure garden
#

mesh is just not creating

leaden ice
pure garden
#

it creates it in the code

#

or does it need to create it before

#

the error is meshFilter.mesh = _mesh; this line

#

also if i asign the component in the inspector it just loads infinitely and crashes unity

leaden ice
pure garden
#

ok mb im dum

#

ty

prime sinew
#

i dont think that error is related to that snippet

#

show the full error please

exotic burrow
#

when should I use c# pointers in Unity?

prime sinew
leaden ice
exotic burrow
#

it has

leaden ice
#

Only in unsafe contexts

exotic burrow
#

with the unsafe block

#

yeah

leaden ice
#

If you have to ask, the answer is never tbh

late lion
#

Are you trying to set the state to DEAD or find all players whose state is DEAD? = is assigning, == is comparing.

exotic burrow
warped condor
#

I'm trying to update an object's position with transform.position = Vector3.MoveTowards(transform.position, targetPos, Time.fixedDeltaTime); this is inside the Fixed update method along with some other physics stuff. The distance between the current position and target position is always relatively small, however the position is updated way too slowly and it makes the object seem almost floaty. If I multiple Time.fixedTimeStep by some speed value then the speed is fine but the problem now is that it's really jittery and not frame rate dependant

leaden ice
#

And use deltaTime instead of fixedDeltaTime

late lion
#

It looks like you're trying to use Find like a foreach. It's expecting you to return a boolean in that method and it will give you the first element where that method returns true for.

simple edge
prime sinew
#

ok my mistake

late lion
warped condor
leaden ice
#

If MyContainer is a struct that's the issue

#

you would need to switch to a normal for loop, pull the struct out, modify it, then write it back

#
for (int i = 0; i < GM.playerarr.Length; i++) {
    GameManager.MyContainer x = GM.playerarr[i];
    if(x.player == obj.GetComponent<NetworkObject>()) {
        x.state = GameManager.PlayerState.DEAD;
        GM.playerarr[i] = x;
    }
}```
#

for example

devout timber
#

Hi there!

I'm currently wrapping my head around the following issue and I need some input for solving.

Scenario is the following: Imagine a Tower Defense game where you have a catapult that can shoot a bullet in a ballistic way to a target, I've done the ballistic calculation with this method:

public static Vector3 CalculateAdjustedBallisticVelocity(Vector3 launchPoint, Vector3 target, Vector3 weaponForward)
{
  var h = launchPoint.y < target.y ? target.y + 1 : launchPoint.y + 1;
  var gravity = Physics.gravity.y;
  var displacementY = target.y - launchPoint.y;
  var displacementXZ = new Vector3(target.x - launchPoint.x, 0, target.z - launchPoint.z);

  var time = Mathf.Sqrt(-2 * h / gravity) + Mathf.Sqrt(2 * (displacementY - h) / gravity);
  var velocityY = Vector3.up * Mathf.Sqrt(-2 * gravity * h);
  var velocityXZ = displacementXZ / time;

  return velocityXZ + velocityY * -Mathf.Sign(gravity);
}

My issue is the following: The method calculates the direct velocity needed to reach the target from a certain launchPoint.
However, the catapult sits on a rotating platform that may need some time to adjust.
The catapult should still fire its payload with the same force but in the direction of the platform rotation (that is the weaponForward parameter that is unused yet).

My issue is, that I can not think how to adjust the return value of the function so it uses the calculated force vector but fires that in the direction of weaponForward.

Anyone got any idea?

Thanks!

woven kayak
# prime sinew would be interested to know if you do figure it out

I managed it with a bunch of functions to just force the enum switch based on what I need set

public EnumExample myEnum;

//Some function to do things based on the selected enum.

public enum EnumExample
    {
        1,2,3
    }

//Functions to change enum at runtime
    public void option1()
    {
        myEnum = EnumExample.1;
    }

    public void option2()
    {
        myEnum = EnumExample.2;
    }

    public void option3()
    {
        myEnum = EnumExample.3;
    }

Those public void options then show up in a unity event and you can just call the one you need to switch the enum in use at runtime.

elder bay
#

Hi, I am unable to use any UnityEngine.U2D components with assembly definition. Do I have to add any references to the assembly definition? If so which references do I have to add on assembly definition.

leaden ice
elder bay
leaden ice
#

the package is whatever package the classes are in

elder bay
prime sinew
stone dawn
#

Hello, Iโ€™m trying to create a custom obstacle avoidance script using an ik chain attached to a skeleton, I need to be able to find the position a bone will be updated to originally as if my script hasnโ€™t changed it any clue how to get it? Itโ€™s to blend it with my ik target so it follows the normal foot animation

leaden solstice
#

Hmm actually it seems like you have the velocity as result

devout timber
leaden solstice
#

Oh so it's kinda the opposite I see

leaden solstice
devout timber
leaden solstice
#

Yes so yaw

leaden solstice
#

If weaponForward has Y or not normalized first do this

weaponForward.y = 0;
weaponForward.Normalize();
woven kayak
# prime sinew Does it not work with an enum parameter?

I wasn't able to get the Unity event to have a drop down of enum parameters if that is what you mean. Not to say its not possible I just didn't find a way. But calling the needed function and setting the enum at runtime is working for my needs.

orchid surge
#

Thoughts on scriptable objects to store game state to replace a singleton? Downside looks like having to assign the reference in the inspector to every relevant object. If every enemy needs to know game state to decide to attack, this downside likely outweighs the potential benefit of eliminating a singleton. Does this sound accurate?

leaden ice
#

the nice thing about it is it lets you not worry about which scene the state management object lives in

#

and whether it will survive scene loads etc

#

it's just always there

leaden ice
orchid surge
#

That talk is actually what got me thinking about this. The systems described in there seem different because they don't seem to use individual scriptableobjects to influence as broad of a group of things as I use my game state. A comment on the video planted the seeds of doubt for this use case.

#

Definitely going to check out that package.

trim rivet
#

What do I do when Unity is pretending there is Input which is not ocurring

#

if(Input.GetKeyDown(KeyCode.Tab));
{
ToggleVisible();
Debug.Log("TAB!");
}

keeps getting spammed even though nobody is touching the key lmao

leaden ice
#

making the if statement useless

#

your IDE should be bugging you about this

trim rivet
#

oh lord

#

that explains a lot

trim rivet
vagrant blade
#

Of course, it's always Unity's fault with you. So insufferable lol.

vagrant blade
naive swallow
mossy skiff
#

Hey! Has someone here managed to rip an Escape from Tarkov scene and patch up the terrain? ๐Ÿค”

naive swallow
mossy skiff
#

Uhm, it is to make a small animation, I am sorry

scenic creek
#

I'm trying to make my rotation more gradual but having trouble figuring out how to do it. I think I need to use slerp, but I'm not sure what to use as t. I have a character that looks generally the same way as the camera, when the camera moves I want the character to rotate towards the same way, but not instantly. I was doing this:

rigidbody.MoveRotation(Quaternion.LookRotation(forward, up));

but I figure I need to do something more like this:

Quaternion targetRotation = Quaternion.LookRotation(forward, up);
Quaternion finalRotation = Quaternion.Slerp(transform.rotation, targetRotation, );
rigidbody.MoveRotation(finalRotation);

but what to use for t?

woeful leaf
#

I figured it out by the way, I was just googling for the wrong thing ;-;
Turns out just using .GetPreferredValues does exactly everything I need
So it's just one line box.size = text.rectTransform.sizeDelta = text.GetPreferredValues(); of code that fixes all of my issues
Tiny bit salty

primal garnet
#

Hi I have a quick question how can I create a 2d array for audio clips

lucid valley
#

Whats your use case, i've never seen someone need that before?

primal garnet
#

I tried that one but didn't appear on inspector. I am trying to make a footstep system.

lucid valley
#

yeah, unity doesnt serialise multidimensional arrays

lucid valley
#

i don't really get why you need it to be multidimensional

primal garnet
#

I dont know

scenic creek
#

How can I get the closest point to my player character? I've been using an physics.OverlapSphere to get a list of nearby colliders, then getting the closestPoint of each collider, then finding the one of those that is nearest to my character position. However, you can only get closest point from a collider if it is convex, and I would like this to work with meshes that are not convex. I was thinking a spherical point cloud of raycasts, but is there a better way?

potent sleet
woeful leaf
#

Yap ;-;

orchid bane
#

I have this newly created TEST script which first wasn't included as part of the project, now I included it, so what's wrong?

woeful leaf
orchid bane
#

๐Ÿ‘น

#

No class IEnumerator

#

Test and UnityTest are not attributes

#

cannot resolve symbol void

#

that's it

#

nvm

naive swallow
#

Anyone know of a good FuzzySearch library that works with Unity? Trying to find one is just bringing me the UnityEditor FuzzySearch libraries and Odin, but I want one that can work at runtime

#

Preferably one I can add through the package manager, even if I have to add a github repo to the package sources

quaint rock
#

or just using Levenshtein distance as a term in general to find a implementation

orchid bane
#

What mocking frameworks are popular with unity now?

quaint rock
#

i just use the built in testing stuff, and just use interfaces alot to make tossing in mock implmentations easier

orchid bane
#

How about mocking transforms and stuff?

quaint rock
#

have not had much to any need to mock transforms

leaden ice
#

I have never used a mocking framework with Unity but then again I've only done unit testing in a couple projects

quaint rock
#

most of my test coverage is not in things where i will need to mock a transform

orchid bane
#

What should I test and what I shouldn't test?

quaint rock
#

that is up to you

#

thing is lots of thigns are games are hard to test

#

since you really can only easily unit test deterministic stuff

uncut lintel
#

"Vector3.forward can not be accessed with an instance reference; qualify it with a type name instead."
I understand that the error is trying to tell me exactly what do but I don't understand it entirely in this context.

        float inputY = Input.GetAxis("Vertical");
        if (inputX < 0.3f && inputX > -0.3f) inputX = 0;
        //else rb.AddForce(camTargetObject.transform.right*inputX*ballForce);
        if (inputY < 0.3f && inputY > -0.3f) inputY = 0;
        //else rb.AddForce(camTargetObject.transform.forward*inputY*ballForce);//TODO: diangonal input makes player move faster!

        Vector3 moveDir = new Vector3(inputX,0,inputY);
        moveDir = moveDir.normalized * Time.deltaTime;
        moveDir.forward = camTargetObject.transform.forward;
        rb.AddForce(moveDir * ballForce);```
leaden ice
#

what is that supposed to be

#

did you just write this in reverse?
moveDir.forward = camTargetObject.transform.forward;

#

Did you mean to do:
camTargetObject.transform.forward = moveDir;?

uncut lintel
#

I need to make MoveDir face the same direction as camTargetObject.transform.forward, essentially

leaden ice
quaint rock
#

also would use LookRotation to make a quaterion for that

leaden ice
# uncut lintel no

what you actually want I believe is this:

moveDir *= camTargetObject.transform.rotation;```
#

you don't want it in the same dirtection

#

you want to rotate the input according to the camera perspective

uncut lintel
#

Operator '*=' cannot be applied to operands of type 'Vector3' and 'Vector3'

leaden ice
#

it's a quaternion

#

you typed what I wrote wrong

uncut lintel
#

same error regardless

leaden ice
#

moveDir = camTargetObject.transform.rotation * moveDir;

leaden ice
#

it would say something about quaternion

leaden ice
uncut lintel
#
float inputX = Input.GetAxis("Horizontal");
        float inputY = Input.GetAxis("Vertical");
        if (inputX < 0.3f && inputX > -0.3f) inputX = 0;
        //else rb.AddForce(camTargetObject.transform.right*inputX*ballForce);
        if (inputY < 0.3f && inputY > -0.3f) inputY = 0;
        //else rb.AddForce(camTargetObject.transform.forward*inputY*ballForce);//TODO: diangonal input makes player move faster!

        Vector3 moveDir = new Vector3(inputX,0,inputY);
        moveDir = moveDir.normalized * Time.deltaTime;
        moveDir *= camTargetObject.transform.rotation;
        rb.AddForce(moveDir * ballForce);

"Operator '*=' cannot be applied to operands of type 'Vector3' and 'Quaternion"

leaden ice
#

Quaternion * Vec3 works

#

not the other way around

uncut lintel
#

If you sent a line that doesn't throw an error I'm not seeing it

leaden ice
uncut lintel
#

Ah I left the *=, my bad

#

That did it, thanks for the timely response.

#

I had to massively increase my force value but I assume that's because I wasn't normalizing or multiplying by time before this. Thanks again.

leaden ice
#

and you should also only be adding force in FixedUpdate

#

not Update

uncut lintel
#

This is fixedUpdate. Time multiplier is not necessary for adding force in FixedUpdate?

warm wren
uncut lintel
#

Alright, makes sense. Thanks.

leaden ice
#

AddForce already assumes it's happening once per FixedUpdate

#

multiplying it in again does nothing except divide all your forces by 1 / Time.fixedDeltaTime

wary ferry
#

Ideal coding right here

parameterController.SetInteger(this.typeof(STATES).Name, System.Convert.ToInt32(this.getState()));
#

I have probably made a mistake using enums instead of some wrapper class but hey, it technically works

#

It feels morally wrong to have an essential part of my code be controlled by getting the name of an enum type

leaden ice
#

don't you just want:

parameterController.SetInteger(nameof(STATES), (int)this.getState());```
#

or whatever the enum type is actually called

#

rather than STATES

wary ferry
#

nah STATES is a generic enum so taking nameof just returns "STATES"

#

i need it to be the name of the passed enum type

wary ferry
leaden ice
#

You sure nameof(STATES) gives "STATES"?

#

have you tested that?

wary ferry
#

let me check again, it definitly wasnt working with just that but i could have been wrong

leaden ice
#

you can definitely simplify the int casting part at least

wary ferry
#

for some reason it was throwing an error when trying to cast directly like that, i will check again tho

wary ferry
#
name = nameof(STATES); //name is a public property of the statemachine class
#
Debug.Log(jumpMachine.name); //jumpMachine is a statemachine
wary ferry
late lion
#

This is because although the generic type is constrained to an enum, the backing type isn't guaranteed to be Int32.

wary ferry
quartz folio
#

Enums can be backed by any integral type, so it doesn't know you're dealing with an int, or even types that have less precision. There's nothing stopping that from being an enum whose backing type is a long

#

Though I'm not sure the generics can infer any of that, but at least know that there's a lot of values it could actually be that isn't just int

wary ferry
#

oooh so its not sure if its a short or a long or any of the other integer types?

leaden ice
#

And yet this works ๐Ÿค”

wary ferry
#

longs can be explicitly cast to int i think in c#

quartz folio
#

well that is honestly a surprise to me, but I suppose it's explicit

leaden ice
#

well yeah I know they can be cast

#

Kinda feels like the generic way should work too

#

maybe with a warning about potentially losing precision?

#

But yeah I guess it's less explicit

#

/shrug Just an interesting quirk of the compiler and/or language spec I guess

quartz folio
#

does the (int)(object)state way of doing it box, or is it a way to just bypass the pain

wary ferry
#

is there a way to restrict the type of the generic enum to be backed only by ints?

wary ferry
quartz folio
#

rudely it boxes

wary ferry
#

very sad

leaden ice
#

boxes yea

wary ferry
leaden ice
#

Rider IL Viewer

quartz folio
leaden ice
#

or that

wary ferry
#

oooh neat

quartz folio
#

if you really cared about boxing, the collections package has an UnsafeUtility.As method that'd probably bypass that

wary ferry
#

wait can u just cast it to system.valuetype instead of system.object to avoid boxing?

wary ferry
leaden ice
#

well it makes an object on the heap which needs to be garbage collected later

wary ferry
#

unfortunate this is being called ~every frame so i probs shouldn't be doing that then

wary ferry
#

huh I misunderstand what value type is then a bit

wary ferry
quartz folio
#

Yes

random gulch
#

I am trying to rotate the parent with the children moving to face the direction of the parent but what happens is that the parents rotates and the children each individually rotate but don't move to face what the parent is facing

shell orbit
#

i think i know how to grab microphone input but what about transcribing it?

wary ferry
#

if that rotation code is on the parent

random gulch
#

no difference

wary ferry
random gulch
#

it is only on the parent

tawny jewel
#

hey, so i have multiple instances of the same gameobject (pipes from floppy bird) and i want to spawn another gameobject right between two pipes. how can i code it so vector2 measures distsnce only between two pipes spawned next to each other

random gulch
#

interestingly if I rotate it using the inspector, it seem to work fine

wary ferry
#

huh wierd I would expect what you have there to at least change their position a little

random gulch
shell orbit
#

if i grab input from my microphone, how would I transcribe ir?

proper oyster
#

in general search for "Speach to text" + Unity and you should find some interesting stuff

fallen rampart
#

hey bois quick question

#

what is the max value for TMP_Text.alpha (to set fully visible)

#

looked through the documentation and couldnt find

quaint rock
#

1f

fallen rampart
#

thanks ๐Ÿ™

coral hornet
#

whats the best way to go about making colliders for a map segment

#

i need to load in rooms that will be put on the end of eachother in a procedural fashion, but a mesh collider might be unoptimal for the game, and a bunch of cube colliders might be unorganized and messy

proper oyster
coral hornet
#

hm..

coral hornet
#

because i plan to have one mesh be the actual appearance of the map segment, and another mesh that is heavily dumbed down purely for use with a mesh collider

#

this is so that i dont have to disable collision for 15 cube colliders just to turn off collision for one map segment

opal bluff
#

question i have some code here and i was wonder how do you pause a countdown ```[SerializeField] Image image;
[SerializeField] float speed;

public float currentValue;


void Update()
{
    if (currentValue<100)
    {
        currentValue += speed * Time.deltaTime;
    }
    else if(currentValue > 100)
    {
        currentValue = 0;
    }
    image.fillAmount = currentValue / 100;


    if(currentValue > 20 && currentValue < 40 && Input.GetKeyDown("space"))
    {
       //pause the count
       
    }
    else if(currentValue > 70 && currentValue <90 && Input.GetKeyDown("space"))
    {
        //pause he count
       
    }

}```
glossy barn
#

How would one write code that clamps the rotation of an object to the nearest arc (like in my case I need it to clamp to 45 if its 45.7 or 44.2 or to 90 if it's 71.x or 100.x)

leaden ice
opal bluff
#

nvm i figured it out

vital thorn
#

Hi all, Unity beginner here. I'm trying to use the perception module to generate a synthetic dataset for ML training. I have a cucumber prefab and I want to procedurally generate random peeled areas on this cucumber which I will later try to segment. Is my best approach writing a shader that takes in a randomly generated mask representing the peeled areas for which the default skin color of the cucumber would be changed to a flesh color? Or is there some other method I should use? I'm totally lost here

#

Also, I'm new to this server so please point me to the appropriate place to ask my question if this is it!

leaden ice
hexed pecan
#

I recently used that for peeling paint on walls, so it should work for peeling cucumbers too ๐Ÿ˜

vital thorn
# leaden ice Not sure what `segment` means exactly in this context, but yes a shader that tak...

Thanks for the reply! Segmentation is a computer vision task, basically training a model to segment out a region in an image.

The other thing I need to do is create a new object for the peeled regions of the cucumber that has a transparent material (you might be asking why... it's required for the perception module I'm using). My best guess right now is to duplicate the cucumber object and remove triangles from its mesh that correspond to unpeeled regions. I expect this will be a pretty slow process. Do you think this will even work? Do you suggest I try something else? Will I have to create a new object for each continuous peeled region or can I create an object that has a mesh that is made of unconnected parts (representing all the peeled areas of the cucumber)

hexed pecan
#

Does the peeled part need to have a separate collider?

#

@vital thorn The unconnceted parts can be a single mesh/object, no need for separate objects

vital thorn
# hexed pecan Does the peeled part need to have a separate collider?

Sorry I'm so new I'm not sure I can really answer this question. My goal here is to create a synthetic image dataset so I just need the cucumber to "look" peeled and have transparent objects that cover the peeled areas. The transparent objects are necessary so that I can label those regions as peeled. Nothing about this needs to behave realistically or collide with objects

hexed pecan
#

Sounds like you could even do it with one mesh that has 2 submeshes

#

Each submesh can have its own material

#

They share the vertices, but have different triangle arrays

#

An alternative is to use vertex colors for the peeled areas, and change the texture in a shader depending on the vertex color. But that requires some shader knowledge

ionic socket
#

I don't suppose there's an easy way to make overflow from a Layout Group flow into a new containing gameobject, is there? A boy can dream, alas ๐Ÿ™‚

past hare
#

I'm using unity's spline and I'm wondering how to move a game object along a spline

leaden ice
#

Would be the simplest way

#

Otherwise you grab a curve and call Evaluate on it to do custom interpolation

lament ocean
#
        temp = velocity[index];
        
        temp += Allign(transform, index);
        temp += Cohesion(transform, index);
        temp += Seperation(transform, index);
        //rb.velocity += PathFollowing();
        temp -= Vector2.one * deltaTime;

        //temp = Vector2.ClampMagnitude(temp, 5 * maxSpeed[index]);
        SteerTowards(temp, transform, index);
        
        returnVec[index] = temp;
    }```

I need some help with my code as I cant seem to figure out why the variable Vector2 temp is assigned as NaN, NaN or stuck as 0,0
**Important** this uses the unity Jobs system
swift falcon
#

How do I find every child and child's children, the whole hierarchy of one GameObject, and unparent everything under it?

somber nacelle
swift falcon
#

I'm just having a bit of a hard time figuring out the actual things I need to do.

#

I have the logic, but not enough knowledge of Unity's library.

somber nacelle
#

well you can foreach over a transform to get its children, do that recursively for each child and the loop will traverse its way down the hierarchy

swift falcon
#

๐Ÿค”

somber nacelle
#

for example, this is an extension method i wrote to change the layer of all child objects for a GameObject:

public static void SetLayerRecursively(this GameObject obj, int layer)
{
  obj.layer = layer;
  foreach (Transform child in obj.transform) 
  {
    child.gameObject.SetLayerRecursively(layer);
  }
}
swift falcon
#

I see.

somber nacelle
#

so you could do something like that, iterate over the transform in a method and recursively call that method on all the children while assigning a null parent to each one along the way

swift falcon
#

I was calling this sort of stuff within another function, but it makes a lot more sense to just wrap it in its own function and call the one function in the original function.

#

Makes a lot of sense now...

#

Thanks. ๐Ÿ˜„

#

I'll try it out!

devout ermine
#

Does anyone know why I always get these errors whenever I install URP on my project or use the 3D URP template? I'm using Unity 2021.3.14f1 LTS

quartz folio
#

Try updating/downgrading shader graph via the package manager

vapid parcel
#

How do I set up a website that can use UnityWebRequestโ€™s POST

devout ermine
swift falcon
#

Thank you for your help. ๐Ÿ˜„

#

Alright, new question...

#

... is there a way I can apply random rotational velocity to an object?

swift falcon
#

Also, I found out there is such a thing as an angularVelocity variable. ๐Ÿ˜›

#

Thanks tho.

prime sinew
#

there are differences between using the Add methods vs setting the velocity directly

#

googling "setting velocity directly vs addforce unity" will give you some results

#

linear velocity to AddForce is the same as angular velocity to AddTorque

swift falcon
#

I see... good to know. ๐Ÿ™‚

#

Thanks!

past hare
#

documentation is bad

#

im just gonna make my own tools

woeful leaf
#

GL with that

earnest field
woeful leaf
#

What is the expected outcome

earnest field
#

fixed it nevermind

timid venture
#

Plane gets reset to XYZ 0

main shuttle
obsidian dust
#

ok thx

lost dragon
#

i got an empty game object with 4 objects placed around it at X -90, 90, 180, and -180. my problem is that the first click works but any click after shows the wrong item does anyone know what im doing wrong here

using UnityEngine;

public class RotateY : MonoBehaviour
{
    // Start is called before the first frame update

    void Start()
    {
    }
        // Update is called once per frame
        void Update()
    {
        if (Input.GetMouseButtonDown (0)) {
            Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition);
            RaycastHit hit;
            if (Physics.Raycast(ray, out hit, 100))
            {
                Debug.Log(hit.transform.gameObject.name);
                if (hit.collider.gameObject.CompareTag("Item"))
                {
                    transform.LookAt(hit.collider.gameObject.transform);
                }
            }
        }
    }
}
main shuttle
lost dragon
#

yeah i had a feeling this was the issue.
do you know what a better method of rotating the parent GameObject based on which object i click? or would i have to move the camera itself?

main shuttle
lost dragon
tawny rose
#

im doing a project where i have to replicate wordle but add drag and drop to the tiles
and im stuck because im not able to achieve replace (where u take a block and place it on top of a slot thiat is occupied and the tile in the slot goes to its original position and the new tile snaps into place) im using drop handler for drag and drop
can someone help me figiure out how to do it
i can send project file if u want

#

pls help

prime sinew
#

Dont think of it as swapping the physical blocks, think of it as applying a new data onto a block, and refreshing the visuals of the block

lean frigate
#

hey, im having an issue when making a load game function, where my data loads in before the scene changes any clues how I could try and fix it?

vague slate
#

Is there anyting built in in to obtain all substrings between specific braces.
For example Example {0} {test} {lul}
From this I need to obtain string[] {"0", "test", "lul"} as result

trim schooner
#

they're already variables ๐Ÿค”

vague slate
#

and I need to obtain those substrings

late lion
vague slate
#

I only have string

#

but

#

I think I already figured a solution

#

it's a bit nasty

#

but no allocations at least

late lion
#

So I misunderstood, it's not an interpolated string, it just happens to look like one?

vague slate
#

I am later doing interpolation myself, but I need to obtain keys properly

quartz folio
vague slate
#

Yeah, this works

        public static string[] GetFormatKeys(string str)
        {
            var count = 0;
            foreach (var chr in str)
            {
                if (chr is '{') count++;
            }

            if (count > 0)
            {
                var resultInd = 0;
                var result = new string[count];
                for (var i = 0; i < str.Length; i++)
                {
                    var chr = str[i];
                    if (chr is '{')
                    {
                        i++;
                        var substr = str[i..];
                        var ind = substr.IndexOf('}');

                        result[resultInd] = substr[..ind];
                        resultInd++;
                        i += ind;
                    }
                }

                return result;
            }

            return null;
        }
#

but a bit nasty looking ๐Ÿ˜…

woeful leaf
spring basin
#

alright

#

ty

#

ill delete this post

prime sinew
terse coral
#

I was trying to build my project but I got this error:1 exception was raised by workers. I researched a lot but couldn't find a solution to it. Here is the full error:

prime sinew
#

and the first result has [SOLVED] in its title. check it out

terse coral
#

okay...

placid hearth
#

Is it weird that Iโ€™ll be playing a game and Iโ€™ll see an npc walking or something and Iโ€™ll get excited cuz I know exactly who write a line of code that

terse coral
prime sinew
thick socket
#
public class PlayerListInv
{
    public List<Items> ArmorList { get; private set; }
    public List<Items> WeaponList { get; private set; }
    public List<Items> JewelryList { get; private set; }
    //Helmet, Armor, Weapon, Jewelry
    public Dictionary<ItemType, Items> EquippedList { get; private set; }```
If I send this to a JSON (Items are able to be serialized) everything will be saved except the dictionary right?
wanna make sure that having a dictionary doesn't just cause nothing to save lol
prime sinew
thick socket
#

cause json doesn't save dictionaries ๐Ÿ˜ฆ

prime sinew
#

uh

#

pretty sure it does, but maybe it depends on the library you use

lucid valley
#

If you use the Unity json serialiser it doesnt

prime sinew
#

yeah, but json.net works great. also known as newtonsoft json i think

final arch
#

hey everyone, I have a very strange issue, vsync is making lag in the game so I deactivated vsync from every single place possible, however after 5-10 minutes of gameplay while profiling the game, i noticed vsync turning on by itself for a few seconds making an insane lag and then turning it self off and then game runs as normal, what is going on?

thick socket
thick socket
#

(you are right, I have no clue how to use newtonsoft json tho)

prime sinew
#

how to add newtonsoft json to your unity project

final arch
thick socket
#

guess that would be part of the issue lasttime

prime sinew
final arch
thick socket
#

I can find how to add to project

#

but can't find anything about how to actually use it

#

"how to use newtonsoft.json in unity" has 0 useful results on googles first page

prime sinew
#

really

#

Installing the package

#

just because you dont get it, doesnt mean they're not useful

thick socket
prime sinew
#

and look what this link has

#

documentation

#

try that

thick socket
#

thanks

#

wow they made that way harder to find then it should have been

prime sinew
#

yeah it was a third party thing that was.. absorbed in

#

I think newer versions have it in the unity package manager, not sure

#

but it's a much better json serializer

thick socket
#

not sure why Unity has one if I have to grab it from package manager to use

prime sinew
autumn cipher
#
public struct Timer
    {
        public float Duration, TimeStamp, Speed;
        public Action onTick, onFinish;
        public bool DeltaOrFixed;
        public Timer(float duration, float timeStamp, float speed = 1f, bool deltaOrFixed = true)
        {
            Duration = duration;
            TimeStamp = timeStamp;
            onFinish = null;
            onTick = null;
            Speed = speed;
            DeltaOrFixed = deltaOrFixed;
        }
        public void Tick()
        {
            if (TimeStamp < Duration)
            {
                TimeStamp = DeltaOrFixed ? TimeStamp + Time.deltaTime : TimeStamp + Time.fixedDeltaTime;
                onTick?.Invoke();
            }
            else
            {
                TimeStamp = Duration;
                onFinish?.Invoke();
            }
        }
    }```
I've been thinking about making a timer because I'm too tired of always writing the same variables, I worry about the action invoke's performance though
#

Invoke() will probably hit it hard

thick socket
#

have you looked into coroutines?

#

not sure they would apply here but those are great for "timers"

autumn cipher
thick socket
karmic stratus
#

how do I add an API key to this?

public static class ApiHelper
{
    public static Root GetDefinition()
    {
        HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://wordsapiv1.p.mashape.com/words/hello/definitions");
        HttpWebResponse response = (HttpWebResponse)request.GetResponse();
        StreamReader reader = new StreamReader(response.GetResponseStream());
        string json = reader.ReadToEnd();
        return JsonConvert.DeserializeObject<Root>(json);
    }
}```
thick socket
#

I had no idea about that so gunna go change my coroutines now too ๐Ÿ˜„

tawny jewel
#

hey, quick question.

 {
     float lowestPoint = transform.position.y - birdscript.heightOffset;
     float highestPoint = transform.position.y + birdscript.heightOffset;
     int QueueLength = 2;
     Queue<Pipe> pipeQueue = new();

     Pipe newPipe = Instantiate(pipe, new Vector3(transform.position.x, Random.Range(lowestPoint, highestPoint), 0), transform.rotation);
     pipeQueue.Enqueue(newPipe);
     while (pipeQueue.Count > QueueLength) pipeQueue.Dequeue();```

it puts a namespace not found error on the Pipe, how can i modify this code so i dont have to create new classes and whatnot?
thick socket
#

does pipe exist rn?

tawny jewel
#

technically the Pipe doesnt, and im trying to bypass that somehow to make this code as simple as possible if you know what i mean by that

thick socket
#

could just declare the other class at the bottom of the script

#

ex of my offers SO

#
using NaughtyAttributes;
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;

[CreateAssetMenu(menuName = "Offers")]
public class LimitedTimeOffer : ScriptableObject
{
    public OfferIconTrees iconTrees;
    public List<OfferData> limitedOffers;
    public List<OfferData> dailyOffers;
    public List<OfferData> weeklyOffers;
    public List<OfferData> monthlyOffers;
    public List<OfferData> hollidayOffers;
    public List<SpecialOfferData> specialOffers;
}

[Serializable]
public class OfferData
{
    public string offerText;
    public int numAvailable;
    public float price;
    //public bool showInt;

    //[ShowIf("showInt")]
    //[AllowNesting]
    public float initialPrice;

    public List<OfferIcon> offerIcons;
}

//limted offer extends offerdata

[Serializable]
public class SpecialOfferData
{
    public string offerName;
    public Sprite backgroundImage;
    public SpecialOfferTypes specialOfferType;
}
#

3 small classes in one file

tawny jewel
#

its my first time making queues so yea lmao

thick socket
#
float test = fireCooldown - 0.15f;

how would I make it so test auto-changes whenever fireCooldown changes?

prime sinew
#

look into C# properties

#

really useful stuff

#

it's like a variable, but with customised behaviour when you get or set their values

thick socket
#

so there isn't some sort of super easy way to do it like this?

#

float test = ref fireCooldown - 0.15f;

#

was hoping I was just doing it wrong lol

prime sinew
#

properties are easy

vocal merlin
thick socket
#

awesome thanks @vocal merlin

#

still trying to fully wrap my mind around that lol

prime sinew
#

you know that's a property, right?

thick socket
#

but that kind of seems simple to understand thanks ๐Ÿ™‚

prime sinew
#

haha okay

tawny jewel
prime sinew
#

please learn some basics, Stephen. you're wasting everyone's time. including yours

#

there are plenty of resources on Unity Learn. there's the roll a ball tutorial, and beginner scripting course

vocal merlin
#

What most use are variables

public Sprite sprite;

A property allows versatility

This can be got and set by anyone calling the script
public Sprite sprite { get; set; }

This one can be got by any other script but only set privately
public Sprite sprite { get; private set; }

tawny jewel
#

and dont get me wrong

tawny jewel
#

i want to learn

prime sinew
vocal merlin
thick socket
#

ah cool thanks

tawny jewel
# prime sinew doesnt seem like it

what i dont want to do is go with the whole "your doing something in practice for the first time so clearly you need to read c# tutorial for the 20th time"

thick socket
#

yeah I have used getters/setters like that

thick socket
tawny jewel
#

listen i understand and i trurely respect that you want to help but realistically what your doing is making me and likely other ppl reluctant, or even scared to ask about anything

vocal merlin
tawny jewel
#

so just please dont do that

#

that kinda beats the point of this server in the first place

prime sinew
#

Again, it's extremely difficult to help someone write an essay, when they refuse to learn the alphabet

#

you're going at this in a needlessly difficult fashion for everyone involved

thick socket
#
List<Items> tmpList = new();
            switch (item.iType) 
            {
                case ItemType.Weapon:
                    tmpList = WeaponList;
                    break;
                case ItemType.Armor:
                    tmpList = ArmorList;
                    break;
                case ItemType.Jewelry:
                    tmpList = JewelryList;
                    break;
            }

            tmpList.Add(EquippedList[type]);

will this be adding to the "correct list" each time? not 100% sure its passing the Weapon/Armor/Jewelry List as a reference

prime sinew
#

List is a reference type

thick socket
#

awesome thanks!

#

I was like 90% sure, but never actually done anything by reference like that before ๐Ÿ˜‰

prime sinew
#

it's only going to be a separate List if you did tmpList = new List<Items>(WeaponList);

#

something like that. just typed that roughly

thick socket
#

sweet thanks ๐Ÿ™‚

tawny jewel
# prime sinew what I have a problem with, is you're not open to accepting that you're going wa...

im not ignoring the help, im just trying not to get demotivated. i really am asking for help here only if i really need it. im not making a super game im gonna do god knows what with, im trying to make my floppy bird with as much stuff as i can, so i can learn and easly remember (end eventually look back if needed) as much as i can.so if someone would just tell me how to do that, i would know next time. again, i do apprecieate the help, but what i do not apprecieate is sending me to c# tutorial every time i ask for something, even if its not, as in this case, so basic

prime sinew
#

it is.. really basic

#

but Pipe does not exist

#

so declare a type called Pipe. seems like it's a class

tawny jewel
#

i do know what a class is

#

ive done that and it started erroring out a whole instantiate line

prime sinew
#

then how about you show that error?

tawny jewel
#

and also ive watched all those unity tutorials + ive spent couple hours doing the whole w3schools c# course

prime sinew
#

i'm too frustrated now, i'll leave you alone

tawny jewel
thick socket
tawny jewel
#

yea i actually simplified it a little tho it still doesnt work, now the code is just

        pipespawnscript secondmostrecent;
        float lowestPoint = transform.position.y - birdscript.heightOffset;
        float highestPoint = transform.position.y + birdscript.heightOffset;

        pipespawnscript newPipe Instantiate(pipe, new Vector3(transform.position.x, Random.Range(lowestPoint, highestPoint), 0), transform.rotation);
        secondmostrecent = mostrecent;
        mostrecent = newPipe;  ```
#

basically what im trying to do is spawn the powerup right between two pipes

tawny jewel
thick socket
#

you basically got to define a pipe somewhere or stop using the keyword ๐Ÿ˜„

tawny jewel
#

so i thought, that maybe its just not taking the pipes its supposed to

#

so basically this whole thing is just my attempt to set pipe a, pipe b lmao

mental rover
#

pipespawnscript newPipe Instantiate(pipe, new Vector3(transform.position.x, Random.Range(lowestPoint, highestPoint), 0), transform.rotation);
how do you have this line in your code without your IDE being lit up with red squiggles?

scenic grove
#

Hello, is this an appropriate channel to ask about Oculus integration- specifically the Oculus Lypsync SDK? I'm hoping to find someone to answer a few questions.

tawny jewel
#

i also know its missing the =

#

made a typo

#

the whole thing works fine without the whole recent mostrecent thing

hasty canopy
#

@tawny jewel configure IDE first :/

tawny jewel
#

except for the mentioned powerup spawning whereever it feels like

tawny jewel
mental rover
#

you might be frustrated about being told to start with tutorials or basics, but you really are running into as many issues as you are because you haven't - you can help yourself considerably by first configuring your IDE and reading the warnings/errors you receive in your code. If that line is not showing red squiggles, it's not configured, and you're making things so much harder for yourself than they need to be

tawny jewel
#

and i do have multiple errors with it

hasty canopy
#

Do show the error message

mental rover
#

so start with the errors, things simple to fix yourself before showing it to other people - you already mentioned you know it's a typo, so why would you share it with other people and ask for help when it's in that state?

tawny jewel
#

i realised it is after i shared it, thats how it looks now

#

with the errors shown

hasty canopy
mental rover
#

alright - this looks fine as far as configuration goes, do you understand the errors?

hasty canopy
#

You can't assign unassigned variables to something else

tawny jewel
#

do you suppose it will even fix my code?
i just need this to work properly
vector3 center = vector3.lerp(pipe, pipe, 0.5f

hasty canopy
tawny jewel
#

i was thinking about calculationg the position to spawn the powerup at with vector3 but then i got suggested this

keen moth
#

hi how can i change the color of an prefab image

tawny jewel
swift falcon
tawny jewel
#

thats how it was at start, then i feel like i got lost trying to make that work

keen moth
# swift falcon Gameobject.color = new Vector4

ok i made a system that whenever the game starts the prefab gets cloned to the amount of times i said it to i want it when ever i touch an object it changes the color of these cloned images

mental rover
#

build up what you're trying to do piece by piece- another important question:
How do you get the position of an object?

swift falcon
keen moth
#

can you explain more pleasae?

swift falcon
#

OnCollision or whatever you are using

tawny jewel
keen moth
tawny jewel
#

i will look through tutorials again though

swift falcon
#

if you change the color of a single clone, the other clones dont care

keen moth
#

i want to change the color of there prefab

#

how do i do that

#

when ever the player touchs something

swift falcon
#

go to asset then change the color there

#

??

keen moth
#

dm me

mental rover
# tawny jewel welp i am trying best i can to analise every line of code i dont specifically ty...

if you're reading other peoples code and "understanding" it, but you aren't sure how to answer the question of "How do I position an object?", you're not really understanding it

learning is not the process of just copying and nodding your head in agreement to a tutorial - try watching a tutorial all the way through, then closing the tutorial completely and writing the code again just from your memory and understanding of the logic involved

#

if you can't do that and get stuck without making any significant progress, you may want to start on simpler tutorials until you can

#

it sounds to me like you're missing the absolute fundamentals of both C# and Unity here, and copying tutorials without understanding is going to be a struggle to get anywhere meaningful

#

it's not the help you want, but it is the advice you need

hasty canopy
#

@tawny jewel I'll tell the fix of what I do know but yeah you need to look at tutorials or break your problem in multiple steps

Like "how to instantiate an object" then learn "how to use instantiated object" etc

As for mostRecent, you need to give it some value to use it

And check spelling of newPipe, or need to create a variable named newPipe (and assign value) to solve that error

tawny jewel
#

alright, ill just try to go though tutorials again, learn something more. thanks for help yaal

thick socket
#
public void UnEquip(Items item)
    {
        List<Items> tmpList = FindList(item);

        foreach (var items in EquippedList)
        {
            if(items.Value == item)
            {
                EquippedList[items.Key] == null;
            }
        }
#

what am I doing wrong here?

#

if the value of the dict = item

#

I want to set that dict value back to null

mental rover
thick socket
#

๐Ÿ˜ญ

#

thanks

#

no clue how I kept overlooking that and quick fixes didn't catch it lol

woeful leaf
#

Your IDE should shout at you for doing something like that

thick socket
narrow blaze
thick socket
#

but the quick fix solutions weren't actually solutions

woeful leaf
#

I mean this error should say enough tbf

thick socket
#

doesnt tell me enough since I barely understand what it means ๐Ÿ˜ญ

leaden ice
#

if your line of code is not any of those, it's not legal.

thick socket
leaden ice
#

x == y; is just a naked expression (returning bool). It doesn't fit into any of those categories, so it's not legal.

#

bool b = x == y; < this is now legal because it's an assignment

woeful leaf
leaden ice
#

maybe worth a new page

woeful leaf
#

Probably yeah

thick socket
woeful leaf
#

It's from the moderator Vertx (on this server)

thick socket
#

ah cool thanks!

#

if I have a SO called ItemsList from a script called ItemsList is that fine?

#

I know a lot of the time you shouldn't duplicate names so wasn't sure

woeful leaf
#

If you mean just the asset SO in the files having the same name as the code behind it, yeah that's fine

thick socket
#

yeah like this

woeful leaf
#

Yeah that's fine

#

I like to have a folder for SO's separate though but that's preference

woeful leaf
# thick socket

What you can do to clarify that it is an SO is just do SOItemsList

#

But it's not needed

thick socket
#
public class ItemsList : ScriptableObject
{
    [Header("---Armor---")]
    public List<ItemReqs> CommonArmor;
    public List<ItemReqs> RareArmor;
    public List<ItemReqs> EpicArmor;
    public List<ItemReqs> LegendaryArmor;
    public List<ItemReqs> MythicArmor;
}```
#
public ItemsList myitems;
    public void ExampleInvAdd()
    {
        foreach (var item in myitems)
        {

        }
    }```
#

little confused how this doesn't work

#

do I need to make the SO an instance or something?

#

figured I could do a foreach for each List inside my SO

quaint rock
#

scriptable objects live as a asset

#

then in your 2nd script you click and drag in the reference

thick socket
#

sorry forgot to show this...already have this line also [CreateAssetMenu(menuName = "ItemList")]

quaint rock
#

so should be able to create said assets in the project view

#

then after that you can click and drag them into public or serialized fields like prefabs

#

also you are trying to loop the asset

#

the asset is not a list, it contains lists

#

foreach (var item in myitems.CommonArmor)

thick socket
#

gotcha thanks

#

so is there a way to loop through all lists?

#

or do I need a foreach for each list?

quaint rock
#

no, if you wanted to do that would have a list of lists

thick socket
#

shoot

#

ok thanks

quaint rock
#

if you want to loop all of them

#

and each list contains the same type, why not just have 1 list

#

then in ItemReqs have a enum value or something that defines if its Common or rare or what ever

thick socket
#
 [Header("---Armor---")]
    public List<ItemReqs> CommonArmor;
    public List<ItemReqs> RareArmor;
    public List<ItemReqs> EpicArmor;
    public List<ItemReqs> LegendaryArmor;
    public List<ItemReqs> MythicArmor;
    [Header("---Weapons---")]
    public List<ItemReqs> CommonWeapon;
    public List<ItemReqs> RareWeapon;
    public List<ItemReqs> EpicWeapon;
    public List<ItemReqs> LegendaryWeapon;
    public List<ItemReqs> MythicWeapon;
    [Header("---Accessories---")]
    public List<ItemReqs> CommonAccessory;
    public List<ItemReqs> RareAccessory;
    public List<ItemReqs> EpicAccessory;
    public List<ItemReqs> LegendaryAccessory;
    public List<ItemReqs> MythicAccessory;
quaint rock
#

you could make a enumerable that loops all of them for you

#

you would just need to keep it up to date as you add new lists

crimson atlas
#

Is there any way to add to the duration of a coroutine?
out here runnin on fuuummemessss but is there any way to add a coroutine to an array, and switchup the waitforseconds in the coroutine?

public IEnumerator ApplyPotionEffect(PotionEffect potionEffect, float multiplier, float duration){
        switch (potionEffect){
            case PotionEffect.Armour: {armourMultiplier = multiplier; break;}
            case PotionEffect.Speed: {speedMultiplier = multiplier; break;}
            case PotionEffect.AD: {attackDamageMultiplier = multiplier; break;}
        }
        yield return new WaitForSeconds(duration);
        switch (potionEffect){
            case PotionEffect.Armour: {armourMultiplier = baseArmourMultiplier; break;}
            case PotionEffect.Speed: {speedMultiplier = baseSpeedMultiplier; break;}
            case PotionEffect.AD: {attackDamageMultiplier = baseAttackDamageMultiplier; break;}
        }
    }

    public void ExtendPotionEffect(PotionEffect potionEffect, float duration){
        
    }

    public bool IsEffectActive(PotionEffect potionEffect){
        switch (potionEffect){
            case PotionEffect.Armour: {return armourMultiplier == baseArmourMultiplier;}
            case PotionEffect.Speed: {return speedMultiplier == baseSpeedMultiplier;}
            case PotionEffect.AD: {return attackDamageMultiplier == baseAttackDamageMultiplier;}
        }
        return false;
    }```
leaden ice
#

like a member variable or some data in a collection

#

and change that source

thick socket
#
public List<List<ItemReqs>> Armor 
    {
    public List<ItemReqs> CommonArmor;
    public List<ItemReqs> RareArmor;
    public List<ItemReqs> EpicArmor;
    public List<ItemReqs> LegendaryArmor;
    public List<ItemReqs> MythicArmor;
    };
#

throwing lots of errors for this

quaint rock
thick socket
#

right

crimson atlas
thick socket
#

can't find how to declare public lists inside a list

leaden ice
#

you can only use public for class/struct members

#

this doesn't make sense

crimson atlas
#

side note, any way to get the time elapsed? or shall i just start a timer when the coroutine starts?

leaden ice
hasty canopy
quaint rock
thick socket
quaint rock
#

foreach (var item in myitems.IterateItems())

steep drift
#

Could also implement IEnumerable on the SO directly - then the original calling code would work.

thick socket
thick socket
leaden ice
thick socket
#

and not just return the 5 lists to then do foreach on?

quaint rock
quaint rock
leaden ice
thick socket
#
public IEnumerable<ItemReqs> IterateItems()
    {
        return CommonArmor.Concat(RareArmor).Concat(EpicArmor).Concat(LegendaryArmor).Concat(MythicArmor);
    }
#

like such...and this would just return every item for the foreach right?

quaint rock
#

would do each concat on its own line

#

way more readable

thick socket
#

fair enough ๐Ÿ™‚

quaint rock
#

but yeah that when you loop over it, would loop over everything you concated in

glad venture
#

When I try to build for Android or Addressables I get these errors: error CS0103: The name 'LoadingManager' does not exist in the current context, but it all works fine in playmode.
Usage examples:
LoadingManager.Instance.SetLoading(false);
LoadingManager.Instance.SetLoadingLog($"Ping: {(time - startTime) * 100:###}ms");
The complete "LoadingManager" script: https://pastebin.com/pN3NG107

What can it be?

steep drift
# thick socket how would that look?

What @quaint rock gave you, but with your type implementing IEnumerable<ItemReqs> and its function IEnumerable<ItemReqs>.GetEnumerator () => IterateItems ().GetEnumerator ();

quaint rock
#

also keep in mind with the Concat and the yield methods you are not getting a list back, the Enumerable it returns is mostly only good for using in a foreach loop or with linq

thick socket
#

sounds good thanks!

#

Im only using this for testing so getting back every armor and every weapon an item at a time works great ๐Ÿ™‚

quaint rock
#

its still doing more or less the same thing as manually running the loops for each list back to back. just hidden away in a function

thick socket
#

I made changes to my SO and my VS didn't pick up the changes