#archived-code-general

1 messages · Page 25 of 1

fringe valve
#

Again, new, sorry about that and next time just tell me where to go @left narwhal

unreal temple
#

Are you using SimpleMove or Move?

wanton obsidian
#

.Move

unreal temple
#

Are you applying gravity?

wanton obsidian
#

Yes

unreal temple
#

No idea then sorry haha

#

I thought maybe your character was ending up fractionally above the ground.

wanton obsidian
#

If it helps XD

unreal temple
#

You should probably avoid doing that

#

What is the diff between playerVelocity and charController.velocity?

wanton obsidian
#

I can read it better, I'm kinda dumb about that stuff

#

Its also nearly an exact copy of what unity has in its documentation ;-;

unreal temple
#

Oh, remove the grounded check there

#

You can apply gravity on the ground too

left narwhal
#

its for a jump

unreal temple
#

this bit

#

I still don't know what plaerVelocity is

#

but this superficially looks like bad logic to me

left narwhal
#

playerVelocity is an extra velocity for the jump i think

#

it is sort of

unreal temple
#

So its x is always 0?

left narwhal
#

ehh

#

actually its all right

#

it prevents it being called so often

#

it is to limit the velocity to 0

unreal temple
#

Well it's probably what's causing your issue

left narwhal
#

so they dont fall through the ground

#

its not

unreal temple
#

skylord's issue

left narwhal
#

yes

#

basically its saying

#

if the player is falling downwards

#

and theyre touching the ground

#

then set the velocity to 0

#

so they dont fall through the ground

#

personally @wanton obsidian

#

i would raycast

#

instead of using isgrounded as a check

wanton obsidian
#

Hhm

somber nacelle
#

CharacterController.isGrounded only updates when Move is called. When using the incorrect double call to Move that brackeys likes to teach (which is what you have) it will only detect ground when you do that second call to apply gravity, so your normal movement won't be moving the controller downward to collide with ground

unreal temple
#

Basically you want this every time:

var velocity = cam.transform.TransformDirection(MovementSpeed * new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"))
  + Physics.gravity * Time.deltaTime;

if (charController.isGrounded) {
  velocity.y = jumpStrength;
}

charController.Move(velocity * Time.deltaTime);
somber nacelle
#

combine the gravity with your input and call Move one time per Update and it will work correctly

unreal temple
#

ah, this is a brackey's thing?

#

Makes sense

#

The bane of unity discord

somber nacelle
#

the double call to move is, yeah

wanton obsidian
#

... I got it from the unity documentation...

left narwhal
#

useless

#

and inefficient

#

i would recommend

#

just doing it in one move.

unreal temple
somber nacelle
#

huh, it is in the docs. well that's no good

#

although the docs do grab the isGrounded property before the first call to Move so it does still use the value from that second call which is correct

wanton obsidian
#

;-;

#

I killed it

left narwhal
#

rip

dusky spear
#

i just tried to make a light2d variable and unity told me i was using outdated something or other and replaced it with this

#

is there no way to make this shorter?

cosmic rain
#

What did you do before and what exactly unity told you? Also, unity can't replace your code.

dusky spear
dusky spear
cosmic rain
dusky spear
#

oh i just had to add the using at the top

ionic socket
#

How can I avoid empty pass-through constructors in my subclasses?

unreal temple
dusky spear
#

cool thx

#

how would i do a triangle shaped cast

unreal temple
#

IIRC

dusky spear
#

like from this ball

#

and in the shape of that light

#

and get all objects inside that all the way down

unreal temple
dusky spear
#

or whichever way its facing

dusky spear
unreal temple
#

Create a polygon collider, update it to fit the triangle before you cast it

dusky spear
#

ok

dusky spear
#

oh so do i just use it like a trigger?

unreal temple
#

You can use GetPath and SetPath to modify the points

dusky spear
#

ah yeah that sounds good

unreal temple
#

but you can use it like a trigger if you want

#

Personally I prefer to just ask for a list of results

dusky spear
#

yeah overlap collider will work perfectly

mental rover
ionic socket
unreal temple
mental rover
#

not sure what the question is - do you just want to not have to write the constructor line in your subclasses?

unreal temple
#

they want an implicit constructor when the base class has an explicit one.

#

At least that's my understanding

dusky spear
proven plume
#

It's a limitation of C#, the constructor needs to be done explicitly.

#

Inferred constructors only happen when they have no parameters.

dusky spear
#

oh im dumb nvm

#

for the path of polygoncollider2d, would the coordinates of each point be in world space or object spacce

dusky spear
#

if i used polygoncollider2d.createprimitive to create the triangle, what orientation would it be in

#

the function doesnt have a rotation thingy built in

cosmic rain
dusky spear
cosmic rain
dusky spear
#

Oh cool

#

Thx

wanton obsidian
#

Anyone know how I can implement the cameras rotation into this to make sure the character moves the way the camera's facing. I thought I had it correctly but its not working like it used to

wanton obsidian
#

How do I add my playerVelocity into the character move to keep from using two controller.Move's

hidden gazelle
#

hi i need help how do i make

#

hi i need help how do i make a harry potter style wand ?

warm wren
#

not really a code question tho

hidden gazelle
#

oo ok

hexed geode
unreal temple
karmic bloom
#

Can we change the default speaker mode in script? I tried AudioSettings.speakerMode - but that just returns the active mode

potent glade
#

question I have enabled full stack debugging and yet I get this message :
"A Native Collection has not been disposed, resulting in a memory leak. Enable Full StackTraces to get more details."
here are the settings in projects settings

cosmic ermine
#

hey I'm looking for a way to compare 2 colours, currently im doing it via math.distance(), but this is providing some odd results, is there a better way to do this?

west lotus
potent glade
west lotus
#

Native collections are part of the dots tech stack

potent glade
#

I see thank you

west lotus
#

Where are you using a native collection ?

urban owl
#

Debug.Log not showing in Editor mode

main shuttle
west lotus
#

Then that part of the code ia not being called at all @urban owl

cosmic ermine
main shuttle
west lotus
#

How are you sure?

#

It is possible you turned off the logs in the console window

#

There should be 3 toggles in it for logs warnings and errors

urban owl
#

only Debug.LogError is showed

#

Debug.Log is not

main shuttle
# urban owl

The toggles are in the top right, can you show those?

vital oracle
#

Does anyone know how to use TMPro sprite assets via C#/script?

In the inspector you can use <sprite index=1> easily to display the sprite.

As of now the asset I am using takes a string and then sets a TMPro text to that string, but I cannot input sprite index=1> as a string.

urban owl
#

this ?

main shuttle
#

Those

urban owl
#

OK, thank you

main shuttle
urban owl
#

it's showing

main shuttle
simple mountain
#

Unity Job System 1 dimentional Quadtree Brainstorming

dense vessel
#

Hello,
I'm having a really weird bug in my game 🤔 (really annoying and really hard to reproduce...)
Basically (removing everything that is irrelevant), I have two scripts : Warrior and Game_manager.
Game_manager instanciates a warrior in Start and calls the Warrior.activateMove() method in the first update.
Warrior initializes some variables in Start and uses these variables in activateMove()

public class Game_manager : MonoBehaviour
{
  public GameObject prefabWarrior;
  private GameObject warrior;
  private bool firstUpdate = false;
  
  private void Start()
  {
    warrior = Instanciate(prefabWarrior, ...);
  }

  private void Update()
  {
    if(firstUpdate)
    {
      firstUpdate = false;
      warrior.GetComponent<Warrior>().activateMove();
    }
  }
}

public class Warrior : MonoBehaviour
{
  private GameObject moveArrows;
  private void Start()
  {
    moveArrows = transform.GetChild(0).GetChild(2).gameObject;
  }
  
  public void activateMove()
  {
    moveArrows.SetActive(true);
  }
}

My problem is that rarely (about 5% of the time), in the built game (maybe it's a coincidence but I've never had that bug in the editor), the game starts, the warrior is instanciated correctly but then Warrior.activateMove() is called before Warrior.Start() 🧐 (I know this because of some logs I added, the Warrior.Start() wasn't called when the bug occured)
Therefore I get an "Object reference is not set to an instance of an object" error and nothing works...

Warriors are only instantiated in Game_manager.Start() and activateMove() is only called in Game_manager.Update()

#

I'm guessing there's something I don't understand in the order in which Unity calls the Start and Update methods but then I don't get why it happens so rarely. Any idea why this happens and how I could fix it?

simple mountain
#

chatbot thinks you should use awake method instead of start

thin aurora
woeful leaf
#

Yeah maybe using Awake would fix it

thin aurora
#

You should add a boolean instead of checking firstUpdate

#

Unless awake works

dense vessel
#

I already have other things in Awake

dense vessel
thin aurora
#

Then use a boolean rather than firstUpdate

simple mountain
dense vessel
#

I'll try and come back in a few days if the bugs occurs again 😆
Thanks!

thin aurora
#

IDK if I'm right, but I assume there is no guarantee that Start happends before Update. It happends after Awake

woeful leaf
simple mountain
#

it s usefull xd

thin aurora
#

It's going to tell you that because awake is obviously where initialization happends half the time, but not here

woeful leaf
#

^

thin aurora
#

@dense vessel Can't you just instantiate and then call your move method after, all in the same method?

dense vessel
thin aurora
#

Or, create a coroutine which contains the spawn method, then it yields a frame, and then it moves?

thin aurora
dense vessel
thin aurora
#

Awake and start happen at the same frame

#

unless you don't enable it at initialisation time

dense vessel
#

So I would start a coroutine in Game_manager.Start() and the coroutine would instanciate the warrior, yield a frame and then activateMove() ?

thin aurora
#

Basically, yes

dense vessel
#

And Warrior.Start() would be guaranteed to be called in that frame?

thin aurora
#

But your warrior's Start method stuff should happen in an Awake anyway

west lotus
thin aurora
#

So you might aswell change that

#

Because it's able to find your gameobject in an awake

dense vessel
thin aurora
#

Like, if you do your Unity stuff properly, you don't even have to bother waiting a frame for stuff

#

If you do your initialization in awake and behaviour in start, it basically never goes wrong

dense vessel
#

Oh true, I thought I had other stuff in Awake but that was another script 😅
Thanks a lot for all these solutions!

#

So the Awake of an object instanciated in Game_manager.Start() is guaranteed to be called before Game_manager.Update() ?

west lotus
#

Im not sure that its guaranteed

#

Awake sure is early enough to fire before any update but I dont think there is an actull guarantee

dense vessel
#

Well I'll do the custom start solution then, this way I'm 100% sure 😄

west lotus
#

The only guarantee is for a individual mono

west lotus
thin aurora
#

I just don't know if Start is guaranteed to happen before it

#

I think it depends on when you instantiate. Like if you instantiate late instead of when Unity boots it probably varies

#

I assume it's before Update then

dense vessel
#

Ok. But I still prefer Uri's method. This way I don't rely on Unity's stuff, I'm 100% sure it works and I understand what I'm doing 😄

thin aurora
#

He's right though. The update of your manager is not guaranteed to happen after your Warrior's Start (and awake??) method. That's why it's so confusing

#

People usually work around it by making an init method and passing required data in there, since awake and start don't take parameters

#

But if moving is a recurring thing, you can totally just call that manually

simple mountain
woeful leaf
#

So in theory you could have your own method called Start with parameters and call that yourself, though that's a bit confusing probably so maybe not the best practice

thin aurora
#

That's probably also why there's not an init method build in in general

teal kernel
#

Kinda epic tbh

#

This is from chatGPT

woeful leaf
woeful leaf
teal kernel
#

Trol

sterile zealot
#

I have a strange issue that is happening at Runtime and not through any errors or spitting anything into my Debug.log. It could be code related but may be a setting issue somewhere.

#

I'm not very experienced with Unity, but I do have two scenes that work fine when I'm in the Editor and click Play. But when I do a Build, my first Scene with 2 basic UI buttons on a menu does not work. It works fine in the editor but not on the build. I have to Ctrl+Alt+Del each time. Is there something minor I'm missing here? Or do you know if this is a code issue I need to debug?

It's a New 2D Project, the first button is to Play the game and just opens up Scene 2, and the second button is coded to Exit the Application.

carmine rivet
#

I'm having a problem with chunk generation for my 2D TopDown game. The further away from the center the player moves, the further away the chunks generate exponentially.
This results in chunks not generating on the player.

#

I'm pretty sure the problem is in the highlighted part of the code as the chunks still generate on the correct coordinates, just not correctly around the player.

#

Thanks in advance.

thin aurora
# teal kernel This is from chatGPT

ChatGPT is very solid, but please don't use them to develop your application unless you understand why it does something. Also, ChatGPT can be very wrong.

#

So, unless you understand the code he just generated, I advice finding a way to make your script without AI

woeful leaf
#

^

pine spire
#

It can be a great learning tool, but that's mainly because video tutorials are so overrated and common and ChatGPT won't give you gazillion video tutorials like google :D Can be hilariously wrong also, so you really need to know something about the subject already.

woeful leaf
#

For example, whilst this what the bot said isn't wrong, it might not be what you want since it's always overriding velocity and then you cannot "properly" use physics

sterile zealot
#

Is there a well known thing in Unity to check when something works fine in the Editor but not at Runtime?

teal kernel
woeful leaf
#

You can use Preprocessor directives to make things run in only the editor, but I don't know if that's probably not what you mean

sterile zealot
#

@woeful leaf I have two scenes that work fine when I'm in the Editor and click Play. But when I do a Build, my first Scene with 2 basic UI buttons on a menu does not work. It works fine in the editor but not on the build. I have to Ctrl+Alt+Del each time. Is there something minor I'm missing here? Or do you know if this is a code issue I need to debug?

It's a New 2D Project, the first button is to Play the game and just opens up Scene 2, and the second button is coded to Exit the Application.

thin aurora
#

I used it to learn React last week

#

But I actually wrote stuff myself after it was explained

sterile zealot
#

@woeful leaf I was thinking it could be related to the layers I have the background image on and the buttons, but then it shouldn't work in the Editor either if that were the case.

woeful leaf
#

Both buttons don't work or?

sterile zealot
#

Both buttons works in the Editor but after I compile and Run the build nothing works, it gets to Screen 0 which is my Game Menu screen, but nothing works and I have to Ctrl+Alt+Del out each time

woeful leaf
#

Can you show the code?

sterile zealot
#

Do you think it could be an issue with my code? Because I wasn't sure if it was my code or a setting in Unity I'm missing.

#

Still getting use to Unity

woeful leaf
#

Well there's a difference between exiting the application and exiting the editor

using UI;

public class Quit : MenuButton
{
    public override void OnClick()
    {
#if UNITY_EDITOR
        UnityEditor.EditorApplication.isPlaying = false;
#else
    Application.Quit();
#endif 
    }
}
#

So if you only have the former then it won't actually do anything in the build

#

The latter should work though

sterile zealot
#
// Start is called before the first frame update
    public Button playButton;
    public Button quitButton;

    void Start()
    {
        playButton.onClick.AddListener(GoToGame);
        quitButton.onClick.AddListener(ExitGame);
    }

    private void GoToGame()
    {
        SceneManager.LoadScene(1);
    }

    private void ExitGame()
    {
        Application.Quit();
    }```
woeful leaf
#

wrong thing

#

it's backticks

#

```

#

!code

sterile zealot
#

Sorry, first time trying to post code in here

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.

woeful leaf
#

(Edit the previous instead of posting it again)

woeful leaf
sterile zealot
#

Thank you!

woeful leaf
#

You still didn't get the

#

!cs

sterile zealot
#

That's the related code I have for those two buttons

tawny elkBOT
#

You can format your multiline code block with C# highlighting! Just add cs to the start of it. Highlighting example below!

class Fluffs : FluffyCat
{
    public void PetCat ()
    {
        Debug.Log ("Petting Cat.")
    }
}
woeful leaf
woeful leaf
woeful leaf
#

Assuming you don't use them in other scripts through that script, you should make it [SerializeField] private instead of public

#

That's not why it doesn't work though

sterile zealot
woeful leaf
#

You've no errors, correct?

sterile zealot
#

Those buttons would only appear on that menu

woeful leaf
#

Like any errors

sterile zealot
#

Correct.. no errors

#

Actually, my Exit Game button doesn't work in the Editor mode, but I assume that was because I was running in Editor and why I was trying to test it in the Build Run

#

@woeful leaf

simple mountain
#

Eventho this doesn t say much it should help explain my situation

woeful leaf
sterile zealot
#

Sure..I'm open to suggestions

simple mountain
#

cpp flashbacks

woeful leaf
#

In the ExitGame();

#

And try if it exits the game then in the editor

pine spire
#

@thin aurora Yeah definitely not copy-paste material. But especially for programming can be quite good and actually sometimes gives better results than google. Like I don't know if it has eaten whole github or what, but sometimes if you ask about some things like behavior of specific API it gives you answers which definitely are not directly available from google.

woeful leaf
#

Like I don't know if it has eaten whole github or what
I'd not be surprised

sterile zealot
#

@woeful leaf Nice... that make it quit the game in the Editor now

woeful leaf
#

Hm so that button does also work in the editor

#

Try this maybe?

sterile zealot
#

It does now, yes. Doesn't work in Run.. just tested it.. I also noticed that the Button highlights are no working when I mouse over them in the Build Run. They work find in the Editor

woeful leaf
sterile zealot
#

Reading it now

#

Interesting.. it was set to the Old method and when I changed it to both.. Unity Crashed..

#

first time I've seen it crash like that

woeful leaf
#

Welp reboot it and see if it changed

#

If it hasn't change it back again and pray it doesn't crash kek

sterile zealot
#

Yeah.. It wanted me to reboot a bug so it's doing that right now

#

report*

#

It saved it as both

#

Now to test it

#

Nope.. same as before.. I can move the mouse cursor around but it's almost like the game is locked up

woeful leaf
#

Could you just like put some text in the main menu that just increases an int and displays it to see if it runs?

sterile zealot
#

Just put in Start()?

woeful leaf
#

No update so you can see that it keeps running

sterile zealot
#

Ah right

minor sigil
#

I am so confused rn,

        float x = Input.GetAxisRaw("Horizontal");
        float z = Input.GetAxisRaw("Vertical");

        Debug.Log($"{x} : {z}");

I made a new project, put this into it, why does z return -1 when no key is pressed?

#

This is being called every frame in update, but in 3 different projects I put this into, z always = -1 when its nothing is being pressed

#

It was my sim steering wheel messing it up ^ god damnit

swift falcon
#

Kind of a broader question. Is inheritance used to manage multiple levels with the same script or is there another way to do it in Unity?

minor sigil
#

If its the exact same code different variable values, use scriptable objects

swift falcon
#

Great thank you

wraith spear
#

I'm having some trouble with yield returning a method. It worked fine for other methods, but for some reason this one won't start.
Code for context: https://hatebin.com/sulellohyp (see the "This part fails" comment)

Problem description:

  1. When the player clicks on a move button, the method OnClickMoveButton(index) is executed and a Coroutine is started to handle their input.
  2. If they select everything correctly, the methods HideMovePanel() and MoveSelectionOver() get called.
  3. HideMovePanel() is executed succesfully. It hides the move panel, and when debugging, breakpoints get hit.
  4. MoveSelectionOver() is not executed succesfully. For some reason, the method doesn't even get executed. Breakpoints aren't hit, nothing happens.

I was wondering whether anyone knows why this might happen / sees something I've missed.
Oh, and something else that's weird; if I change the order of the methods (first MoveSelectionOver() and then HideMovePanel()) MoveSelectionOver() does get executed. However I really don't see how HideMovePanel() could stop MoveSelectionOver()'s execution.

woeful leaf
#

Also what is TurnController.instance.StartTurn(selectedMoves) exactly

minor sigil
#

You aren't calling MoveSelectionOver correctly

#

I also assume your gonna have the same problem with yield return TurnController.instance.StartTurn(selectedMoves);

wraith spear
minor sigil
#

You can do that if you already called it, but thats not how you call a coroutine in unity, so unless you call it somewhere first that won't work

wraith spear
minor sigil
#

Like you could do

Coroutine moveOverRoutine = StartCoroutine(MoveSelectionOver());
yield return moveOverRoutine;
wraith spear
minor sigil
#

yes you are returning null in Method2, you are not starting another coroutine

#

But you start the coroutine by doing StartCoroutine(Method 2());

#

You aren't doing that in your code, you might call StartCoroutine(ProcessInput(index));
but you dont have any for the others, you are returning an unstarted coroutine

maiden inlet
#

how do i deal with Editor Code that needs to be on a ScriptableObject but the SO cant have a reference to UnityEditor Assembly cause i want it to work in build? Specifically i want to use [OnOpenAsset] to open a custom editor window

minor sigil
#

Don't think thats possible unless unity has a dll

#

its a unity feature, not a c# feature

wraith spear
minor sigil
#

Its going to work, everytime you call a coroutine and want the code inside to run, you need to do StartCoroutine first so unity knows

#

Thats also a feature unity has, not c#

#

Your code

private Method1() {
    StartCoroutine(Method2());
}

IEnumerator Method2() {
    yield return Method3();
}


IEnumerator Method3() {
    yield return null;
}

how it should be

private Method1() {
    StartCoroutine(Method2());
}

IEnumerator Method2() {
    yield return StartCoroutine(Method3());
}


IEnumerator Method3() {
    yield return null;
}
wraith spear
#

I thought thanks to the yield returns the methods were automatically "chained" in one big Coroutine. That's how it's worked for me previously. But thanks for the detailed explanation!

shut ridge
#

greetings. when i check if two lists have any intersecting elements, it returns true, but when I to get those elements, it seems to return null.

minor sigil
#

They will "chain", you just need to start the next one, you can't call it like a normal function, they aren't functions

wraith spear
minor sigil
wraith spear
shut ridge
#

i'll show code

wraith spear
minor sigil
#

like instead of

shut ridge
minor sigil
#
HideMovePanel();
yield return MoveSelectionOver();

you did

yield return MoveSelectionOver();
HideMovePanel();
#

like that?

minor sigil
#

If thats the case, you have an error in HideMovePanel

shut ridge
#
if (List1.Intersect(List2).Any())
{
   var variable = List1.Intersect(List2);
   Debug.Log(variable);
}
minor sigil
#

Still weird the next coroutine would be called though without StartCoroutine

wraith spear
minor sigil
#

Are you sure MoveSelectionOver is getting called?

#

Like add a debug to it, so when it gets called it logs it

#

Don't just think its doing it

wraith spear
maiden inlet
shut ridge
#

im showing the code that has an issue

wraith spear
# wraith spear Aaaah nevermind I got the problem!

In HideMovePanel I set the gameobject to inactive. That's the same gameobject the script is attached to. Now that I do yield return StartCoroutine(MoveSelectionOver()) I get an error "Coroutine couldn't be started because the the game object 'MoveButtons' is inactive!"

minor sigil
#

You are just showing yourself logging it

#

Not the values going into it

shut ridge
#

alright i'll look into it

minor sigil
#

Also

#

.intersect returns a IEnumerable<int>

#

You can't log it like that

shut ridge
#

it returns an ienumerable<string> for me

minor sigil
#

Oh

shut ridge
#

and I convert it to string

minor sigil
#

string list, still the same

#

you cant log it like that

#

var variable = List1.Intersect(List2); isnt a string

#

its a IEnumerable<string>

shut ridge
#

i use tostring()

minor sigil
#

not in that code you dont

shut ridge
#

whoops

#

but yea i do in my proj

minor sigil
#

Its not a .tostring though....

#

You have to loop through it

shut ridge
#

it does allow me to tostring it

#

¯_(ツ)_/¯

minor sigil
#
IEnumerable<string> variable = List1.Intersect(List2);

foreach(var killmenow in variable)
  Debug.log(killmenow);
minor sigil
#

learn coding please

shut ridge
#

this is legit my first time using ienum

minor sigil
#

You are getting the string value of the IEnumerable

#

the IEnumerable has multiple values in it

#

not just one like your trying to do

#

Even if it only has one, its a list type

#

So you will have to loop through it

#

Or get the first value

#

IEnumerable[pos]

shut ridge
#

i'll look into that

#

thanks

minor sigil
#

I gave you the code above

shut ridge
#

and apologies

shut ridge
#

im still brank new

#

*brand

#

lmao

#

thx fr

narrow kite
#

will it stop loop when isWalking isn't true anymore? if not, then how to stop this loop when isWalking isn't true?

wraith spear
# shut ridge i've been coding for less than a year

Everyone needs to start somewhere, that's totally fair. However, next time you ask a question on either this Discord or somewhere else online I recommend you follow this step-by-step guide from StackOverflow: https://stackoverflow.com/questions/ask (you can see it on the right under "Step 1: Draft your question"). It'll make it a lot easier for us to help you.

shut ridge
#

aight <3

minor sigil
#

Learn about objects

#

most people skip tht

shut ridge
#

nono
im pretty ok with those

#

lists and enums are my bane rn lmao

wraith spear
narrow kite
narrow kite
minor sigil
#

Actually

#

I ont wanna

#

I was gonna fix it, but you should rewrite that

#

Movement should not be done through a ienumerator

wraith spear
narrow kite
minor sigil
#

Also, that will have delays of atleast half a second

minor sigil
#

nvm actually

#

I have no idea

sharp oracle
narrow kite
minor sigil
#

Correct me if im wrong

#

but I dont think so

minor sigil
minor sigil
#

Its easy

#

Create a new animation, hit the record button, drag the new sprite in

#

i dont know if it will log it or not but i dont see why it wouldnt

narrow kite
#

i think i got it

#

let me try

narrow kite
minor sigil
#

Right click on the on idle, hit set default layer

#

Then make a bool parameter

#

make a transition from idle to walk when that bool is true, walk to idle when its false

narrow kite
#

oh i did it

minor sigil
#

and set the bool to your iswalkin value

#

Get a reference to your animator, animator.SetBool("walking", isWalking);

#

in your update ^

narrow kite
minor sigil
#

Yes

narrow kite
#

cool

minor sigil
#

animator.Play("Dash");

#

Make a transition going back to idle though

#

after exit time for example

#

or however long you want, or could just do in code animator.Play("Idle"); when you wanna go back

#

I recommend trying to keep it clean, animators start to get confusing very fast

narrow kite
minor sigil
#

Yes

narrow kite
#

cool

minor sigil
#

make a parameter in your animator for walking and switch between idle and walk

#

with transitions

swift falcon
#

How to do multithreading?

minor sigil
#

and set that parameter to your isWalking

minor sigil
swift falcon
minor sigil
#

Because its on a different thread

swift falcon
#

So

minor sigil
#

Threads can't interact like that

#

Thread is its own process

swift falcon
#

Well how do I improve chunk generation performance then

minor sigil
#

Essentially a different program

swift falcon
#

It lags a lot

minor sigil
#

Only generate chunks around the player

#

ungenerate and save the ones the player isnt near

#

how every game ever does it

swift falcon
minor sigil
#

lmao

swift falcon
#

It still lags

minor sigil
#

Good

swift falcon
#

Mainly when you walk

minor sigil
#

Your code is shit

#

cant help ya

swift falcon
#

I just grab chunks from a dictionary

minor sigil
#

Maybe learn about things before trying to implement them

#

That would help

#

And when someone is trying to explain it to you

#

Don't act rude

swift falcon
#

i mean what did you even think i was doing

#

That's literally how every game does it

minor sigil
#

Why do you need different threads then

#

No game uses other threads for that lol

#

not a single one

#

I can 100% confirm that

#

because its not possible

#

The game might run on multiple threads

#

But the generation part is all in 1 thread

swift falcon
#

yeah so i figured i could dedicate a thread to chunk generation and do the rest on others

#

But i can't run things like instantiate on that thread

#

Which i kinda need

minor sigil
#

Make your own engine then

thin aurora
minor sigil
#

You are going off of unitys thread

#

The second you do that

#

You lose all unity functions

lucid valley
thin aurora
#

When you work asynchronously in Unity, it just delegates the tasks in a custom state machine that still works synchronously because Unity methods must work on the main thread

swift falcon
#

Well shit

thin aurora
swift falcon
#

I tried coroutines it's not working great

minor sigil
#

Running different threads in unity would honestly be worse

thin aurora
#

I never looked into it either way

minor sigil
thin aurora
#

Don't use a Coroutine

late lion
#

Entities uses the Job system, which can be used without Entities.

thin aurora
#

But Unity2023 is in alpha

minor sigil
#

i was gonna say

thin aurora
#

So use with caution

minor sigil
#

who uses 2023

#

Im still on 2021.3 or 2020

lucid valley
#

either that or use UniTask package as that has the same features as what 2023 has with Awaitable

oblique spoke
#

Jobs has been considered production ready for a while and does actual multithreading

minor sigil
#

burst

oblique spoke
#

As is Burst. Neither require Entities.

lucid valley
#

well the issue is what is actually costing performance, working out the generation or actually spawning it

minor sigil
#

Pooling

#

Pooling will always be most effecient

lucid valley
#

you could use jobs to work out the generation and then mainthread spawn it (with pooling)

minor sigil
#

But why

#

Just disable stuff the player cant see

#

and enable what they can see

#

Its easy to implement, and good for performance

lucid valley
#

yeah sure theres other ways as well

minor sigil
#

Yes but thats one of the best performance wise

#

And super simple

west lotus
minor sigil
#

Pooling is faster everytime lol

west lotus
#

Its most certanly not a best solution for everything

thin aurora
minor sigil
#

did i say that

#

dont come at me like that

#

when ur being a dumbass

#

Read what i said

#

read the entire convo before that

#

We are talking about spawning in objects

#

There are 2 ways, instantiating, or pooling

thin aurora
#

The true Stackoverflow experience, there is always somebody to disagree with you in here

minor sigil
#

I just find it funny he said im talking out of my ass

thin aurora
#

It's a toxic way to learn, but learn we shall

minor sigil
#

when its proven what i said, and its proven what he said aint true

thin aurora
#

Good way to let out some steam instead of bashing my irl coworkers too

minor sigil
#

Coding for me is simple, just when u hear people talk about it they talking about like 500 random things at a time

west lotus
#

Nvm you guys can continue being dumb UnityChanThumbsUp

minor sigil
#

Pooling is faster

#

always

desert shard
#

you're missing the point

mental rover
#

pooling is a tradeoff of memory - if you had a very large game you may not be able to just pool everything

minor sigil
#

Its not OMG GAME CHANGER performance for all, but when your making a game every little bit counts

desert shard
#

what if pooling isnt the problem?

#

then you've just wasted time

minor sigil
#

Thats not what im saying

wispy badger
#

how do you serialize Transform in Netcode?

public void giveServerRpc(Transform obj)
    {
        orgP = obj.position;
        orgR = obj.rotation;
        CarriedObject = obj;
        coName = obj.gameObject.GetComponent<item>().name;
        CarriedObject.GetComponent<MeshCollider>().enabled = false;
    }
desert shard
#

I know its not

#

and thats why it's dumb

minor sigil
#

Im talking about his issue

#

And he is the one that brung up in general

#

Im still talking about for world generation

#

And still, even if its not the issue

thin aurora
#

There is always a way where people can totally twist the subject and turn a simple question into a massive debate

desert shard
#

you optimize the problems, not fabrications

minor sigil
#

Its still better than instatiating

minor sigil
#

Im saying it is always performance wise better, can you say that is false?

#

Because that is all i said

desert shard
#

entirely dependant on the usage

minor sigil
#

I didnt say its perfect for everyone in every situation

#

Never have i said that or anything towards that

#

I dont get why you guys wanna argue just to argue

minor sigil
mental rover
minor sigil
#

Situation dependent on how much of a difference

thin aurora
minor sigil
#

Read above that

minor sigil
#

i dont get how that has anything to do w now

woeful leaf
#

This isn't really going anywhere

minor sigil
#

but everyone keeps saying im wrong, then tries to say im saying something im not saying

thin aurora
woeful leaf
#

That is fair

neat lagoon
#

🍿

thin aurora
#

This server is banging today, so much shit code and dumb arguments

#

I haven't done shit work-wise

minor sigil
#

Ive literally been just tryna help people here

thin aurora
#

I don't disagree with you

minor sigil
#

people keep trying to argue with me for literally no reason, google your arguement before you say it

#

because what im saying has been proven

narrow kite
#

my animation doesn't work, i will send you screenshot, just give me a sec

minor sigil
#

id go to animation or 2d channel

#

I don't know how 2d animations work

mental rover
minor sigil
#

?

#

Read above that 5 year old

#

I was helping him, he started to get rude

mental rover
#

feel like you may need a timeout

minor sigil
#

Cool

#

Good thing your not staff then

#

Because ive literally been helping people for the past 2-3 hours

#

and im still tryna help someone

narrow kite
minor sigil
#

and you keep tryna bring up shit that everyone let go

#

Just ignore them

#

If any of them can make a game that runs ill consider their opinions

woeful leaf
#

Can we just move on

#

As entertaining as this is, this isn't going anywhere

minor sigil
#

I have lmao, yall keep bring it back up

narrow kite
#

@minor sigil animation doesn't play

#

can you help?

minor sigil
#

Do the animations work?

thin aurora
# mental rover feel like you may need a timeout

You realize this whole shit show started because somebody argued against him and worded it like a moron, right? If you and another guy didn't join a side this would have stopped 12 minutes ago, so stop playing the blame game.

narrow kite
minor sigil
narrow kite
#

idk why dash changed to dash 0

minor sigil
#

Do you care how it works? or do you just want it to work

#

Because you can do it a lot easier with just the animator

narrow kite
#

it's an animator

minor sigil
#

I know

#

I meant play the animations

narrow kite
#

idk man

minor sigil
#

Ok

narrow kite
#

i dont understand anymore

#

i will search tutorial

minor sigil
#

Do you see the parameters tab?

narrow kite
#

thx for help

minor sigil
#

in animator

#

do you see parameters tab

narrow kite
#

yes

minor sigil
#

make a bool called isWalking

narrow kite
#

ok

#

wait

minor sigil
#

Right click idle, click make transition drag to walk

#

and do same thing back, from walk to idle

narrow kite
#

ok

minor sigil
#

Turn off has exit time for both, on the transition idle -> walk, set condition to isWalking = true

narrow kite
#

like this?

minor sigil
#

yes

#

like that

#

On the one going from idle -> walk, toggle off the has exit time

#

and add a condition where isWalking = true

sterile zealot
#

@woeful leaf Just wanted to let you know I never did get a Text incrementor added, but I figured out my problem from earlier. For some reason I had deleted the MainCamera and EventSystem from my Scene 0. After adding those back in, it fixed my runtime issue. Thanks for the help.

minor sigil
#

and same for walk -> idle, but isWalking = false

minor sigil
#

Click the transition line

narrow kite
#

i dont see "has exit time"

narrow kite
minor sigil
#

the white line going from them

woeful leaf
#

Or did you never rebuilld it?

narrow kite
minor sigil
#

for both?

sterile zealot
swift falcon
#

how pooling

minor sigil
#

are you really that petty

swift falcon
woeful leaf
narrow kite
minor sigil
narrow kite
#

give me a sec

sterile zealot
minor sigil
#

what u need to search for lol

#

just click the white line

narrow kite
#

bro

minor sigil
#

and toggle off hasexittime

narrow kite
#

just give me sec

#

1 sec

#

shit

#

autocorrect

#

sry

woeful leaf
mental rover
woeful leaf
swift falcon
#

@minor sigil when i generate a chunk i log it in a dictionary so i don't have to re-instantiate it
is that what you're talking about

minor sigil
#

Yes, then set it to unactive if the player can't see it/isnt near it

swift falcon
minor sigil
#

For best performance, if you disagree with this i stg, only render graphics that you can see

minor sigil
#

Like does it only instantiate when its being generated for first time?

#

and once its instantiated, it goes to a pool and gets called .setactive from there?

narrow kite
swift falcon
#

Wouldn't i have to pool them anyway? Would suck if you unloaded a chunk and your builds disappeared

minor sigil
narrow kite
minor sigil
#

You did something else then

narrow kite
#

bruh

#

its hard

minor sigil
#

its rly not

#

you click the white line

#

there is a boolean box

#

called Has Exit time

#

uncheck it

#

Under that there is a conditions box

#

hit the + button, select isWalking, set value to true or false

minor sigil
swift falcon
narrow kite
minor sigil
#

Do you loop through the dictionary everytime?

#

The entire dictionary, not just the ones you want

swift falcon
minor sigil
#

So you use coords?

minor sigil
#

it makes it go away

narrow kite
swift falcon
minor sigil
#

o

#

Whats ur transition duration

swift falcon
#

The chunks are logged with their positions

swift falcon
minor sigil
#

talking to him

swift falcon
#

oh

minor sigil
#

So you have a dictionary, Vector2, Chunk

#

right?

swift falcon
#

Yeah

#

Do dictionaries slow down if they have more elements

minor sigil
#

and you get the chunk by Dictionary.get(vector2 coord)

#

or do you loop through it

narrow kite
minor sigil
#

which

#

o

swift falcon
#

The one I've replied to

minor sigil
#

And the only thing you do is set it to active? like the only line you have is gameObject.setactive(true/false);?

minor sigil
#

did u fix other problem

narrow kite
#

idk what is der

#

wait a sec

#

listen

#

i will let you help steve

#

i think you are overwhelmed

minor sigil
#

In your update funtion add, animator.SetBool("isWalking", isWalking);

minor sigil
#

lag isn't just caused by 1 thing

#

Especially if your not looping through something

#

Hard to say without looking at the code, best I could say, not trying to be rude, but code more efficient , think of a more efficient way to do what your trying to do. all apart of coding

narrow kite
minor sigil
#

There is a .stop

#

but like

narrow kite
#

nvm i fixed

minor sigil
#

Animations are usually done in animator, you can control it by code, but most of it is done in the actual animator

minor sigil
#

I know, but its true

#

Like the reason there is difference in indie vs triple a games

swift falcon
#

Wait sorry no I'm calling a Chunk.Unload() function

minor sigil
#

What is done in that?

swift falcon
#

Which has two lines

minor sigil
#

Also

#

how many chunks are you trying to load at a time

#

That could also be the issue

swift falcon
#

gameobject.setactive(false)

minor sigil
#

Also lods

swift falcon
#

And isloaded = false

minor sigil
#

its just a lag spike right? not constant lag

#

And are you loading the new one before unloading the old one?

swift falcon
#

guys where to ask about material issues ?

swift falcon
minor sigil
swift falcon
#

thx

minor sigil
# swift falcon Unload first

I don't know what exactly is causing it since i dont have your code, but if its a spike its something being called during those functions

#

Check everything that is called when a new chunk is loaded and unloaded

swift falcon
#

Is there a gameobject.isactive thing

minor sigil
#

yes

swift falcon
#

oh okay

narrow kite
#

how the fuck am i supposed to stop animation

minor sigil
#

.selfActive

minor sigil
narrow kite
#

i prefer watching video

swift falcon
#

Why not ChatGPT

minor sigil
#

chatgpt is only good if you know how to code

#

Because its not copy and paste ready

#

It gives you an idea of how to do it, not copy and paste tho

swift falcon
#

ChatGPT is refusing huge code blocks

minor sigil
#

wym

#

like they wont write them?

swift falcon
#

It just freezes when i give it a huge code block

minor sigil
#

lol i never tried sending it code

swift falcon
swift falcon
minor sigil
#

Ah

woeful leaf
#

I'd not advise ChatGPT

minor sigil
#

I find chatgpt very sketchy

left narwhal
#

chatgpt is useful

#

if you know how to use it

minor sigil
#

Its owned by microsoft, but why were they hiding that they were the owners of it?

swift falcon
minor sigil
#

They take a lot of ur info

woeful leaf
#

It being against the rules

minor sigil
#

a shit ton of ur info

swift falcon
left narwhal
#

not owned by microsoft

minor sigil
#

They are under the microsoft corp

left narwhal
#

owned by elon musk

minor sigil
#

So

#

Is it not made by azure?

#

Im almost certain it is

#

Azuregpt

left narwhal
swift falcon
left narwhal
#

azure offers openai as a service

woeful leaf
minor sigil
#

Which is what chatgpt is on

#

this is coding

#

go to an art channel

woeful leaf
oblique spoke
swift falcon
left narwhal
minor sigil
#

I dont fully understand it

#

But I know its built off azure

left narwhal
#

no

#

openai and microsoft are partners

#

theyre not ran by the same people

quaint rock
left narwhal
#

thats like saying

minor sigil
#

If they are partners

left narwhal
#

openai is built using intellij or whatever

#

or visual studio

#

so theyre microsoft

left narwhal
minor sigil
#

They are openai top investor

left narwhal
#

openai is its own company that microsoft invests into

minor sigil
#

by farrrr

#

they own them*

left narwhal
#

???

minor sigil
#

Not actually owners

left narwhal
#

i dont think you know what owning means

minor sigil
#

But with the money they have into them

#

Not actually owner

#

and i dont wanna get political

#

but when you have that much money into something

#

your gonna have a say

woeful leaf
#

Just because they sponsor it doesn't mean you own it

oblique spoke
#

Probably best to stick to coding

swift falcon
#

Do you guys use vscode, vs or smth else entirely

left narwhal
#

vscode

woeful leaf
#

VS

swift falcon
#

notepad?

woeful leaf
#

No

#

!ide

tawny elkBOT
#
💡 IDE Configuration

If your IDE is not autocompleting code
or underlining errors, please configure it:

Visual Studio (Installed via Unity Hub)
Visual Studio (Installed manually)

VS Code*
JetBrains Rider
Other/None

*VS Code's debugger plugin is unsupported.
We recommend using VS or Rider instead.

swift falcon
quaint rock
#

they have multiple lead investors MS is only one of them

minor sigil
#

Also

#

microsoft is speculated to add chatgpt to bing

swift falcon
#

IDE's are for babies

minor sigil
#

So its not like they are just throwing money at openai for free

minor sigil
#

that will be a game changer for search engines

woeful leaf
#

If they do that it genuinely might compete with Google

minor sigil
#

See

woeful leaf
#

The search engine, not Google as a whole

minor sigil
#

I dont think anything will compete with google

#

everyone knows its shit

#

but everyone still uses it

#

not everyone, but most

quaint rock
#

it will be terrible for search engines actually, results are useless unless sources can be cited chatGPT can not provide sources

swift falcon
#

ChatGPT can't even do math

minor sigil
#

chatgpt they could literally give u a personalized assistant for your computer

quaint rock
#

also this is all off topic

late lion
minor sigil
subtle herald
swift falcon
#

ChatGPT tried to tell me 0.2 repeating+ 0.8 repeating = 1

quaint rock
#

why would you use it for that

subtle herald
#

I mean, it'll tell you the right thing if you make sure it understands what you want or are doing first.

quaint rock
#

like i am not for chatGPT but that is a poster child case of wrong tool for the job

subtle herald
#

It knows +=

minor sigil
#

We are a LONG way for adding chatgpt to search engines though

#

Right now it is using data from 2021 i think?

swift falcon
#

ChatGPT can write plays

#

They're fun

minor sigil
#

we would have to make it constantly learn new things

#

like, everytime something is uploaded to the internet

#

it would know

swift falcon
minor sigil
#

which is honestly a security issue

subtle herald
#

And you can't do that while it's online. For obvious reasons lol

minor sigil
swift falcon
#

YEAH

simple egret
#

Please move the conversation elsewhere before the mod comes back to hit you on your head

minor sigil
#

I tried too everyone came back here

swift falcon
#

okay okay wait

#

Let's just leave

minor sigil
sacred glen
#

Is there a good way to start a shell command asynchronously, and pipe the output back to unity as it happens?

covert shard
#

i want to talk with someone about the ads with mediation in unity and technically my problem isnt with scripting, who should i contact?

fossil moat
#

I still have no idea how to do that i'll have to look into it, thank you !

bleak mountain
#

hi i used this code [Header("Keybinds")] public KeyCode jumpKey = KeyCode.Space; to make it so i jump on the space bar but the code isint jumping here is the link to the code https://codeshare.io/WdVy78

quaint rock
#

add some logging figure out what the code is actually doing vs what you expect it to do

#

confirm its actually getting into the condition to jump

bleak mountain
#

ohh someone just change the things in the link ill paste it into a new link where people cant edit it ig

bleak mountain
#

bruh dont click that link no more

woeful leaf
#

Don't cross post

swift falcon
#

Mathf.PerlinNoise keeps printing the same value

quaint rock
bleak mountain
bleak mountain
#

bruh

woeful leaf
#

And if it does take a while feel free to bump it up in the same chat, but don't move it to another chat

#

If you're worried about it getting buried, you can always create a thread

bleak mountain
#

oke i wasent sure if that was allowed ive been iin other discords where you shoundt bumb

#

bruh someone does it again

#

ig ill just put the code in here so people cant edit

woeful leaf
bleak mountain
#

im trying to find it

#

yea

#

!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.

bleak mountain
#

oke this one i dont think people can edit this 1

lucid valley
#

private bool readyToJump = true; try that

bleak mountain
#

ahh that was the problem

#

thanks very much

woeful leaf
#

Would this be a bad way to do thing? Like should it be a switch case or should it be something else?

        switch (gameObject.tag)
        {
            case "Bad":
                switch (collision.gameObject.tag)
                {
                    case "Bad":
                        ScoreUI.OnAnswer(ScoreUI.AnswerType.Correct, passwordDrop.good++);
                        break;
                    case "Good":
                        ScoreUI.OnAnswer(ScoreUI.AnswerType.Incorrect, passwordDrop.bad++);
                        break;
                }
                break;
                
            case "Good":
                switch (collision.gameObject.tag)
                {
                    case "Bad":
                        ScoreUI.OnAnswer(ScoreUI.AnswerType.Incorrect, passwordDrop.bad++);
                        break;

                    case "Good":
                        ScoreUI.OnAnswer(ScoreUI.AnswerType.Correct, passwordDrop.good++);
                        break;
                }
                break;
        }
#

Basically you can drop an item into a box, which can be good or bad, and it has to match the good or bad of the box

#

Hence the double switch cases

prime sinew
#

that's what I would do. No need for the switch case at all

lucid valley
woeful leaf
#

Due to the .CompareTag reason?

lucid valley
leaden solstice
#

Tags are bad by itself

#

No expandability or maintainability

lucid valley
quaint rock
#

i would also take the switch over double nesting a ternary for readability

prime sinew
#

I just focus on avoiding comparing hardcoded strings

quaint rock
#

but this type of cases in a real codebase i would almost always handle with interfaces and TryGetComponent

prime sinew
#

I'd just pass in the isCorrect bool to OnAnswer and avoid the ternary altogether

#

let OnAnswer handle the inner logic, since they both rely on the same isCorrect bool

woeful leaf
#

It's an enum with 4 cases

#

But they do not need to be in the Switch case in this case

prime sinew
#

since it's the same for both "Bad" and "Good" tags, OnAnswer doesnt really need to be passed in all that logic

#

it's going to do A when the tags match, and do B when they don't match.

woeful leaf
#

I suppose yeah, thanks for the insight

prime sinew
#

you're welcome. this was a fun exercise

leaden solstice
#

And it is confusing that your tag "Bad" and passwordDrop.bad does not seems to relevant

#

Rename one or both

prime sinew
#

passwordDrop.bad should probably be passwordDrop.incorrect

woeful leaf
#

Yeah still working on the naming of these things

leaden solstice
#

Also renaming tag is messy, that's another reason why you should not use tags

woeful leaf
#

I'm probably like 80% done if not more

#

I don't really have the time to make a sophisticated system for it

swift falcon
jaunty needle
#

I know this isn't necessarily a coding problem but how do I add starts to the background the scale when I zoom in or out? I need it to be dynamic because I can't just have thousands of stars on a scene at any moment

woeful leaf
jaunty needle
#

Thing is I want this in the actual game itself

#

Not just the main menu

quaint rock
#

fake it

#

have a few layers of textures for stars then a few particles on top

narrow kite
#

there is no "Is Walking" and "Isn't Walking" in console, also animations doesn't play. what i did wrong?

quaint rock
#

looks like you are not ever calling Animation

narrow kite
#

oh wait

#

i think i know how

#

im fuckin dumb

#

thx man

#

also does someone know how to adjust thumbstick dead zone? i changed it in project settings but it doesnt really change anything

#

im using new input system

woeful leaf
narrow kite
#

ok

long fox
#

What’s the best way to learn vr coding

woeful leaf
#

And just begin with the basics

long fox
#

Because when I type on YouTube etc not many come up 🤣

woeful leaf
#

Do you know the basics of Unity and C#?

long fox
woeful leaf
#

Well google around for courses and such I suppose

#

Just start messing about in a project see what works and what doesn't

#

Doing is the best way to learn

karmic bloom
#

Can we change the default speaker mode in script? I tried AudioSettings.speakerMode - but that just returns the active mode