#๐Ÿ’ปโ”ƒcode-beginner

1 messages ยท Page 198 of 1

dapper zenith
#

@teal viper

flat slate
#

i think the problem was that i copied the name of the coroutine from the code you sended in here and unity thought i want to play the old coroutine

#

i try it now

#

no its not

#

damn

visual hedge
#

dammn...:(

teal viper
#

The virtual camera and your character inspectors. A video of the issue might also be helpful.

nimble mauve
#

Hi, I've added a particle effect to my gun but when I shoot and turn around the particle effect doesn't move with the gun, why is that?

flat slate
#

can u start a coroutine inside a coroutine?

#

or will it be buggie?

nimble mauve
#

I want the particle effect to rotate with the gun

flat slate
#

is the particle effect a children of the gun?

nimble mauve
#

yes it is

teal viper
flat slate
#

okay

teal viper
#

Check the particle system manual page.

visual hedge
# flat slate okay

but make sure to set some kind of stopper in the second coroutine if first one is running in Update. I learned this hard way ๐Ÿ™‚ because if first one is run inside update method, it will call the second one each frame or so and well... that's no bueno ๐Ÿ˜„

dapper zenith
#

@teal viper Nevermind fixed the issue

visual hedge
#

@rare basin you still here?

#

anyways...
is this line of code? no idea how to call it... here equal to next one?

string name = 123a;
var go = Resources.Load<GameObject>("GameRes/Model/Character/" + name + "/Prefabs/model" + name);

So will it load that prefab here? Real file location: GameRes/Model/Character/123a/Prefabs/model123a.prefab ?

#

I guess I have to run this one and see ๐Ÿ˜„

languid spire
visual hedge
languid spire
nimble mauve
#

I am following a video and this part doens't make sense. How will this get activted if it's in an if statement?

#

I did the exact same thing and even had a log in it but nothing happened

#

is this video wrong?

languid spire
#

Shooting must be called from somewhere else because it's not called there

nimble mauve
#

that's exactly what I am saying

#

I legit spend 1 hour raging over this part and tried to make sense of it

visual hedge
# languid spire good plan

oh, okay. so it will look explicitly in Assets/Resources + that string folder, not in just Assets/+what my question was. Okay okay, I see. Already helpful ๐Ÿ™‚ Thanks

nimble mauve
languid spire
languid spire
visual hedge
#

can I make my own static Load.GameRes class? ๐Ÿ˜„

nimble mauve
late bobcat
#

!code

eternal falconBOT
languid spire
nimble mauve
languid spire
#

Go and read the docs, that is what they are for

arctic ether
#

Hello so I have a problem. The player model keep dissapearing when when I press play.

vale karma
#

probably dont have deltatime added to some movement, its moving too fast

arctic ether
teal viper
vale karma
#

do you have all the objects in the scene as a child objects?

arctic ether
vale karma
#

try it out now ๐Ÿ˜ฎ

teal viper
arctic ether
teal viper
#

Not the animator, but the animations themselves. Animation clips. That or the rig.

arctic ether
#

Hmmmm i wonder, because in blende the animation are all good

visual hedge
arctic ether
#

is it?

teal viper
vale karma
#

i finally refactored all of my already refactored code into a state machine ๐Ÿ˜„

visual hedge
#

would also kinda explain why you don't see animations )

arctic ether
rare basin
#

you sure the audio source isn't looping?

blazing kite
flat slate
#

i want that just one coin spawns

#

!code

eternal falconBOT
visual hedge
#

yeah... maybe try not putting that camera into player's game object? I dunno what the problem is. I might be just dumb, but I really think it works like a 1st person camera in your case. Sorry if I'm misleading

flat slate
visual hedge
# flat slate

that's what I said ๐Ÿ™‚ You ahve to put the stopper )

flat slate
#

you mean like waitforseconds(1)?

arctic ether
visual hedge
#
private bool actionStarted = false;
    //private IEnumerator YourSecondaryCoroutine()
    //{
        if (actionStarted)
        {
            yield break;
        }
        actionStarted = true;
        //your coooode
        actionStarted = false;
    //}
visual hedge
flat slate
#

thanks bro

visual hedge
#

I mean wrap your secondary coroutine with this one

flat slate
#

yeah

flat slate
graceful citrus
#

my player consists of many colliders and rigidbodies. it all stems from one gameobject. if i use the following code:

    private void OnCollisionEnter(Collision collision)
    {
        if (collision.gameObject.CompareTag("Player"))
        {
            collision.transform.parent = transform;
        }
    }

it will not work. this is because it may be a different part of the player at any point. how would i use this to reference the gameobject it all stems from? pseudocode:

OnCollide { collision.hips.parent = transform}
visual hedge
teal viper
#

!code

eternal falconBOT
flat slate
#

cs lol

flat slate
#

okay

#

thanks

visual hedge
#

what you did were not right )

#
lol
flat slate
#

lol

visual hedge
#

yeap, there you go

flat slate
#

ye

teal viper
graceful citrus
teal viper
graceful citrus
#

its a ragdoll

teal viper
#

that doesn't make sense. A ragdoll consistes of many rb+ colliders and some joints.

visual hedge
flat slate
#

ye

teal viper
#

If you don't have rbs, your ragdoll probably doesn't work.

visual hedge
flat slate
#

the problem was that the enemy was destroyed before the coroutine was ended

#

so the code were ignored

graceful citrus
#

i just said, none of my colliders do not include a rigidbody

visual hedge
#

ow, okay

graceful citrus
#

they all have rigidbodies

flat slate
#

ye

#

but works now:)

visual hedge
teal viper
#

That's some contradictory statement.

visual hedge
#

loot gravitating to the player after mob is killed is suuuch a nice thing that lacks in many games ๐Ÿ™‚ cudos for you on that one

flat slate
#

thanks man

#

thats it

#

but a bit laggie

visual hedge
#

niceee

#

awesome ๐Ÿ™‚ Okay... I have to go )

flat slate
#

okay bye

graceful citrus
#

none of my colliders do not include a rigidbody

#

so there is 0 colliders

#

which have no rigidbodies

#

meaning all of them have rigidbodies

rare basin
#

what

teal viper
#

Okay, well that doesn't change my answer, does it?

#

The way you said it made me think that it was a typo or just poor wording. I see now that what you wanted to say is that all your colliders have an rb. Which, again, doesn't change what I said.

earnest atlas
#
        Instantiate(_bullet, _spawnPos, Quaternion.identity);
        _lastShotTime = Time.time;

I have spawn point inside a gun, what rotation is used to spawn the bullet? Considered its supposed to be 0,0

rare basin
#

Quaternion.identity meaning "no rotation"

earnest atlas
#

I see

buoyant knot
#

in math, identity normally means the โ€œdo nothingโ€ operator

#

like 1 is identity under multiplication, 0 is identity under addition, and Quaternion.identity is identity for quaternion multiplication

earnest atlas
#
 void Start()
 {
     _rb = GetComponent<Rigidbody>();
     _rb.velocity = transform.forward * _bulletSpeed;
 }```
Why bullets fall to the ground?
This code runs on bullet spawn
buoyant knot
#

itโ€™s a dynamic rigidbody

#

so it is affected by gravity

rare basin
#

gravity

#

always faster ๐Ÿฅบ

earnest atlas
#

disabled it now to see what happens

languid spire
#

or gravy, always tastier

earnest atlas
#

Speed too slow?

pastel sinew
#

Hello, how can I attach a GameObject to another but have the attached objects transform orientation not change.

earnest atlas
#

Confusion

buoyant knot
blazing kite
#

anyone? ๐Ÿ˜ญ I've also added some checks for the animator and rigidbody to only play sound when he is moving but still. In idle i can hear one StepL and then one StepR

earnest atlas
#

I forgor to add the script

buoyant knot
#

otherwise you would not parent

earnest atlas
#

what collider is best used for bullet?

buoyant knot
#

iโ€™m not sure if I would use a collider

pastel sinew
#

I only want object B to follow object a around, so both have the same transform position but not have the same rotation if that makes sense. Object B should always stay facing up.

earnest atlas
#

Its mostly for trigger, but what should be used then?

buoyant knot
#

if your bullet is an instant beam, it needs no collider

earnest atlas
#

Im still deciding if instant beam

#

or bullet

buoyant knot
#

if it is actually slow, then probably sphere or capsule or rectangular prism

#

in continuous detection mode

earnest atlas
#

Whats difference between dinamyc and speculative are?

buoyant knot
#

that sounds like interpolation mode

#

which i donโ€™t think is relevant here

pastel sinew
#

I want the red sphere to stay in the same position relative to the purple shere. I tried giving the GameObject thats child of ball and parent of Pointer a Rigidbody that only constrains it from rotating but that doesnt work.

nimble hinge
#

Yooo

#

Anybody here?

steel smelt
languid spire
rare basin
alpine glen
#

at the rate Unity staff are quitting, probably not ๐Ÿ˜›

nimble hinge
#

Nevermind

#

Was experiencing screen tearing

#

Just fixed it

sweet osprey
#

How can you convert an AddForce into 'addrelativeforce' without actually using 'addrelativeforce'?
my guess is to multiply the force by Transform.Forward but it gives me an error, and I'm not sure if it will result in what I want anyway:
Vector3 relativForce = new Vector3(myForce * transform.forward);

nimble hinge
#

Simple

rocky canyon
#

relativForce = myForce * transform.forward;

nimble hinge
#

you have rigidbody reference i suppose

rocky canyon
#

why the new()? ur not constructing a new vector.. ur already using a transform.forward vector

nimble hinge
#

Rigidbody.AddRelativeForce

rocky canyon
#

he said he doesnt wanna use AddRelativeForce

nimble hinge
#

Oh i noticed now

rocky canyon
#

ur creating a relative force. ur just doing it wrong

#

remove the new stuff

sweet osprey
rocky canyon
#

force shouldnt be a vector (force as in ur variable force)

#

it should be a float or an int..

#

a vector * a float is totally possible

#

transform.forward * 10f;

sweet osprey
#

Ahh okay, I'll go from there. Thank ya!

rocky canyon
#

but u had the right mindset..

#

if u build a local vector like that. it'll still be a local force

steel smelt
#

@sweet osprey can build a TRS matrix with default scale and then multiply that by your vector if you dont want to multiply every component of your vector manually

arctic ether
#

Hello again, so i finally figure out about why the character keep flying away when hit play, but right now there's two problem. The first is that the model keep stuck under the map and can't move. Second, when I press A or D to move right or left instead of moving right or left, the model tilt right and left instead. Any help would be appreciated.

wintry quarry
arctic ether
#

oh sorry

earnest atlas
#

How to access this? I cant serialize this component cause its not Text, TextMesh, TextMeshPro

earnest atlas
#

_bulletCount.text = value.ToString(CultureInfo.InvariantCulture);

Is this correct way to change value there?

#

the To string part was done by compiler

timid saffron
#

any idea why my cubes colour is stuck at white? (I've waited 2 minutes to see maybe its just pure luck that it always chose white value but i dont think thats the case)

wintry quarry
#

so 2/3rds of all colors you generate with that Random.Range will be white

#

the other colors will be various transparent shades of gray, since you're applying the same value to each component of the color

earnest atlas
#

50 shades of gray cube

languid spire
timid saffron
#

i dont know color codes in c sharp

#

im still looking it up

languid spire
timid saffron
#

well white is 255 gray is 122

#

so i thought 0-3 would be different shades of them

languid spire
#

so you want Color32 not Color

timid saffron
#

i dont know what color32 is to behonest

summer stump
steel smelt
#

@timid saffron Yeah, that is correct. However this color representation is in bytes. Unity has a struct that matches this representation, it is Color32 as stated above.

0 to 3 will be hardly noticeable

timid saffron
#

i found some colour codes they are like #2df7f

summer stump
#

Color32 is colors with values from 0 to 255

languid spire
timid saffron
faint sluice
steel smelt
#

It is a normalized value. Imagine every component are divided by 255

summer stump
steel smelt
#

So "Color" is 0-1 components, where as "Color32" components are 0-255

languid spire
timid saffron
languid spire
#

do you see a pattern emerging here, your refusal to read docs is making your (and our) life more difficult than it need be

timid saffron
#

but not original unity docs

#

found them from another source

languid spire
#

original unity docs are the only ones that count

wintry quarry
faint sluice
timid saffron
#

no here

wintry quarry
#

2 or 3 or 1.67 are not valid

#

they will just be clamped to 1

wintry quarry
summer stump
#

Read the docs

wintry quarry
#

System.Drawing.Color is not UnityEngine.Color

faint sluice
languid spire
#

hey, @timid saffron Forget Unity, switch to Winforms

faint sluice
#

That's sooo much more needlessly complicated for normal use cases

timid saffron
#

guyz chill. one may not know where to look properly if heis a beginner

faint sluice
#

But one refuses

timid saffron
#

yeah they kinda scare me

summer stump
frosty hound
#

Being a beginner is not an excuse here.

steel smelt
#

@timid saffron Unity has its way to deal with colors. You want to learn how to manipulate them within unity since all of the unity components will use that system.

Those ways are a normalized representation of (red, green, blue, alpha), aka "Color" struct, and a bytes representation, following the same order but with 0 - 255 values.

You can use either. Say you wanted to create a pure red color, with the normalized system, you would have (1f, 0f, 0f, 1f), and with the bytes system, you'd have (255, 0, 0, 255).

From that, can you infer how you'd write pure green?

timid saffron
#

yeah i can

#

bytes: (0, 255, 0, 255) color(: 0f, 1f, 0f, 1f)

summer stump
#

Color32

steel smelt
#

What

#

What do you think color32 is made of

summer stump
#

It's important they know what type they would have to write

#

If they wrote public Bytes myColor it would not work
They need to write public Color32 myColor

steel smelt
#

@timid saffron Anyhow, yeah. As stated above by praetorblue IIRC, grays are colors where R == G == B. So just tune your RGB to even values and you'll end up with different grays.

timid saffron
#

๐Ÿ‘

#

we are cool

#

done

#

and heres the bytes version for you

languid spire
summer stump
#

And now we see why I corrected them saying not byte

timid saffron
#

it works

languid spire
#

it's crap

timid saffron
#

no need to be rude

summer stump
eternal falconBOT
languid spire
#

no need to write crap code

steel smelt
#

@timid saffron Yeah, but there's redundant casting. You can declare red, green and blue as bytes instead of floats.

languid spire
#

of course it will byte can only be 0 thru 255

steel smelt
#

@languid spire This seems uncalled for. Why is everyone piling up on this guy?

languid spire
steel smelt
#

@languid spire I have not. I rarely come

#

I wondered if there was a history. If there is, then nevermind me.

faint sluice
languid spire
#

I have never met anyone who would just rather do random stuff than look at a docs page

#

even when that docs page is linked to them

steel smelt
#

Yeah, I understand your point

rare basin
#

there are atlesat 3-4 people daily

#

who prefer that

languid spire
rare basin
#

fair enough

timid saffron
#

sorry ๐Ÿ™ am not asking again

languid spire
autumn tusk
#

importing a variable from the script ShotgunLaunch and for some reason unity hates this script in particular and refuses to identify this script

autumn tusk
#

it only has an issue with this script

#

every other script works fine

polar acorn
autumn tusk
#

yeah, thats my script im trying to connect

polar acorn
#

Show it

hexed terrace
#

show this class

autumn tusk
#

ok found the error

#

basically, instead of the class being called "ShotgunLaunch", it was called "Player" instead

#

that fixed my issue

polar acorn
#

Yes, in order to use a class of a specific name that class must first exist

swift crag
#

C# doesn't care about filenames at all, mind you

#

Unity is the one that demands that your class and file names match when defining MonoBehaviour and ScriptableObject types

rare basin
#

not mandatory on the newest versions

swift crag
#

Yeah, 2023.x (i believe) no longer enforces this

hexed terrace
#

that seems like a recipe for mild annoyances

swift crag
#

i had a typo'd filename for a few months

hexed terrace
#

Beginners with NewBehaviour, NewBehaviour1 ... NewBehaviour10

rare basin
#

oh god please no

languid spire
swift crag
#

I don't know how it behaves when you do that

#

either it's going to go by name or it's just going to refuse to find anything

languid spire
#

that's the only reason for doing this

swift crag
#

You reference MonoScript assets, not C# classes

#

the serialized data doesn't care about the C# class name at all

#

strictly the asset

rich adder
rare basin
#

i tested that

languid spire
rare basin
#

could be usefull for inheritance tho

#

but i'd never use it

swift crag
#

which would then make it so that renaming your classes breaks your serialized data

rich adder
#

doesnt MB need to live on a gameobject ? it would be like the siamese twins you cannot split ๐Ÿ˜ฎ

swift crag
rich adder
swift crag
#

that'd be particularly strange

languid spire
#

MB is a class not a script file, so making the script file name not equal the class name means they have fundamently changed something

swift crag
#

go grab a scene file or prefab file and look at the data in a text editor

#
MonoBehaviour:
  m_ObjectHideFlags: 0
  m_CorrespondingSourceObject: {fileID: 0}
  m_PrefabInstance: {fileID: 0}
  m_PrefabAsset: {fileID: 0}
  m_GameObject: {fileID: 194374385375701585}
  m_Enabled: 1
  m_EditorHideFlags: 0
  m_Script: {fileID: 11500000, guid: 4234cd2c43978e041bbe9323c195c4bd, type: 3}
languid spire
#

I dont do 2023 until it's LTS

swift crag
#

this is how a component gets serialized

#

If you search your project for that GUID, you'll find the script asset

#

You can completely rename a script asset, as well as rename the class it contains, and nothing changes

#

Unity references assets, not C# classes

languid spire
#

and one script file is one asset, I get it

swift crag
#

This is not the case with [SerializeReference], mind you

#
references:
    version: 2
    RefIds:
    - rid: 8536178588865790522
      type: {class: SoundChoiceCriteria, ns: , asm: Assembly-CSharp}
      data:
        choice: {fileID: 11400000, guid: cbd98f35d855a41209ee551e8b8f5a34, type: 2}
        kind: 0
languid spire
#

oh dear, not gonna go into details but I can see several attack vectors right there

swift crag
#

i do wonder what happens if I switch these class names out

languid spire
#

I'm thinking more of the assembly name

minor saddle
#

Sorry for the noob queston but how can I modify this so that the answer that comes back is random

#

for (int i = 0; i < answerButtons.Length; i++)
{

     TextMeshProUGUI buttonText = answerButtons[i].GetComponentInChildren<TextMeshProUGUI>();
     buttonText.text = question.GetAnswer(i);




     }
hexed terrace
#

send a random number from whatever range you give it , google: unity random range

rich adder
polar acorn
#

Additionally to what both of the above said, !code for sharing code snippets

eternal falconBOT
shell bane
#

Good afternoon. I have a problem with the scenes in my game. It starts on the third screen, instead of the first. On my third screen, I added a button to return to the home menu, but it is not interactive. Does anyone know how I can solve it?

swift crag
#

you'll have to show us what this button is actually supposed to do

#

by showing us its inspector

rich adder
shell bane
#

yes

swift crag
#

oh, it's completely unclickable

#

something is probably in front of it, then

swift crag
#

not just before you launch the game

rich adder
shell bane
#

I have one on the third screen, if I add more than one I get an error in the console

shell bane
#

I will record better

rich adder
#

and if you do have Event System, observe it in Playmode it tells you exactly whats being hit , Eg the Background instead

rich adder
shell bane
#

it shows me that the mouse is on the options screen, normal.

rich adder
shell bane
#

this page work normally

#

the first one no

rich adder
#

so why are u debugging this one

shell bane
#

this one have the event sys

rich adder
#

ANY scene with canvas needs event system

#

Inspect the Event System while in playmode for the broken scene

#

if you dont have one then thats ur problem

shell bane
#

the console shows an error

rich adder
shell bane
#

Is this how it should be?

rich adder
shell bane
#

how i solve this?

rich adder
#

why do you have all three scenes open

shell bane
#

i dont no, how i close?

rich adder
#

right click it, Unload

shell bane
#

ok

#

thx

pastel dome
#

man am i having a hard time

#

!code

eternal falconBOT
pastel dome
rich adder
pastel dome
#

hol on

#

Quaternion modifiedRotation = Quaternion.Euler(0f, angleToEnemy + viewAxisXOffset, viewAxisYOffset) * targetRotation;

dapper zenith
#

How do i turn off these Mini Map things on the right.... i cant find an answer for whatever Version im using (the most recent)

pastel dome
#

that whether i put the viw axisyoffset in the first or last part it still rolls

#

instead of pitching

#

its 3rd person camera sorry

earnest atlas
#

https://hatebin.com/hrqvrkoqph

I added the spawnPointBullet and other things with serialized vector3 value. I wanted to while ingame check where should I move the object so effect spawns more outside of the gun and bullet more inside. But it doesnt matter what I do spawn pos is wierd.

rich adder
dapper zenith
#

got it

#

ty

rich adder
earnest atlas
#

well its like only moving on 3 corners of the screen

#

top right bottom and top left

polar acorn
earnest atlas
#

im gonna screenshot what I mean

rich adder
#

no one can right off the bat know whats supposed to happen instead

pastel dome
#

gimme a min im a make a gif

earnest atlas
#

I decided this aint worth it

#

and just gonna make another object

pastel dome
#

the x target lock is working just not the y

earnest atlas
#

and use it

carmine sierra
#

How would I go about creating a boundary like this, ideally Iโ€™d want the mouse to lock once it reaches the boundary too

rich adder
carmine sierra
#

just by changing the sprite in settings?

pastel dome
#

nvm mines workin

rich adder
carmine sierra
rich adder
#

this acts as your game cursor so it can be clamped/locked in

swift crag
swift crag
#

that's just something that springs to mind, though. it might be awkward in practice..

#

I don't do much 2D stuff!

queen adder
#

Do you sometime use the parameter Out in methods?

rich adder
queen adder
rich adder
queen adder
#

Yeah it's very common to need that

rich adder
#

look at Raycast method is a great example

#

the method itself returns bool of success vs fail hitting collider

#

but the out gives you the actual hit data

#

I work in a typical pattern for certain items,

If(TryGetSumthing(out var somethingElse))

sharp wyvern
rich adder
sharp wyvern
#

just to avoid confusion. I only use the out param for OPTIONALLY returned values, like the example navarone gave.

rich adder
#

struct or tuple is also valid return to avoid out

pastel dome
#

i dont understand this rolling

#

its supposed to just be going vertical and its rolling

sharp wyvern
rich adder
pastel dome
#

like if it were a plane

#

barrel roll

rich adder
#

look like like dashing forward

#

or are you talking about the camera?

pastel dome
#

nah thats zoom its supposed to do that

rich adder
#

perhaps you should specify wtf we're looking at

#

its supposed to just be going vertical and its rolling

#

what is "it"

pastel dome
#

when i press up on y axis its supposed to pitch up and down

rich adder
#

WHAT IS

pastel dome
#

its rolling

rich adder
#

sorry caps

pastel dome
#

the camera

rich adder
#

so say that jesus..

#

send !code

eternal falconBOT
pastel dome
summer stump
#

I don't see any rolling in that video? I see it going up and down a little, which looks to be caused by the animation?

pastel dome
#

Quaternion modifiedRotation = Quaternion.Euler(0f, angleToEnemy + viewAxisXOffset, viewAxisYOffset) * targetRotation; this is the line i question

#

but regardless whether i put viewaxisyoffset in the first or 3rd spot it still rolls one way or the other

#

like its not that the rolling is bad its just on the wrong axis

rich adder
sharp wyvern
#

Quaternion modifiedRotation = Quaternion.Euler(0f, angleToEnemy + viewAxisXOffset, viewAxisYOffset) * targetRotation; I dont see the reason for this part * targetRotation, perhaps you mean to use a "startingRotation" here?

#

or perhgaps just the curren rotation? transform.rotation

pastel dome
#

ya cameras are butt to figure out

carmine sierra
#

if anyone could help me in physics i would appreciate it

pastel dome
#

im almost done just been stuck for 3 days on that

rich adder
sharp wyvern
carmine sierra
#

cant write hashtag on this keyboard though

sharp wyvern
carmine sierra
#

what are the chances

rich adder
#

its posted here many times

#

thats how often people dont know how to ask questions in a public forum

pastel dome
#

like i could use that with lookrotation

carmine sierra
sharp wyvern
#

it does more than just calculate angles, it performs the rotation of the transform for you, at the speed specified, without overshooting. I'm not sure if it's good for your use-case, but I THINK it would be.@pastel dome

rich adder
pastel dome
#

you mean instead of a fixed angle that i set before just use that and add 30 degrees to the pitch

polar acorn
pastel dome
#

itll go opposite my enemy?

polar acorn
#

Have we reached a generation that does not know that you can just... make a website?

rocky canyon
#

full circle

polar acorn
#

Like, any person can just pay five dollars to a domain registrar and put whatever the hell they feel like somewhere

rocky canyon
rich adder
#

god i miss geocities

rocky canyon
#

Oooooeeee

rocky canyon
rich adder
#

hey hey it was free for a broke 12 year old

polar acorn
#

Everyone's so used to the walled gardens of six websites controlling the world they forget that there are literally billions of websites

rocky canyon
rich adder
rich adder
rocky canyon
#

unstoppable midi bg music FTW

rocky canyon
#

using little snippets of javascript to disable the popups

#

๐Ÿ˜„ i felt L337

carmine sierra
rich adder
rocky canyon
#

good thing we got a surplus of new domains to make up for it :D..

#

.com .app .web .game

#

etc

summer stump
rocky canyon
#

wonder its analytics

prisma sail
#

any experts?

rich adder
prisma sail
#

can you help?
me

swift crag
#

ask your actual question

nimble hinge
#

Hello.

#

Just upgraded unity to 2021(worse decision)
and recieved an error

#

Did they change the name, type or just a casual error

pastel sinew
#

How do I force my game to run in 16:9 when built? I need to capture footage of my game but I have a 21:9 monitor.

rocky canyon
#

lol, u cant judge the entire 2021 b/c of 1 error

#

i didnt get that error... /shrug

nimble hinge
#

No i hate it many reasons lol

swift crag
nimble hinge
#

it crashes everytime

nimble hinge
rocky canyon
#

well, it may not be the best version for ur PC

#

something going on w/ it

nimble hinge
#

Well, I removed it and im installing it again

nimble hinge
#

2020 never crashes for me

summer stump
#

2021 is generally considered the best one haha.
At least since 2017

nimble hinge
#

and also i prefer old logo too lol

#

and project file takes 1.0GB in 2021

#

and 400mb in 2020

nimble hinge
#

Oh wow

#

amazing

prisma sail
#

public float movementSpeed = 5.0f;
public float rotationSpeed = 100.0f;
public float jumpForce = 8.0f;
private bool isGrounded = true;
private bool isCrouching = false;
private bool isProne = false;
private float originalHeight;
private CharacterController controller;
private Transform playerTransform;

private void Start()
{
    controller =  GetComponent<CharacterController>();
    playerTransform = transform;
    originalHeight = controller.height;
}

private void Update()
{
    float horizontalInput = Input.GetAxis("Horizontal");
    float verticalInput = Input.GetAxis("Vertical");
    Vector3 moveDirection = playerTransform.forward * verticalInput + playerTransform.right * horizontalInput;
    moveDirection.Normalize();
    moveDirection *= movementSpeed;
    if (controller.isGrounded)
    {
        isGrounded = true;
        moveDirection.y = -gravity * Time.deltaTime;
        if (Input.GetButtonDown("Jump"))
            moveDirection.y = jumpForce;
    }
    else
    {
        isGrounded = false;
        moveDirection.y -= gravity * Time.deltaTime;
    }
    if (Input.GetKeyDown(KeyCode.C))
    {
        if (isCrouching)
        {
            controller.height = originalHeight;
            isCrouching = false;
        }
        else
        {
            controller.height = originalHeight * 0.5f;
            isCrouching = true;
        }
    }
   if (Input.GetKeyDown(KeyCode.Z))
    {
        if (isProne)
        {
            controller.height = originalHeight;
            isProne = false;
        }
        else
        {
            controller.height = originalHeight * 0.3f;
            isProne = true;
        }
    }
    float mouseX = Input.GetAxis("Mouse X");
    playerTransform.Rotate(Vector3.up, mouseX *
#

rotationSpeed * Time.deltaTime);
controller.Move(moveDirection * Time.deltaTime);
}

eternal falconBOT
eternal falconBOT
rich adder
#

double kill

nimble hinge
#

Damn poor guy

#

Will it require to change the names?

#

if ill switch to that ad mediation

prisma sail
rich adder
#

prob need to use those methods

summer stump
nimble hinge
#

well..

rich adder
nimble hinge
#

Let's see

rich adder
#

post it properly

summer stump
#

You posted it incorrectly

nimble hinge
#

Double kill

prisma sail
#

bruhj

rich adder
#

esp on mobile this is a clusterfuck to read

#

@prisma sail

rich adder
# prisma sail bruhj

if you want to get help you should not make it diffcult for those trying to help, that is why rules/guidelines are there for posting

prisma sail
#

mouse input doesn't work

rich adder
#

you did it wrong

#

save the script (on the website)
then send link generated

nimble hinge
#

oh HELL no

#

I ain't setting up this shit

polar acorn
rich adder
#

lol wtf

prisma sail
nimble hinge
polar acorn
nimble hinge
#

And im trying to see how it will benefit

prisma sail
#

mouse input doesnot' work

nimble hinge
#

besides its only rewarded ads to not ruin user experience

carmine sierra
#

what does it mean if all my vectors get underlined in red like this

slender nymph
#

are you missing a using directive?

prisma sail
#

me?

#

no error

nimble hinge
#

How come serializefield does not highlight

#

and vectors do

rich adder
#

probably ambiguity'

#

cant spell for shit sory

carmine sierra
#

didn't check the console since didn't think that would be an error

slender nymph
#

remove the System.Numerics namespace

carmine sierra
#

lol

rich adder
prisma sail
#

I don't have

rich adder
#
  • fix usually
carmine sierra
#

why does systems.numerics keep getting added randomly

summer stump
carmine sierra
#

what kind of joke is that

rich adder
summer stump
prisma sail
#

okay. You guys checked mei code?

carmine sierra
rich adder
#

usually happens when you paste

#

for me at least

nimble hinge
#

How come

summer stump
nimble hinge
carmine sierra
#

what does it mean if rl.hid failed to create a device

polar acorn
# prisma sail no error

When people reply to a person, you can see the message they have replied to. Why, when seeing a reply to a different person than you, did you think they were talking to you

nimble hinge
#

can somebody help me, look at that

rich adder
prisma sail
#

why would I remove deltatime

carmine sierra
rocky canyon
#

b/c mouse delta's are already frame independent

summer stump
rich adder
slender nymph
summer stump
#

Also, might be fighting between transform and CharacterController? For the rotation issue

glossy eagle
#

Hi. One question, what is a normal value for Time.deltaTime...? Because idk why I feel like I am not getting a correct value...

pastel dome
rocky canyon
#

mouseDelta's are distance the mouse travels / frame.. its already getting scaled

summer stump
rocky canyon
#

yea, u can add a sensitivity modifier

#

but thas a constant..

#

its different than the deltaTime

glossy eagle
slender nymph
#

yes because you have a very high framerate so deltaTime is very small

glossy eagle
#

but THAT small?

rocky canyon
#

thats an exponent

#

ya, pretty damn smal

pastel dome
#

how do u supposed making a game controller and mouse friendly without delta time xD

rocky canyon
#

.00000089 ish

rocky canyon
#

its been already mentioned why

slender nymph
rich adder
summer stump
slender nymph
#

well there you go. keep in mind that deltaTime is also scaled by the timeScale

rocky canyon
#

deltaTime is doing math constantly.. ur just debugging the result of deltaTime for (that) frame

glossy eagle
prisma sail
#

Bro. It being there or not being there shouldn't have any effect on it. Nevertheless I did what you said and my mouse still does not work

rocky canyon
#

yea it definately does have an effect

#

it may not solve ur issue.. but it is a problem

#

remove it first.. and then fix the next problem

carmine sierra
#

can I detect when an object touches an empty game object (which has a transform component)

pastel dome
verbal dome
prisma sail
#

Bro everything is working except for the ducking mouse

verbal dome
#

And you also need a collider on the other object, and one of them must have a rigidbody

carmine sierra
prisma sail
#

yes

prisma sail
summer stump
pastel dome
prisma sail
#

Removing delta time didnt work bro

verbal dome
summer stump
summer stump
#

But have you done ANY debugging?

rocky canyon
#

removing the deltaTime from the mouse input is regardless of ur error.. EVEN IF IT WORKED we'd still tell u to remove it

#

now after its removed u can find the REAL issue

noble summit
#

why is it when i add upwards force to an object it sometimes gets ragdolled in different directions even though ive done nothing to change other axis

verbal dome
#

@prisma sail Does playerTransform have an animator?

#

Or other components that might be modifying its rotation

prisma sail
#

of course it does

verbal dome
#

Tf you mean 'of course it does'

rocky canyon
noble summit
prisma sail
#

of course it has an animator

verbal dome
rocky canyon
#

that was my guess.. it would hit something and send it off-course

summer stump
verbal dome
summer stump
#

Damn, like you don't even WANT help lmfao

verbal dome
#

The attitude is real

summer stump
#

I think the animator is a far more likely issue than what I said though (cc and transform fighting)
I should have though of that, but I didn't think they would have the animator on it

noble summit
pastel dome
#

@prisma sail still might not be the code just the settings or prefrences been a while since i fooled with old input system

rocky canyon
#

show some code/ screenshots etc

summer stump
#

Maybe show the editor

#

Because they wanted to know if the animator was on the same object as the script you showed

prisma sail
#

okay

#

you want project file?

summer stump
#

Definitely no lol

rocky canyon
#

heck no, it'd probably drop my IQ just openning it

pastel dome
#

haha keep that stuff secret man

summer stump
#

Show a screenshot of the editor, with the object that has the script selected

rocky canyon
#

did you debug the value of your mouse?

#
    public float mouseX;
    private void Update()
    {
        mouseX = Input.GetAxis("Mouse X");
        Debug.Log(mouseX);
    }```
just to make sure ur getting good mouse input
summer stump
#

First step should be some debug.logs

rocky canyon
#

that'd be the first thing

prisma sail
#

of course I did everything is workingas they are supposed to

verbal dome
#

Except for the mouse..?

summer stump
prisma sail
#

yes

noble summit
verbal dome
#

Which is what was being asked

rocky canyon
#

if the numbers are changing the mouse input is good..

#

then u'd move on to ur movement code

prisma sail
#

they are bro

rocky canyon
#

but if u have an animator a good guess is the animator is overwritting the movement

summer stump
#

Alright, fuck this, i'm out lol
Won't give anyone what they ask for.
Getting snotty
Not worth it

rocky canyon
#

u can't move something in code if ur moving it with animations instead..

#

the thing u would do.. is move the parent in code.. and move the graphics (as animation) as a child..

#

that way ur code doesnt care about the animation.. and the animation doesnt care about the code

prisma sail
#

you refused

#

It has everything

#

you could ask for

pastel dome
#

easy bud you gotta be humble if you're going to get help

rocky canyon
#

could u not make a compromise and try to figure it out by sending the relevant pieces of code.. back and forth and communicate?
no one has time to wait for u to upload. download a random project, open it up, and dig thru it looking for your problem..

summer stump
rocky canyon
#

and that ignores the fact that u think we just that trusting that it aint a virus or something?

summer stump
#

I do NOT want your fucking project lmfao
I'm on my phone lol

verbal dome
rocky canyon
noble summit
carmine sierra
#

for OnTriggerEnter2D(Collider2D other) can 'other' be replaced with the reference of a specific collider to only detect that collider?

rocky canyon
#

ur player is rotated 90 degree's on the Y did u know that/

noble summit
rocky canyon
#

not the issue tho, bc ur using Vector3.up

#

which is a world direction

#

so it should just go up

noble summit
#

what

noble summit
rocky canyon
summer stump
#

Nah, worse, I just thought it was the other guy finally showing a screenshot haha

prisma sail
#

what is that site for code sharing

#

I will give you relevant parts

noble summit
rocky canyon
#

i made a simple character the other day to help test stuff.. i run a similar code.. and it doesnt seem to do anything weird

#

str8 up and str8 back down

rocky canyon
rocky canyon
eternal falconBOT
rocky canyon
#

pick one.. theres plenty

prisma sail
#

okay bro

#

here you go

polar acorn
short hazel
rocky canyon
#

ya, im still thinkin its an animator / code conflict

noble summit
# rocky canyon weird.. lol

at the start the numbers go crazy but its not actually moving, but once i start jumping it goes to -0.000 and sometimes changes by 0.001

prisma sail
prisma sail
polar acorn
rocky canyon
#

when u get the time can you show the animation clips ur using on the player?

#

if any of those clips change the transform of the player, thats why the code isn't moving it correctly

prisma sail
#

of course bro but they are just idle animations let me warn you.

#

they don't transform or translate

rocky canyon
#

then what do they do? most of the time idle animations do move the position.. up and down a bit

queen adder
#

anyone know if its ok to do this in the Update() function:

image.color = aColor;

Or should i be doing:

if(aColor != image.color) {
    image.color = aColor;
}

Is there any perf difference? Does image.color setter use a unamanged function call?

rocky canyon
#

you wouldnt perceive a difference in teh game..

#

if u set it like the first one.. its just setting it..
if u check if the color is different and then set it.. ur running a conditional..

#

so yea, it does more.. but i doubt it'd be a performance difference

carmine sierra
#

any chance I could send in like a page of code, I want advice on where it could be more efficient

queen adder
#

yeah but if image.color uses unmanaged function calls the marshalling and de-marshalling time has to be taken into account so you wouldn't want to call it every tick?

rocky canyon
eternal falconBOT
queen adder
rocky canyon
#

but i dont think it matters, its probably very very minor difference

rocky canyon
#

someone else would have to chime in..

queen adder
rocky canyon
queen adder
#

It looks like it is :\

rocky canyon
#

why u being so argumentative?

rocky canyon
queen adder
rocky canyon
#

you might be able to gain a peek in there

#

and see if theres a big difference

pastel dome
noble summit
#

why is my project running 9 fps i have 3 objects and 2 scripts

queen adder
#

Ok good point

summer stump
noble summit
summer stump
#

A single script on a single object could make it freeze

summer stump
eternal falconBOT
summer stump
#

Dang

prisma sail
pastel dome
#

ya thats what i mean i dont think your animations are locked to root motion then?

verbal dome
noble summit
prisma sail
rocky canyon
noble summit
prisma sail
#

let me scroll up and find the message

carmine sierra
#

whats wrong with my referencing. it says weaponfired is never used

verbal dome
pastel dome
#

you have to say using mouse or something for old input

noble summit
#

most of it is (others) how tf am i supposed to know what others is

rocky canyon
# noble summit nvm i found it

sometimes u can get frame drops when ur window is minimized (and the rest of the editor is exposed/drawing) when u maximize the frames tend to go up.. but i wouldn't think that'd be a difference like u mention.. 9fps is really bad. somethings going on

summer stump
carmine sierra
rocky canyon
#

try a restart and see if it speeds up

noble summit
noble summit
rocky canyon
#

you have to expand it out a bit

#

you'll see ur scripts in there

prisma sail
verbal dome
#

It's a different bool now

noble summit
carmine sierra
#

ive seen the data type be saved as the name of the script but i dont get that

verbal dome
rocky canyon
carmine sierra
rocky canyon
#

when u click a frame spike or something in the CPU part, you'll see the Player Loop/ Editor Loop etc.. u can see if any of teh scripts you wrote are taking a weirdly long time to run

#

Time ms

verbal dome
#

Alternatively you could make a getter property in your class:cs private bool weaponFired => weaponFire.weaponFired; So it fetches the value from the weaponFire component every time you say weaponFired
But it's not necessary @carmine sierra

noble summit
verbal dome
#

I strongly recommend doing some starter C# courses so you get a decent understanding on how variables and well, everything works

rocky canyon
#

ya, not sure what most of that is.. but those are some big numbers.. ngl

verbal dome
noble summit
prisma sail
rocky canyon
# noble summit tf is "vsync"

vertical sync.. its a feature on ur computer/monitor that tries to sync the frame rate w/ the monitors refresh rate..

#

so u dont get screen tearing

noble summit
#

oh

#

so how do i fix it

rocky canyon
#

i have mine turned off.. so not sure how it affects unity or nething

rare basin
verbal dome
rocky canyon
#

you can google and find out how to turn it on/ off cuz idk where it even is ngl

verbal dome
rare basin
#

yup

noble summit
#

where do i check if vsync is on

rare basin
#

again, google

noble summit
#

i hate google so much

verbal dome
#

Bing

#

DuckDuckGo

#

Whatever

noble summit
#

yeah

rocky canyon
#

he has a mac if i read correctly..

rare basin
#

then you picked wrong thing to learn

rocky canyon
#

do mac's use vsync?

summer stump
#

Gonna be a rough programming journey if you won't search thingd

short hazel
verbal dome
#

Abstract mecanim art

rocky canyon
#

^ most all coder's live w/ a window of Google open in their periphial vision ๐Ÿ˜„

rare basin
summer stump
rocky canyon
#

ya, thats fkn insane.. thats what i thought it was..

verbal dome
rocky canyon
#

and he wanted to send you that project @summer stump ๐Ÿ˜„

rare basin
#

with broken phone camera

summer stump
rocky canyon
#

theres no way thats his animator.. not enough clips in the world for that kind of transitional madness

carmine sierra
#

!code

eternal falconBOT
noble summit
#

vsynk count is on every V blank

carmine sierra
#

i dont get how to send the inline code

rocky canyon
#

and i asked for the animation clip not the animator.. i don't care how many animations there are.. i was just wondering if any of them were modifying the position of the player character

verbal dome
rocky canyon
#

not ' use the `

#

its the key above ur tab button

summer stump
#

Backticks, not apostrophes

carmine sierra
#

but ill copy and paste

verbal dome
#

Like mine

rocky canyon
#

yea true.. its the one ~ that looks like that

#

i think

summer stump
carmine sierra
#
public class WeaponFire : MonoBehaviour
{
    [SerializeField] Camera firingCamera;
    Rigidbody2D rb;
    public float velocityMultiplier;
    Vector3 originalPos; 
    Vector3 newPos;
    Vector3 poschange; // newPos - originalPos
    BoxCollider2D boxCollider;
    [SerializeField] float gravityScale;
    public GameObject weaponInstance;
    [SerializeField] GameObject Shop;
    Vector3 mouseWorldPosition;
    [SerializeField] CircleCollider2D spawnCollider;
    bool touched;
    public bool weaponFired;
    
    
    private Vector3 GetMousePos()
    {
        mouseWorldPosition = firingCamera.ScreenToWorldPoint(Input.mousePosition);
        mouseWorldPosition.z = 0f;
        return mouseWorldPosition;
    }
    void OnTriggerEnter2D(Collider2D spawnCollider)
    {
        if (weaponFired)
        {
            Debug.Log("Passed through spawn");
            rb.gravityScale = gravityScale;
        }
    }
    void MotionToCenter()
    {
        rb = weaponInstance.GetComponent<Rigidbody2D>();
        newPos = mouseWorldPosition;
        boxCollider.enabled = false;
        poschange = newPos - originalPos;
        rb.velocity = new Vector2(-poschange.x*velocityMultiplier,-poschange.y*velocityMultiplier);
    }
    void Start()
    {
        boxCollider = gameObject.GetComponent<BoxCollider2D>();
    }
    
    void OnMouseDown()
    {
        if (weaponInstance) //Checks that the weapon has spawned in
        {
            GetMousePos();
            originalPos = mouseWorldPosition;
            Debug.Log("Clicked"); 
        }

    }

    void OnMouseDrag()
    {
        if (weaponInstance)
        {
            GetMousePos();
            weaponInstance.transform.position = mouseWorldPosition;
        }
    }
    void OnMouseUp()
    {
        if (weaponInstance)
        {
            weaponFired = true;
            MotionToCenter();
        }
    }
}
rocky canyon
#

~

verbal dome
#

Nah it all depends

#

My tilde is a different key

summer stump
#

But yeah, that may be somewhere else

carmine sierra
#

i even debugged to let me know wont debug

rocky canyon
carmine sierra
#

gravity is meant to turn on when it passes the trigger collider

summer stump
rocky canyon
#

is the boolean true? did u check the collision w/o the boolean its nested under? could that be it?

noble summit
#

so what do i make my vsync to make my fps higher

carmine sierra
#

ill start the boolean as true and then let you know the result

#

oh nah it's not true

rocky canyon
#

vsync is like a limiter.. theres nothing to do w/ it to make ur frames higher.. but if u disable it.. then it wont limit anything.. so ur frames will run as fast as they can

carmine sierra
#

it starts without gravity as intended just doesn't turn it on when intended

verbal dome
rocky canyon
#

im not entirely sure it even is Vsync (as the issue) but i also don't know what else it would be either ^ there ya go this guy knows

noble summit
rocky canyon
#

Try Application.targetFrameRate = -1.

prisma sail
verbal dome
short hazel
#

If you have nothing to contribute, please don't post anything

noble summit
verbal dome
#

Did you change targetFrameRate like spawn suggested

prisma sail
noble summit
short hazel
swift crag
#

This may be the worst photo of a screen I've ever seen

noble summit
#

Application.targetFrameRate = -1 where do i put this though

summer stump
#

Who asked for an incomprehensible image showing nothing?

prisma sail
#

Bro this man with purple name asked for it

verbal dome
rocky canyon
#

a script thats in the scene ofc

summer stump
steel smelt
#

he's a troll, time to stop feeding

short hazel
#

Clearly

noble summit
rocky canyon
#

you mean the Awake()?

prisma sail
noble summit
frosty hound
summer stump
rocky canyon
#

i asked for an animation clip that ur using as the idle for ur player.. u havent posted that.. and you havent posted anything thats even readible..

rocky canyon
#

could be any script.

noble summit
#

oh ok

verbal dome
polar acorn
rocky canyon
#

as long as that object is in the scene. that code will run when u start the game

noble summit
#

yooooo nice the framerate went up by 2!!

verbal dome
#

Man people have such attitude today

rocky canyon
verbal dome
#

Like wtf

summer stump
rocky canyon
# noble summit yooooo nice the framerate went up by 2!!

ya, im not sure tbh.. if it were me i'd do a full restart (the entire pc) and check again.. if it was still bad frames i would try making a new project to test an empty scene and see if that had bad frame rates.. and then i'd probably use that information + the profiler screenshot u took earlier and try to ask some more / research what might be the issue

#
  • if a restart fixes it - good
  • if the new project fixes it - probably some bad code/ bad assets in that project
  • if the new project also has bad frames - it might be Unity in general (that particular version) or maybe some settings on ur pc..
    point being, id try to isolate the issue
noble summit
rocky canyon
#

yea np, sorry couldn't get it worked out.. but atleast tomorrow u'll be fresh and ready

night sparrow
#

Hey, Is there any better way of doing this raycast for a gun, No bullets have been made at the moment!

void RayCastForEnemy()
    {
        RaycastHit hit;
        if (Physics.Raycast(transform.parent.position, transform.parent.forward, out hit, 1 << LayerMask.NameToLayer("Enemy")))
        {
            try
            {
                Debug.Log("Hit a enemy");
                Rigidbody rb = hit.transform.GetComponent<Rigidbody>();
                rb.constraints = RigidbodyConstraints.None;
                rb.AddForce(transform.parent.transform.forward * 500);
            }
            catch { }
        }
    }```

I ask this as sometimes well 50% - 75% the time it doesnt even register me hitting the enemy even close up
verbal dome
#

Not that there's a big difference

pastel dome
#

theres different raycasts andd make sure its not hitting player first

short hazel
pastel dome
#

sphere cast

verbal dome
#

I would also just null check instead of try-catch

steel smelt
#

oh wow

night sparrow
#

alright thanks @verbal dome

night sparrow
short hazel
#

Yes

carmine sierra
#

this block of code means that if the gameobject touches spawnCollider, and the weapon has been fired, it would change the rigidbody's gravityscale to the variable gravityscale right?#

verbal dome
carmine sierra
night sparrow
#

alright thanks so much ima work on it and try to fix the issues and make it better

rocky canyon
#

it would change w/e rigidbody you have assigned as rb yea

verbal dome
night sparrow
carmine sierra
#

"passed through spawn"

rocky canyon
#

you have to have a rigidbody for it to detect

carmine sierra
rocky canyon
#

on one of the two..

#

either the thing w/ the trigger.. or the thing entering the trigger

rare basin
#

is OnTriggerEnter2D even called? did you debug it?

carmine sierra
dull arch
#

How to i get my crouch to not be permeant

rocky canyon
#

Debugs for the win! ^ i would def put debugs everywehre

rare basin
#

it does under certain conditions

rich adder
rocky canyon
#

you have to write code to uncrouch it