#πŸ’»β”ƒcode-beginner

1 messages Β· Page 63 of 1

rich adder
#

pass it to velocity ?

steady isle
#

wat

rich adder
#

your rigidbody is following a trajectory

#

store the vector3 direction and then run it thru reflect on collision

steady isle
#

explain to me as if i was just bron

#

born

rich adder
#

i wish I knew how lol

rich adder
#

you have this in your code

steady isle
#

yup

rich adder
#

you're fixed in one spot direction , which is hard to change and not useful.
So you ideally want to store your direction inside a variable you can change

steady isle
#

ok

rich adder
#

then you reflect that and change that one

amber dome
#

I understand how it works, there is this mechanism in game development on Roblox

steady isle
rich adder
steady isle
rich adder
#

you're trying to do the same thing but with the ball, the Reflect function lets you do that if you pass your incoming velocity

#

aka direction

steady isle
#

alr

rich adder
#

do the first part

#

then go from there

steady isle
#

when i look at code i read what it says and assume it does what it says which is why i have lots of logic errors

#

so until i know how to use it i cant learn it

rich adder
steady isle
rich adder
#

I read a lot of weird comments in your code which looks to be half AI generated

steady isle
#

i wrote this by myself lmao

rich adder
#

oh well it might as well have been

steady isle
#

u can cross check if its ai if that is even possible but its not ai

rich adder
#

ok do you know how to store something inside a variable yes ?

steady isle
#

yea

rich adder
#

so start by storing ball direction into one

steady isle
#

as a string?

rich adder
#

why would it be a string, does rigidbody.velocity take in a string ?

steady isle
#

idk

#

"right" "left"

rich adder
#

yes you do know if you think for a moment

steady isle
#

number

rich adder
#

hover over velocity with your mouse in visual studio

steady isle
#

ok

#

units per second

steady isle
rich adder
summer stump
rich adder
#

when you look at

steady isle
rich adder
#

this is Input it wants

steady isle
#

so instead of an int or float i do vector2?

rich adder
#

always read that part of a variable it tells you

steady isle
rich adder
steady isle
#

when i create the variable the name is grey

rich adder
#

the editor tells you why

steady isle
#

oh i havent used it

#

how i usei t

rich adder
#

you should go through some courses
start with pins in this channel

#

where else would you use it ? what have you been talking about this whole time

steady isle
#

the direction the ball is going

rich adder
#

so why ask such a silly thing

steady isle
#

i meant how

rich adder
#

we just established velocity takes in a vector2

#

where else

summer stump
eternal falconBOT
#

:teacher: Unity Learn β†—

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

summer stump
rich adder
#

the brackys c# ones arent good

steady isle
#

oh

rich adder
steady isle
#

should i even be starting with unity or just the console

rich adder
summer stump
rich adder
#

console runs faster than waiting for script compilation times and such

#

unity is PAINFULLY slow

#

even with domain reloading off

#

but it makes sense when you change 1 script its updating entire UnityEngine assembly and whatever else

#

so i guess assembly definitions help a lot with that

eternal needle
queen adder
#

how long does new unity compiles in betterish pc's?

rich adder
#

not that much better

#

tbh

queen adder
#

better than 5 mins?

eternal needle
#

depends entirely on how much is in your project, on my current newish project like a few seconds

rich adder
#

feels like its gotten slower if anything

queen adder
#

mine is 5 mins on first script written

#

unity 21

steady isle
#

if im just using vscode to code a game what should i aim for

queen adder
rich adder
summer stump
eternal needle
rich adder
#

Cpu difference

#

prob

queen adder
eternal needle
#

yea same project, we are working together

rich adder
#

yeah my 2014 macbook somehow opens projects faster than my new gaming desktop πŸ€·β€β™‚οΈ

queen adder
#

i dont even really mind opening times, the compilation is more important

rich adder
#

its the same with compiling for me

#

my shitty laptop somehow compiles it faster

#

could be that macos is more efficient than windows tho

queen adder
#

πŸͺŸ 🍎

eternal needle
#

if any of you finds anything more about it, id love to know what causes or fixes it. to pass onto my friend or just incase it happens to me in the future

queen adder
#

I cant even think of any reason how a better pc perform worse than yours

steady isle
#

my vs code is bugging

queen adder
#

dont think ive seen a setting for any relevant

steady isle
#

nothing is auto filling and i cant do anything for the console

rich adder
steady isle
steady isle
rich adder
rich adder
#

CLI = Command Line Interface

#

dotnet new console

#

if you have C# Devkit it should load the Solution Explorer

summer stump
# steady isle

What is it even supposed to autofil? There isn't a language extension

steady isle
#

i selected it

rich adder
#

that wont work

steady isle
queen adder
#

configure ide if you want autocompletion

rich adder
#

!vscode

eternal falconBOT
#
Visual Studio Code guide

If your IDE is not underlining errors in red or autocompleting code,
please configure it using the link below:

https://on.unity.com/vscode

steady isle
rich adder
#

no wonder your font screenshot was weird lol did you have a Visual Studio skin on VScode

#

yes Indeed

steady isle
#

wat

rich adder
#

doesnt hurt to configure both, but VS is superior

#

VScode is buggy

scarlet skiff
#

why wont htis work bro

#

it simply ignores the size of the list

slender nymph
#

Console.WriteLine does not write to unity's console

rich adder
eternal falconBOT
steady isle
#

not console.writeline

rich adder
#

yea

summer stump
#

Or print, but that doesn't enjoy the second parameter of Debug.Log

Edit: @queen adder ?

steady isle
#

how do i get it to be c#

steady isle
#

in vs

#

code

summer stump
queen adder
rich adder
slender nymph
summer stump
rich adder
rich adder
#

one of those cases where short != better

steady isle
#

im tryna use just vscode and do some simple c# console stuff

summer stump
#

Definitely not better always, but not worse either. It just is a thing...

queen adder
rich adder
steady isle
#

and more

rich adder
#

Unity extension install C#Devkit

steady isle
#

its just bugging

steady isle
rich adder
#

so did you create new console app like i said ?

rich adder
#

in terminal

queen adder
#

now that i think of it, i could have just added the method in that case lol

steady isle
rich adder
#

do you know what Terminal window is ?

steady isle
#

forgot that was the first step lmao

#

what i do after

rich adder
#

open program.cs it Should open solution explorer if you did everything correct

summer stump
rich adder
fierce shuttle
#

There are also C# focused servers if your not working in Unity, I believe one was linked earlier that may be worth joining

queen adder
#

unity uses C# right?

summer stump
queen adder
#

thought so

steady isle
queen adder
#

https://gdl.space/liteliyiti.cpp
I am trying to get it to add 10 to the money but it seems to be adding a lot more as if its adding 10 then multiplying The multiplier will eventually become a different number but I ave tried a few different ways but I cant seem to get it to work

#

im new to c# I guess failure is the best way to learn

summer stump
languid spire
queen adder
#

right but I cant seem to get it to just add 10 I have tried money += multiplier but it stops at 10 and wont increase

quiet dune
#

I dont realy get Quaternions... Is there a direct way to just rotate an existing quaternion by a certain degree around a certain axis without having to take the whole thing apart and building a new one?

oblique gale
#

should I make my UI a prefab? or save it as a scene? how do I make this modular?

languid spire
#

which variable contains 10 ?

summer stump
queen adder
queen adder
quiet dune
north kiln
quiet dune
steady isle
summer stump
rich adder
steady isle
charred fossil
summer stump
# steady isle How I do that

This is not a unity issue. Ask in the c# server
And it's not really testing what you know if you're asking at every major step. No offense

charred fossil
# charred fossil https://paste.ofcode.org/bGCfmYgMnS4dAPCyc7GPPW

Just to reiterate, I would really appreciate some help with my code. I am pretty new to unity and so debugging has been quite difficult. For some reason, even if I start my character on the floor, if I use wasd to move it teleports the character up 2 in the air and I have no idea why. Any help would be really greatly appreciated.

rich adder
#
 string potatootomato = Console.ReadLine();
     Console.WriteLine("Would you like to cast potato or tomato?(type in lowercase)");```
steady isle
#

i know how to fix that

#

i put it after that console.writeline

rich adder
#

alr now go to some courses, some good ones pinned in this channel

queen adder
#

https://gdl.space/ikozexudic.cpp
im getting the error Object reference not set to an instance of an object unsure what is meant by this but happened since I added MultiText

rich adder
slender nymph
#

don't forget to assign your references in the inspector

queen adder
queen adder
rich adder
#

MultiText is null, so you never assigned in

slender nymph
eternal falconBOT
#

:teacher: Unity Learn β†—

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

rich adder
#

which you do in this case by the inspector like they said

steel shale
queen adder
rich adder
#

inspector is a fundamental thing you should've learned

slender nymph
#

you started unity today and you claim to have done enough starter courses to branch off to your own projects? lol

#

and no, random youtube tutorials that just tell you exactly what to do but not why you should do it do not count as beginner courses

queen adder
#

no no I am using some amounts of what I have learnt this is a very basic one I click a button and it adds a value

steel shale
#

ah so this is your first day trying your own thing instead of just a unity course

queen adder
steel shale
queen adder
steel shale
#

ah nice, that is progress

#

I started those courses in January, it was tough at first but you'll burn through them

queen adder
#

I mean I am only doing this to learn the basics as of now not expecting to create a million dollar game but more a project I can use to reflect on the progress I have made in the future

steel shale
#

that is a good way to go about it, BUT, at this point early on, you will learn so much each day that you'll find yourself constantly re-doing your personal project as you learn new things

#

trust me, i did the same thing haha

rich adder
#

this will show the essentials like working with the inspector

queen adder
swift wedge
#

Please help: OnCollisionEnter2D not working. But both game objects clearly touch visually.

hey I have two 2d game objects, invader and target

the invader game object has a box collider 2d, and a rigidbody 2d that is kinematic

the target game object just has a box collider 2d and a target script

"is trigger" IS NOT ON the box collider components of the game objects

I have this code in the target script, and when I press play, nothing fires from this function.

`private void OnCollisionEnter2D(Collision2D collision)
{
Debug.Log("hello");

if (collision.gameObject.CompareTag("invader"))
{
    Debug.Log("collision inv");
}else{
    Debug.Log("collision else inv");
}

} `

queen adder
rich adder
steel shale
rich adder
swift wedge
queen adder
raw hamlet
#

what is the best way to store data for a small object and only one object will use it?

slender nymph
rich adder
swift wedge
raw hamlet
slender nymph
slender nymph
swift wedge
rich adder
swift wedge
raw hamlet
swift wedge
#

thank you all!!

rich adder
raw hamlet
rich adder
#

that depends on your project lol

raw hamlet
#

ok

ionic zephyr
#

here

slender nymph
#

!code

eternal falconBOT
rich adder
#

just edit it in the original message

ionic zephyr
rich adder
#

put link

#

or not..

summer stump
ionic zephyr
#

oh i had post it in unity talk channel talking to navarone

#

my issue is that i dont know how to do an action only when the down arrow button is pressed

#

but whenever i put this code it takes a while to detect

#

the input

summer stump
#

It should be called on the exact from you press the down arrow (and only that frame) πŸ€·β€β™‚οΈ
The other ones should probably be if statements, not if else though

slender nymph
summer stump
#

Ohhh, it was way over on the right, so I didn't see the down arrow on that check.

ionic zephyr
#

so the fix should be to change else if to iff

slender nymph
#

huh?

summer stump
ionic zephyr
#

ok, let me be clear

slender nymph
# ionic zephyr so the fix should be to change else if to iff

is this not about the last if statement that is not an else if? or have i got the issue mixed up because you didn't bother posting it with your code and haven't fully explained exactly what you are trying to do compared to what is actually happening?

summer stump
ionic zephyr
#

I have this code in which if GetButtonDown, something occurs and if GetButtonUp the action stops. However, whenever I play the game, the downarrow input takes a bit to be recognized

summer stump
ionic zephyr
#

why does that make the difference?

slender nymph
polar acorn
ionic zephyr
#

Okay, then why does it take time to recognzie the imput?

summer stump
#

Show the actual methods being called.

polar acorn
ionic zephyr
#

ooooh i see

#

lets see what happens

#

nope, it still takes time to react

#

but the IDLE only starts whenever there isnt ANY input AT ALL right?

polar acorn
#

Then you're going to need to post the full code and explain what you're expecting to see happening instantly but isn't.

slender nymph
polar acorn
ionic zephyr
#

so what is the code i should put

#

if (!Input.GetKey(KeyCode.RightArrow) && !Input.GetKey(KeyCode.LeftArrow) && !Input.GetKeyDown(KeyCode.DownArrow))
{
_myManoloMove.IDLE();
}

#

this is the code

polar acorn
#

That's the same code you had before, did you change anything?

ionic zephyr
#

nono im only asking what should i modify

polar acorn
ionic zephyr
#

so GetKey instead of GetKeyDown?

#

i really dont understand

teal elk
#

get key down is the one you want to use , i think.

muted wadi
#

do i need to add a return to a while loop if i want it to keep running

rich adder
#

return exist out the whole function
break is to only stop loop

summer stump
teal elk
summer stump
ionic zephyr
#

i want idle as soon as getkey up

#

the problem is that the downarrow input takes a while to be actioned

summer stump
muted wadi
#
{
    while (!hasSeenPlayer)
    {
        enemyAgent.SetDestination(pp1.position);
        currentPP = pp1;
        if (distFromPP <= 1)
        {
            enemyAgent.SetDestination(pp2.position);
        }
        else continue;
    }
    
}``` @rich adder so if i write continue then it'll just return to the top and run it again right?
ionic zephyr
rich adder
# muted wadi ah gotcha

oh misread what you said, thought you were talking about a for loop myb
you mean you want infinite loop or something

#

you dont need anything for while loop to keep running

muted wadi
#

oh

rich adder
#

(ofc assuming the () condition doesn't end it)

summer stump
summer stump
ionic zephyr
#

yes okay but that still doesnt fix the input beign recognized after a while

rich adder
#

to end it pre-mature without if condition you would just put break to end the while loop @muted wadi

summer stump
ionic zephyr
#

yes

summer stump
slender nymph
muted wadi
#

also im trying to write a script that takes the positions of 4 patrol points (assigned in the editor), and make the navmeshagent move from 1 to 4 indefinitely unless the player activates the hasSeenPlayer bool. I'm not really sure if the way im doing it is efficient at all.

ionic zephyr
#

this is the full code

rich adder
ionic zephyr
#

of the input manager

slender nymph
#

and share the class where those methods you are calling are actually implemented

ionic zephyr
muted wadi
slender nymph
slender nymph
ionic zephyr
short hazel
ionic zephyr
slender nymph
muted wadi
#

well thanks i guess, didn't know my loop was gonna blow up unity

short hazel
#

You need to put the loop in a coroutine and yield in it

ionic zephyr
#

please i need some help

short hazel
#

Yielding allows Unity to render the next 1+ frames, thus not freezing

muted wadi
#

ok i'll give that a shot and inevitably come crawling back once i've pulled out enough of my scalp

slender nymph
# ionic zephyr i have been clarifying it since I enterde this chat

lol no you haven't. you keep repeating the same vague nonsense over and over. "it doesn't react" doesn't actually say anything about what behavior you are experiencing versus what is actually happening. but that's also not even what i was referring to there.
but you can stop pinging me now. you don't want to actually answer questions or provide the information that has been requested of you so i'm blocking you and will not be helping further πŸ€·β€β™‚οΈ

teal elk
ionic zephyr
#

okay, give me the last opportunity okay

ionic zephyr
rich adder
# muted wadi i understand coroutines, not sure how to add a loop to it tho

something like this maybe ```cs
public Transform[] waypoints;
int currentIndexWaypoint = 0;
IEnumerator GoTowaypoints()
{
while(patrolling)
{
if(Vector3.Distance(transform.position, waypoints[currentIndexWaypoint].position) < 1)
{
currentIndexWaypoint = (currentIndexWaypoint + 1) % waypoints.Length;
}

        if (seesPlayer)
        {
            patrolling = false;
        }
        //go to waypoint 
        yield return null;
    }
}```
summer stump
ionic zephyr
summer stump
#

Lavanta
IDLE
etc

ionic zephyr
#

oh ok

summer stump
ionic zephyr
last grove
#

my character controller no longer moves my character after I made custom gravity

muted wadi
#

im quite awful with loops right now

rich adder
#

I would not use a while loop there tho

verbal dome
slender nymph
# teal elk I'm currently working on a Unity project and I've encountered an issue where my ...

i would recommend instead of raycasting the ground (since that not only requires a collider so it won't work if your mouse is not over a collider on whatever layer your groundMask is on but also may end up at a different elevation from the player), i would instead raycast against a plane using the player's position and up direction.
here is an example: https://unity.huh.how/screentoworldpoint#using-a-plane

muted wadi
last grove
# verbal dome Ok. What did you do exactly?

I wrote custom gravity that adds a force to the rigidbody dependng on which gravity fields the player is intersecting with. Haven't change anything with the character controller but now it won't move

rich adder
last grove
teal elk
summer stump
# ionic zephyr oh ok

Does the other animation state have an exit time?
Now that I see it, it seems like an animation issue

verbal dome
ionic zephyr
#

the "agacha"?

verbal dome
#

You should pick either one

summer stump
last grove
#
        
        if (onGround)
        {
            rb.AddForce(moveDirection.normalized * moveSpeed * 10f, ForceMode.Force);
        } 
        else 
        {
            rb.AddForce(moveDirection.normalized * moveSpeed * 10f * airMultiplier, ForceMode.Force);
        }```This is for the player movement
ionic zephyr
verbal dome
last grove
#

rb.AddForce(gravity, ForceMode.Acceleration);This is how the gravity is applied which is from this gravity = CustomGravity.GetGravity(rb.position);

last grove
ionic zephyr
#

i see

#

yes it has

last grove
#

I checked and the script for movement is registering input

ionic zephyr
#

Should I uncheck it?

verbal dome
last grove
#

definitely possible

verbal dome
#

sources[i].GetGravity is still a mystery

last grove
#

its just adding it all together based on influence by distance

verbal dome
#

Oh so it's recursive? πŸ€”

verbal dome
last grove
verbal dome
#

I see. That doesn't really make sense to me

#

If you have 5 sources, your gravity will be 5x from normal

summer stump
verbal dome
#

Or something

ionic zephyr
#

thanks for the patience

last grove
ionic zephyr
#

Now, does somebody know how to reduce the collider of my object if it crawls?

verbal dome
#

Normally gravity is negative Y

#

Maybe explain what is the purpose of this system?

#

And what kinda game

last grove
verbal dome
#

Changed what to negative, exactly?

last grove
tender stag
#

why am i getting this?

#

'Random' is an ambiguous reference between 'UnityEngine.Random' and 'System.Random'CS0104

last grove
#

they should be getting converted to negatives either way

tender stag
summer stump
# tender stag

Both namespaces have that Random class
using Random = UnityEngine;

verbal dome
last grove
#
    {
        Vector3 up = transform.up;

        float distance = Vector3.Dot(up, position - transform.position);
        if (distance > range)
        {
            return Vector3.zero;
        }

        float g = -gravity;
        if (distance > 0f)
        {
            g *= 1f - distance / range;
        }

        return g * up;
    }```All of the planes use this getgravity method
summer stump
tender stag
#

wait what do you mean

summer stump
verbal dome
#

It doesn't know which Random you want to use

tender stag
#

oh

#

so i just write like UnityEngine.Random?

verbal dome
summer stump
last grove
tender stag
#

oh alright

#

thanks

summer stump
# tender stag thanks

Oh wait. Should be using Random = UnityEngine.Random;
(Or System.Random if you want...)
Sorry

fast oracle
#

Is there a certain wait to enable certain attributes only if one box is pressed?

#

checked

verbal dome
#

You mean like, in the inspector?

fast oracle
#

yeah

verbal dome
#

Or make a custom editor script

fast oracle
#

Okay, Thanks!

#

Is there an attribute for a drop down menu

#

like this?

verbal dome
#

enums will draw like that automatically

#
public enum BodyType
{
  Dynamic,
  Kinematic,
  Static
}
[SerializeField] BodyType bodyType;```
As an example
fast oracle
#

thanks

last grove
verbal dome
#

I still have no idea how your game works/is supposed to work though

verbal dome
#

Is that code on the plane?

#

Is it an airplane?

last grove
#

that's to check if the player is within the range of the planes gravity

verbal dome
#

It says distance, but it's really a dot product, kinda confusing

last grove
#

its some weird math

verbal dome
#

Did you write it?

last grove
#

I followed a tutorial for all of this

#

I also found that the playermovement script is not actually registering any input from the player

ionic zephyr
#

How can I reduce the size of my colldier when my player crouches without loosing its position?

verbal dome
ionic zephyr
#

how can i do that?

verbal dome
#

What collider is it?

#

Anyway it probably has a .center property so use that.

ionic zephyr
#

boxcollider2d

#

i changed both offset and size, is that okay?

verbal dome
#

Oh yeah it's offset, not center for 2D colliders

#

Yes, as long as you use the correct values

#

So if you reduce 0.5 from size Y, you should reduce 0.25 from offset Y (if my brain is braining correctly atm)

fast oracle
#

will it start another courtine before the first one finsihes

verbal dome
#

A clean way to do it would be something likecs float crouchTarget = crouching ? 1f : 0f; // A "smoothed" value that moves between 0 and 1 depending on your crouch state float crouchTransition = Mathf.MoveTowards(crouching, Time.deltaTime * someSpeedFloat); // Apply offset boxCollider.offset = Vector3.Lerp(standOffset, crouchOffset, crouchTransition); // Apply size boxCollider.size= Vector3.Lerp(standSize, crouchSize, crouchTransition);
@ionic zephyr

#

stand/crouchOffset and stand/crouchSize are Vector3's that you would adjust to your desired values

sick star
#

public GameObject[] Array;

public void ExecuteArrayScripts()
{
    Array[].gameobject.GetComponent<ScriptIwantToExecute>().Function();
}

How can I execute a function from every gameobject in the array?
I tried doing Array[Array.Length] then that but it didnt work

polar acorn
#

Also, if you have a script you want to reference, you should use that type instead of GameObject

sick star
young warren
dense cargo
#

Thanks πŸ˜…

royal osprey
#

Does this code good?
I make a cards (units) there will be much of units and maps, so, I made it to make easier card works (hope) in theory I will not be need to set for every card/map their objects
(Sorry for my English, sorry)

dense cargo
#

The really long variable names make it hard to read.

teal viper
#

I don't like that naming convention...πŸ˜…

#

Maybe it would be easier if you use the C# naming conventions

raw hamlet
#

How do I change this text using code?

#

Is it different from doing it with the Legacy text?

polar acorn
raw hamlet
#

Thanks

raw hamlet
#

It only finds the component from the gameobject the script is attached to right?

charred spoke
#

Yes

raw hamlet
#

Ok thanks.

summer stump
royal osprey
sterile igloo
#

how do i create signals like they do in godot

teal viper
oblique gale
#

so, should I make my UI a Prefab or a Scene? some say a scene but some say prefab. The thing is I'm going to use the same ui for all the levels. What should I do?

rich adder
oblique gale
pine bay
#

hey, mr. navarone, i do change my code about inventory like this https://gdl.space/imedihupix.cs and finally it save to .json. But i have a problem in my LoadInventory, i want instantiate a game object based on item tag that i save, i already move my prefab to resources folder and it always said prefab not found.

topaz gorge
#

You can also make a IDManager that applied ID values to each item in your game using a for loop to make your life easier

pine bay
topaz gorge
# pine bay is scriptable object made for each itemprefab? for example there is prefab A and...

Well you can make seperate scripts, like one for Items that hold things that are gonna be common between all your items, and if theres a special item make a seperate script that derives from that to give it special values and so on. And the same would go for the weapons. EX: So you would make a base Weapons script that hold common thing between weapons, like they all have a name, icon, description ex. then make a meele script that derives from that and add like physical attack damage and so on, and you can do that with bows, magic powers and so on

#

i can provide example scripts if need be

pine bay
topaz gorge
#

!code

eternal falconBOT
pine bay
topaz gorge
#

nope theres not attaching

#

https://gdl.space/podoxoyoxa.cs
So in this one at the top i did a create asset menu, so inside where you have your folders and so on, you would right click go to create and find the defined name that you have given it which is this for mine "Items/Weapons/Melee Weapon" and create a new asset and fill in the required information, including dragging in the prefab, all this does is holds a item or weapons Data to be used anywhere

#

and allows you to make multiple weapons and items super quick

topaz gorge
pine bay
topaz gorge
cold bluff
#

I'm currently following a tutorial but I think VScode doesn't understand this line and I'm not too sure what I did wrongly when setting up 😭

cosmic dagger
#

did you count your parentheses?

fierce shuttle
cold bluff
#

I think i set it up wrongly? i checked everything else and they matched exactly the same as the video

cosmic dagger
#

i meant, what error are you receiving, if any?

cold bluff
#

no error but unity isn't applying that code

silver dock
#

how do i figure out why calling out this method is enabling a gameobject in my scene which i dont want it to be enabled yet

cosmic dagger
cold bluff
#

yeah πŸ˜“ sorry i just started today

cosmic dagger
cold bluff
#

mhm

#

the if statement is connected to making the object float

cosmic dagger
#

where is this code placed (within the class/script file)?

cold bluff
#

uhsh

cosmic dagger
cold bluff
eternal needle
cosmic dagger
#

did you copy the tutorial exactly? i see a mistake on the if statement line . . .

cold bluff
cosmic dagger
#

welp, now you know about it . . .

silver dock
#

is there any way to figure in unity which line of code is enabling the object?

eternal needle
#

Also what gameobject, what's the objects relation to this script

cosmic dagger
#

you can check if the GameObject activated has any relation to the GameObject this script is attached to or the code being called . . .

silver dock
cosmic dagger
#

why isn't your health text only the numbers? just split "Health" into a separate text component and the actual health value in its own text component . . .

cosmic dagger
#

true, but it's all over the code you sent . . .

silver dock
#

well any clue on whats causing the object to be enabled?

cosmic dagger
#

hard to find. we only the method snippet and the methods it calls to. check the object and see if any scripts have a reference to it . . .

silver dock
cosmic dagger
#

click on GameObjects with scripts and check the reference fields . . .

#

or think of the last thing you changed. work backwards from the work you've done. you have to reverse engineer the problem . . .

silver dock
#

Cant find anything man

young warren
#

then look for ones that pass in true for that

cosmic dagger
#

then look for the method that activates a GameObject in your IDE . . .

silver dock
cosmic dagger
#

place a log in the method that activates it, then you can highlight the log from the console and look at the strack trace to see where it gets called . . .

young warren
#

you should learn how to identify which code is being run, be it through logging or using the debugger

silver dock
#

FIxed it, thanks for the help guys

gray flower
#

im trying to export a scene assetbundle but for some reason it keeps crashing. there are no missing scripts is what i know. but idk whats wrong
crash:

[Assets/Editor/ExportAssetBundles.cs line 15]


=================================================================
    Native Crash Reporting
=================================================================
Got a UNKNOWN while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

=================================================================
    Managed Stacktrace:
=================================================================
      at <unknown> <0xffffffff>
      at UnityEditor.BuildPipeline:BuildAssetBundlesInternal <0x000a7>
      at UnityEditor.BuildPipeline:BuildAssetBundles <0x0008a>
      at UnityEditor.BuildPipeline:BuildAssetBundles <0x0006a>
      at ExportAssetBundles:BuildAllAssetBundles <0x00062>
      at System.Object:runtime_invoke_void <0x0007c>
=================================================================
Crash!!
#

nvm i found the issue

silent vault
#

Hello, not sure this is the best channel to ask but how would I go if I wanted to have this bed be a trigger collider while still using its mesh? I'm creating a toy war game where you control a small soldier and you can walk on the bed and I'd like the player to be able to go through the holes in the frames. But at the same time, since the player can shoot bullets, I'd like the bullets to get destroyed when they hit any part of the bed. Following tutorial video, it seems I need to use a trigger collider. But when I add a mesh collider, the trigger option is only accessible when I check the is convex option which mess the shape of the bed. So is the only solution to add several box colliders manually or is there some better way to handle this?

oblique ginkgo
#

Gotta use convex or box colliders unfortunately afaik.

silent vault
young warren
#

you should share what the error says in the console log. it's too tiny in that screenshot

#

and please dont crosspost

#

try googling "Unknown error occurred while loading scene unity"

sonic remnant
#

oh i deleted it there. sorry!

#

Should we go to that channel?

young warren
#

forget it

#

just google that. i found some posts on it

mighty moat
#

GameObject.FindGameObjectsWithTag
Can I use this to find a PREFAB ( that hasn't been instantiated? )

oblique ginkgo
#

no

mighty moat
#

targetUI = (Instantiate(Resources.Load("BattleTarget") as GameObject));

#

I figured it out, TY

solemn fractal
#

Button position problems.

real herald
#

Hey there, I was wondering whether or not Photon Unity Networking (2.0) is P2P or if Photon has their own servers that they use to handle your games when you use their free package?

eternal needle
cold bluff
#

wondering why Visual Studio is not automatically suggesting code for Unity even though i have it selected under the external script editor

eternal needle
eternal falconBOT
mighty moat
#

I'm having trouble here

TextMeshProUGUI dmgTxt = floatDmg.GetComponentInChildren<TextMeshProUGUI>();
damage.ToString();
dmgTxt.text = damage;

cold bluff
gaunt ice
#

what is damage.ToString()? there should be a compile error?

fossil drum
trail heart
# cold bluff D: i don't have the option to modify

The option to "add modules" may be missing if you've installed your editor from not within the Hub
Anyway it's not necessary to install VS through the "modules" if you install it / have installed it independently, like the note in the instruction page implies
But it's also an option to you to reinstall the editor through the Hub and check the VS module during that installation

vast vessel
#

(my agent is using root motion animations for movement)

#

(ps : i think this is more of a code problem then a ai problem so im putting it here)

fossil drum
# vast vessel hey guys do you know what is making my animations so jerky? the float values of ...
        // Low-pass filter the deltaMove
        float smooth = Mathf.Min(1.0f, Time.deltaTime / 0.15f);
        smoothDeltaPosition = Vector2.Lerp(smoothDeltaPosition, deltaPosition, smooth);

        // Update velocity if time advances
        if (Time.deltaTime > 1e-5f)
            velocity = smoothDeltaPosition / Time.deltaTime;

        animator.SetFloat(animator_DX_param, velocity.x);
        animator.SetFloat(animator_DY_param, velocity.y);

This part is strange to me, not even sure what you are trying to do here.
Lerp means you Linearly Interpolate between 2 things, in this case smoothDeltaPosition and deltaPosition, both are changing constantly, and your smooth is changing constantly and not in a good way.
So you pick a point between 2 points at somewhat random.

neon ivy
#

what datatypes does a button's OnClick event support? I'm trying to use an enum but I guess it doesn't support that

vast vessel
#

its unity official manual on how to use ai with root motion animation

#

i dont even know what it does

solemn fractal
#

hey guys, how can I access inside a scriptable object the collider button to control the size of the collider ? I have an enemy prefab and use the a scriptable object to control things like HP, attack damage etc.. but each enemy is dif in size, how can I control the size of the collider for each?

hexed terrace
#

by having the collider on the prefab for the enemy πŸ€”

solemn fractal
#

i have it. but each enemy i spawn is dif in size, controlling the size via scriptable object and also sprite..

#

they need to have dif collider size.. but I cant control individually only in the prefab..

#

but in the prefab its one size for all

fossil drum
ivory bobcat
#

If the code is identical to the doc, the error lies with the animation setup and not with code

vast vessel
#

also ive tried the animations in play mode on a model without any scripts attached and that works fine too

#

the blending, the looping

#

also there isnt a race condition happening with the agent and animator as far as i can tell

#

ive disabled the agents update position just like the docs said

swift wedge
#

When I click overrides -> apply all on an instance of a prefab, it doesnt apply the changes to the prefab!

does anyone have an idea of what's going on?

it doesn't seem to be able to reference the game objects from the prefab, but knows how many there are in each array

tender stag
lofty sequoia
#

helpppp

using System.Collections;
using System.Collections.Generic;
using UnityEngine;


public class Pickaxe : MonoBehaviour
{
    [SerializeField] private float range;
    [SerializeField] private float cooldown;
    public Camera mainCamera;

    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            StartCoroutine(farm());
        }
    }

    IEnumerator farm()
    {
        Debug.Log("Attempting to mine");

        Ray ray = mainCamera.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;
        yield return new WaitForSeconds(cooldown);

        if (Physics.Raycast(ray, out hit, range))
        {
            if (IsMiningNode(hit.collider.gameObject))
            {
                Debug.Log("Hit " + hit.collider.gameObject.name);
                // Add your mining logic here
            }
        }
        else
        {
            Debug.Log("No hits");
        }
    }

    private bool IsMiningNode(GameObject obj)
    {
        return obj.CompareTag("coal") || obj.CompareTag("gold") || obj.CompareTag("ice");
    }
}

Assets\Scripts\Pickaxe.cs(24,30): error CS1061: 'Camera' does not contain a definition for 'ScreenPointToRay' and no accessible extension method 'ScreenPointToRay' accepting a first argument of type 'Camera' could be found (are you missing a using directive or an assembly reference?)

gpt and documentation says that it exists?

tender stag
#

if gpt says then it must be true

lofty sequoia
#

nah i just had to double check

gaunt ice
#

Do you have a custom class called Camera?

tender stag
lofty sequoia
#

no

lofty sequoia
#

thought i missed something so i told it to rewrite it

#

omg i just realised what the error is

#

mb

fossil drum
# tender stag

You Lerp towards your rotation, so there is a delay.
If you move real fast, you go backwards to the same rotation, because that's closer to the desired rotation.

tender stag
#

its not that

#

look

#

i thought of that as well

#

wait actually it might be

#

my bad

tender stag
#

maybe the speed of the rotation

fossil drum
#

You could have a float value outside of your rotation for example, and Lerp towards that float. So if you have a float with 3600, it will rotate 10 times towards the right.
And you make a rotation based on that float.

tender stag
#

but after 10 times same thing would happen

fossil drum
#

No, if you want to rotate to the right another 10 times, your float would be 7200

tender stag
#

i did this

#

limited the speed of the rotation

#

clamped it

fossil drum
#

Perhaps that works too. I don't know how that fares with different FPS for example.

tender stag
fossil drum
#

Looks good

mighty moat
#

HealthBarScript has:
public void UpdateHealthBar(int CurHP, int MaxHP) { slider.value = CurHP / MaxHP; }

Unit/Player/AI/Enemy has:
private void UpdateHealthBar(){ if (healthBar) {healthBar.UpdateHealthBar(CurHP, MaxHP);} }

...and...

public void TakeDamage(float damage){
curHP -= Mathf.RoundToInt(damage);
healthBar.UpdateHealthBar(CurHP, MaxHP);
}

BUT My HP bar doesn't work, what went wrong, this was 100% functional yesterday

wintry quarry
mighty moat
#

I can see my vars curHP and maxHP and they work fine

#

but the HP BAR Doesnt ddraw the vars accurately ( very wrong drawing )

#

and its simple code

slider.value = curHP / MaxHP;

this worked 100% yesterday

gaunt ice
#

i believe it wont work
your curHP should be always < MaxHP and return 0

mighty moat
#

my curHP = maxHP at the start

#

ONce taken DAMAGE ... My CurHP should be .. = MaxHP-Damage=CurHP

#

CurhP shouldnt NEVER be 0 (unless chaaracter is dead

fossil drum
#

curHP and MaxHP both integers?

mighty moat
#

yeah both INTs

fossil drum
#

Then you are doing an Integer division, and always get an Integer back.

#

So its probably always 0 or 1

mighty moat
#

that should have been obvious, thank you

#

So I need to convert Cur + Max to Floats?

fossil drum
#

Or cast one of the values to a float.

mighty moat
#

or can I draw HP bar with INTS?

#

so I can make it work if only 1 var is Float ? thats easy

fossil drum
#

slider.value = curHP / MaxHP / 1.0f; should also work, as long as 1 of the values is not an int, it will do a float division.
(Kind of janky to do it this way)

mighty moat
#

I made my maxHP a float, and left my curHP as an INT

#

It now works 100%

fossil drum
#

πŸŽ‰

mighty moat
#

TYVM bro!

tender stag
#

i've got this name text

#

and i need to make it move with the head

#

how do i do that?

tender stag
#

the actual character is just below the map

#

the target would be the head and name would be the text

#

this doesnt work

noble depot
#

why am I getting this error? my script has no compile error

keen dew
#

Remove the script from the object and add it again

unreal whale
languid spire
keen dew
noble depot
silk night
noble depot
#

no... I didn't know that was needed

#

yes ok that fixed it now

silk night
#

You can potentially have multiple classes in a file so unity doesnt know which one to select

#

So its done based on file name

noble depot
#

gotcha, thank you

distant mesa
#

Reference rewriter: Error: method System.String System.Web.HttpUtility::UrlEncode(System.String,System.Text.Encoding) doesn't exist in target framework. It is referenced from RestSharp.dll at System.String
Does anyone know how to solve this issue? got like 10 of these kind of errors regarding RestSharp when building

tender stag
#

and calculate how much the head moves from its original position

#

and apply those values with a multiplier to the text

honest ore
#

Hello, using XRInteractionToolkit I'm currently trying to figure out a way to check if an object has been placed in the XRSocketInteractor, what I am trying to achieve is a way to set the parent of the object that has been placed in the Socket to be the object that has the XRSocketInteractor as a child

unreal whale
#

You need to convert the head world coordinate to screen coordinate.

tender stag
#

im so confused

unreal whale
#

Camera.main.WorldToScreenPoint(targetPosition)

#

targetPosition is head position

#

and result is head position on your screen

tender stag
#

but the head is there

unreal whale
#

script

tender stag
#

the text is here

unreal whale
tender stag
#

yeah i have the same thing

unreal whale
#

Replacing rectTransform with transform

tender stag
#

text is still there

unreal whale
#

game view

tender stag
unreal whale
#

You can't see the character's head, of course the text will be in that position

tender stag
#

what

#

thats why i said i need to keep an offset

#

i need the text to stay in the position its at

#

so in start i should set a defaultPosition

#

and then i just need to add or multiply how much the head moves

#

with a multiplier

unreal whale
#

Did you use two cameras

tender stag
#

i have multiple cameras

#

its detecting the right camera

unreal whale
tender stag
#

yup

unreal whale
#

Replace it with the character's camera

tender stag
#

what is that gonna do?

unreal whale
#

just do it

tender stag
#

text is here now

#

in full screen its here

#

what the hell

#

lmao

rich adder
#

is this UI?

tender stag
#

yes

rich adder
#

you should be using anchors

oak imp
#

Yo anyone know a good way to index transform? Should I just make my own array?

tender stag
rich adder
#

so ?

tender stag
tender stag
#

i have everything setup correctly

#

except the script

rich adder
#

you said the text is moving ?

unreal whale
#

use mesh text instead

tender stag
#

i want it to move with the head

#

like it is right now

#

but its in the wrong spot

rich adder
# tender stag

but I can't tell which one is UI elements and which one is world item

tender stag
#

the text is UI

#

this is UI

#

this is a raw image

#

with a texture

rich adder
#

I see

tender stag
#

from this camera

rich adder
#

you want text to rotate with player ?

tender stag
#

i just want it to move along x and y axis

#

no rotating

tender stag
#

and the neck is here

unreal whale
#

use mesh text

tender stag
#

the bottom circle is the object

tender stag
#

what do you mean mesh text

#

tmp?

rich adder
#

they mean texmesh but its 3D object not UI

tender stag
#

yeah

tender stag
#

and then calculate how much the head moves from its original position to where it is in update

#

and just add that to the text

#

with a multiplier

#

so i can control how much it moves

#

thats what i suggested earlier

rich adder
#

Like an offset you mean?

#

yea try it

tender stag
#

kind of

#

so this

#

and then i need to add the newHeadPosition to the text position right?

rich adder
#

if text is UI dont forget u have to convert it

#

WorldToScreenPos

tender stag
#

what type would convertedHeadPosition be?

unreal whale
#

He has already tried it before

tender stag
rich adder
tender stag
#

'Vector3' is an ambiguous reference between 'System.Numerics.Vector3' and 'UnityEngine.Vector3'CS0104

#

oh alright

rich adder
#

delete using Systsem.Numerics

tender stag
#

yeah i just realised

polar acorn
smoky niche
#

Is using Mathf.Infinity more performance-intensive than using a smaller number?

tender stag
#

does this look fine?

rich adder
verbal dome
tender stag
unreal whale
smoky niche
#

Okay thanks!

tender stag
#

so when the multiplier is at 0

#

the text is there

#

its not at its original position

rich adder
#

looks like its at vector2.zero

tender stag
#

the multiplier was also in the wrong place

#

because i was multiplying the final position

#

and not how much it moves

#

wait no its still multiplying the position

rich adder
#

whats any number * 0

tender stag
#

yeah i know

#

the multiplier works

#

its in the wrong place still

#

its something to do with this name.rectTransform.position = initialNamePosition + convertedHeadPosition;

#

do i need to multiply it?

rich adder
tender stag
#

also yeah

pliant oyster
wintry quarry
#

I can see that at least for keyboard mode, you are setting a Rigidbody velocity, but you also seem to be constantly setting your position to some constant position each frame

pliant oyster
#

In mouse mode, I set the player's X position to the mouse's X position.
The background just continuously goes down before hitting a specified position, then gets set back up.

wintry quarry
#

the BackGroundLogic script only seems to do that "reset" logic

#

it doesn't seem to do the normal movement part

pliant oyster
wintry quarry
#

ok right so this is confusing me because of the transform.position.y - scrollSpeed

#

you seem to be subtracting scrollSpeed every frame with no framerate adjustment

#

meaning it's framerate dependent

pliant oyster
#

Oh!

wintry quarry
#

should be:

transform.position -= Vector3.down * Time.deltaTime;``` for example
pliant oyster
#

Yup, changing it to```cs
transform.position = new Vector2(xPosition, (transform.position.y - (scrollSpeed * Time.deltaTime)));

pliant oyster
#

I have made a slight miscalculation

iron hull
#

Heya, is there a function that allows me to rotate something so it is always facing the cursor sort of thing or is it done with math / what math would i use? hmjj

wintry quarry
#

you don't need to use math but many tutorials will

pliant oyster
#

I'd also like to know

silent haven
#

how do i check if a trigger titled "SlimeAttack" stored in "rslime" animator is triggered

wintry quarry
unreal whale
orchid trout
#

I need to encode a very large state hierarchy of booleans to validate a visual style set in inspector
I thought enum flags would be the answer for this but I can't find a way to make the flag enum have mutually exclusive values.
How do I solve this problem? My XY ask is 'how do I make it so when I hit A, B, or C in the flag enum that the other two get unset'? eg. mutual exclusivity
My deeper question is how do I encode a massive hierarchy of possible states that can or cant exist in conjunction, and store it all in a single place that can be passed around easily, and stored all in such a way that its extremely trivial to expand this?

#

The first time I tried to make this I just added a new enum every time I had a new use case for a new visual state but it rapidly balooned into unusability because there were just too many states, too many use cases with some kind of overlapping mutual exclusivity with some other element of the visual state

twin bolt
#

How do i create a clone of a gameobject foreach string in a list? foreach(string e in Resolutions) { GameObject AnotherChoice = Instantiate(Choice1); AnotherChoice.GetComponent<TMPro.TMP_Text>().text = e; }

#

This is done at start.

wintry quarry
#

what's wrong with it?

#

Assuming these are UI elements I would expect you to be creating these objects as children of some other UI element (e.g. a LayoutGroup of some kind). But this will definitely create the objects

twin bolt
wintry quarry
#

If this code runs, it's creating the object

#

check your hierarchy

#

maybe the list is empty btw

#

which would mean no objects are created

twin bolt
#

Oh sorry, i failed to read the first time.

#

They are definitely there.

#

Thanks for the help.

ripe nymph
#

Hello, i've been learning tilemaps a little bit and got stuck, is there any way to spawn new floor tiles while i run?

ripe nymph
unreal whale
#

Tilemap api

rich adder
timber tide
oak imp
#

Crazy question. Does lists work in unity?

summer stump
oak imp
#

I'm trying to add an element to a list and it seems to just seems to crash my start profiler.

#

Using .Add(item)

summer stump
oak imp
#
    {
        // At the start we can set everything to zero.
        ZeroScoreBoard();
        // Form childListPosition.
        foreach (Transform child in transform)
        {
            childList.Add(child);
            Debug.Log(string.Format("Child List: {0}", child));
        }
        

    }```
#

Something as simple as this

rich adder
#

depends where you spawn it @twin bolt

twin bolt
#

I found the issue the clones are set at scale, 0,0,0.

wintry quarry
rich adder
oak imp
#

Crazy since I can't even get Debug.Log to print.

summer stump
languid spire
#

show declaration of childList

rich adder
#

you prob have a null ref and the game pauses so you think it crashed

oak imp
#

private static List<Transform> childList; As a variable to the class.

rich adder
#

yeah its not init

languid spire
#

yes, not initialised

oak imp
#

Mh i'm stupid thanks

languid spire
#

dangerous to have a static List in a Monobehaviour though

oak imp
#

I mean tbh i only have one instance of scoreboard so this might change, but I am currious as to why it is dangerous.

rich adder
#

make a singleton

languid spire
#

one List containing all the children of all scoreboards, I can't see the point

buoyant knot
#

you need to be very careful with the static keyword

wintry quarry
#

just use a normal list in the scoreboard

oak imp
buoyant knot
#

do you want a singleton class?

topaz gorge
#

Now im trying to make my own culling system by make a grid of triggers based off chunck and map size, and on wake it gets all the objects that are in that chunck, and if the player isnt within a specified range then a for loop iterates through each obhect disabling them, and same for reenabling them when the player enters the chunck would this be effective, i have a feeling that this will cause a performance issue though later on when adding more clutter to each chunck

buoyant knot
#

just take one thing, and copy paste for 10000 things

oak imp
topaz gorge
buoyant knot
# oak imp Appreciate it πŸ‘

to use it, change from:

private void Awake() {
} ```
to
``` public class MyScript : Singleton<MyScript> {
protected override void Awake() {
// DontDestroy = false; // depends if you want to destroy on load
base.Awake();
} ```
sonic remnant
#

can someone help me? My text color is not changing to the color i want:

glass crest
#

Hello, I'm trying to implement native ads in my game but I'm facing an issue:
this is the code for requesting a native ad:

private void RequestNativeAd()
    {
        AdLoader adLoader = new AdLoader.Builder(nativeAdUnitId)
            .ForNativeAd()
            .Build();

        adLoader.OnNativeAdLoaded += HandleNativeAdLoaded;
        adLoader.OnAdFailedToLoad += HandleAdFailedToLoad;
        adLoader.LoadAd(new AdRequest.Builder().Build());
    }
    private void HandleAdFailedToLoad(object sender, AdFailedToLoadEventArgs args)
    {
        Debug.Log("Native ad failed to load: " + args.LoadAdError.GetMessage());
    }

    private void HandleNativeAdLoaded(object sender, NativeAdEventArgs args)
    {
        Debug.Log("Native ad loaded.");
        nativeAd = args.nativeAd;
    }

however, the ad is successfully loading but the function of " HandleNativeAdLoaded" is not working and not debugging.
There's only a debug for the ad being loaded which is this:

rich adder
silk night
opal fossil
#

In unity timeline, it seems like control trsxk can do anything the activation track can do, so what's the point of the control track? Correct me if I'm wrong

safe root
#

!code

eternal falconBOT
glass crest
silk night
#

Once in which timeframe?

glass crest
silk night
#

Is there more events that you can subscribe to? sounds like the network did not have another ad ready for that instance yet

amber dome
#

unity has a lot more physics than I expected

#

lol

wintry quarry
#

Yeah! It has at least THREE physics

amber dome
amber dome
glass crest
amber dome
#

nothing, forget it

wintry quarry
#

Brazilian?

sage mirage
#

Hello, guys! I have an error here in my code. Check what it says:

mainMenuVolumeSlider is null. Cannot load options. UnityEngine.Debug:LogError (object) SettingsManager:Start () (at Assets/Scripts/SettingsManager.cs:30)

amber dome
wintry quarry
summer stump
sage mirage
wintry quarry
#

it has to do with how you are (or think you are) assigning it to something other than null

#

"checking if it's null" doesn't make it not null

#

it just tells you if it's null or not

summer stump
wind void
#

I keep getting this error when opening my andriod game project

Job failed with exception: GooglePlayServices.JavaUtilities+ToolNotFoundException: jar not found.

but i installed the andriod stuff when installing my engine version

sour hound
#

i have some problems with my code; i have two audio sources, one for firing my gun and one sound for reloading

#

however when i initiate the reload sequence the "gunfire" sound is played instead of the reload sound

pliant oyster
#

I have this code for my background:
https://hatebin.com/hkqvhtqpqq
It should move the background down, speeding up more and more until it hits 10000f speed, on the way always teleporting above the player's screen if it gets outside of the visible area. It should then, when it hits 10000f speed, reverse this. Going from the bottom upwards while decelerating at the same speed that it accelerated before. Once it hits 0f, it should go the original way down again, and that repeatedly. For some reason, my code just doesn't work. How do I fix that and make it do what I want it to do?

glass crest
polar acorn
#

Show code

glass crest
sage mirage
#

Hey, guys! Do I have to have my Game Manager, UI Manager, Audio Manager etc game objects as prefabs? If yes why if not why not?

#

I mean if I have to use them on different scenes don't they have to be as prefabs?

sour hound
polar acorn
eternal falconBOT
sour hound
#

!code

eternal falconBOT
sour hound
#

i dont get it

#

do i download the code from there as a file and post it here?

gaunt ice
#

copy and paste your code in one of above websites

sour hound
#

figured it out

polar acorn
#

There's no reason to have two variables

sour hound
#

how do i do it otherwise?

polar acorn
#

Use one audio source and change the clip it plays before playing it

summer stump
sour hound
#

audioclips allows you to use numerous audio's?

#

do i then just change the clip depending on what button is pressed?

summer stump
#

So one per sound

#

Then you pass the one you want to the source and play it