#💻┃code-beginner

1 messages · Page 647 of 1

teal viper
#

By disk usage I mean reading/writing operations. Not the storage capacity.

cloud walrus
#

I see

#

thx for this btw i'll consider using any third-party tool to try detecting the causing of this issue

teal viper
#

What third party tool?
There's nothing to detect here.
Just close programs that you don't actively use, shut down processes, google guides on minimizing windows memory usage, on how to disable edge processes, etc...

#

As for disk usage, you can see that in task manager as well. Just sort by the "disk" column.

eternal needle
cloud walrus
cloud walrus
#

might even able switching to VS code by then

#

btw going back to this one no the script isn't attached perhaps it could be what's causing the error

eager elm
rapid thunder
#

guys i just started using unity and i followed a tutorial but the code they gave isn't working can someone help (its classic movement code ig in first person view)

cloud walrus
cloud walrus
teal viper
rapid thunder
cloud walrus
rapid thunder
#

i actually cant add the script rn

teal viper
eternal falconBOT
#

:teacher: Unity Learn ↗

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

cloud walrus
rapid thunder
#

oh okay thanks

#

so do u recommend using 2022 or latest version of unity?

cloud walrus
#

Definitely the latest version of unity Unity 6

teal viper
rapid thunder
#

and 1 last question i know myself im not a coding guy if i need any help of coding something different can chatgpt do that? (dont have a friend who is coding too btw dont judge using ai please im just a guy who wants to learn) lol

cloud walrus
#

i utterly can't stress it enough, if you're starting out to learn programming don't use ai at all (maybe there are exceptions but if you do want to learn it seriously then no don't use ai) besides

#

what i recommend you to do instead

teal viper
cloud walrus
# cloud walrus what i recommend you to do instead

don't start to learn programming in unity that would be messed up, instead take a programming (CS50x is a great choice they have their own server on discord and offer a much better ai) after that you could go to learn unity/C#

#

@rapid thunder

cloud walrus
cloud walrus
teal viper
cloud walrus
#

really appreciate it! that information would come in handy!

rapid thunder
#

i cant even enter the learn page lol

teal viper
#

Using VPN perhaps?

cloud walrus
rapid thunder
rapid thunder
#

cant open the first one but i can open the second youtube video

gentle bone
#

for videos on unity page you have to activate settings in the cookies / advertising tab there...

#

dont know where you can find it .. but when you have the tab/popup on the bottom click on the settings part...

gentle bone
rapid thunder
#

i cant watch it on microsoft edge chrome and opera all 3 of them

tribal fulcrum
#

hey guys im trying to make a shape change color once it gets hit twice, does anyone have a tutorial for that?

gentle bone
#

ah i found it.. when you dont have the bottom popup theres a icon on the right bottom...

#

so far i know for videos to work you need the functional cookies active..

polar acorn
rapid thunder
tribal fulcrum
#

i have it so once it gets hit it changes green

#

but i want the condition to be that it changes green only when its been hit twice

polar acorn
#

So, instead of changing it to green, add one to a variable

#

and if that variable is two, then change it

tribal fulcrum
#

ohh good idea

gentle bone
obsidian forge
#

hi, could anyone help me how to make a active ragdoll? i've tried making it with IK (two characters, one physical, other one animated) and it always resulted to the physics engine just exploding. i would be grateful for any tips

tribal edge
obsidian forge
#

ok, thanks

snow depot
#

My Friends would like to test out what I have so far, how do I send them a Build for them to try out?

slender nymph
#
  1. not a code question
  2. build the game and give them the resulting build files
grand snow
#

#archived-shaders tis the place probably. Colour tinting will affect the whole model on default shaders.

rapid thunder
# gentle bone should work for the whole .unity domain

found the solution so if that happens "explaining so you can explain to others btw" when it happens you have to download "Allow Control allow origin" from web store then activate it and reload the page then its working fine

grand snow
#

no

#

just ask in the correct channel and many people can then help...

faint tulip
#

why is the book not falling even though i add rigid body to it?

mystic anvil
#

When I place a tower I can no longer place another one on top because it registers as an occupied position. But when I am adding all the objects in the game to the occupied position so that I can't build on top of them I can still build on top of those objects. (It is detections 309 objects)

rich adder
frail hawk
#

not in 100 years would i have looked at that checkmark lol

rich adder
#

yeah took me a few takes to see it, its not normal you add physics to something static lol

faint tulip
#

i see thank you\

frail hawk
#

good catch nav eagle eyes

rich adder
#

mass of 10 for a book seems a lot lol. 20lbs book
Btw mass doesn't affect falling speed, idk if thats what you were trying to do..

ruby sparrow
#

how can I make it so that any button click in the game plays a click sfx?

rich adder
#

buttons is vague term

ruby sparrow
rich adder
#

Link an AudioSource with the OnClick or use code

ruby sparrow
rich adder
ruby sparrow
#

what if I have a script that find all buttons in the scene and adds a listener that plays the audio source 🤔

rich adder
#

sure you can do that

frail hawk
#

just use a singleton with one audiosource and a bunch of Audioclips, (maybe a list of audioclips)

rich adder
#

maybe do

void OnEnable(){
        for (int i = 0; i < myButtons.Length; i++)
        {
            myButtons[i].onClick.AddListener(PlaySoundMethod);
        }
    }
    private void PlaySoundMethod(){
        SoundManager.Instance.PlayMySound();
    }```
frail hawk
#

straight forward

rich adder
#

you could also register a static event probably

trim gyro
#

For unity how do 2d character models work?

#

Can I just import them from my iPad on my computer

naive pawn
#

that's a pretty broad question
what files do you have?

rich adder
#

if they are supported format sure?

green copper
#

Can anyone reccomend a good tool for planning code flow and/or data relationship diagrams as flowcharts? MSWord's tools are fighting me to the point I'm considering thumbtacks, string, and a corkboard as an alternative

trim gyro
#

Right now it’s a blank project that I’m trying to get started

#

I mainly wanna know if I can just import images of the characters on to my computer then just use those images on unity

naive pawn
#

if they're supported formats then yes

magic crown
#

Guys i need some help, i'm gonna go crazy.

So i have a list for a float, i have 2 element on my list, no more no less. What i want to do is add 5 to the first element so i do "itemTotal[0] = 5;" Which work cause it the first element in the list, then i wana try with the second one to make it equal to 3 so i do "ItemTotal[1] = 3;" And it tell me it's out of range, EVEN THO BOTH OF THEM ARE INITIALIZED, WHAT'S WRONG

slender nymph
#

have you actually confirmed that the list has a length of 2?

magic crown
#

yes

slender nymph
#

how

magic crown
#

and for some reason when i do it unity decide that why not delete it

magic crown
slender nymph
#

show the inspector and the code

magic crown
#

No forget about it i'm the bigest dumbass ever

#

XDDDD

#

so i'm gonna explain what wrong

#

i have a foreach loop and the problem is i was asking to apply the value to the other one before they were even initialized

#

i wana die ;w;

rich adder
magic crown
#

Don't worry about my english right now it's been 3 day i didn't sleep

#

i'm kinda dying right now

#

but coffee help a tone

naive pawn
#

sleep will help a lot more

grizzled linden
#

Hi! I was looking to follow unities https://learn.unity.com/project/prototyping-a-procedural-animated-boss?utm_source=YouTube&utm_medium=social&utm_campaign=evangelism_global_generalpromo_2021-02-17_prototype-series-procedural-walker-learn but the file link is broken.

I tried doing some of it on my own but I'm unsure how to get the cinemachine dolly to work.

Unity Learn

In this episode of the Unity Prototyping series, the Unity Technical Marketing team, created a prototype that showcases the implementation of two enemies with procedural animation using the new Supernova art pack! You can download the prototype project in the Tutorial Materials tab!

#

Is there a location I can contact a mod/admin to get the link fixed, or possibly get some advice on how to go about handling the cinemachine? atm, it seems to cause my rig to split a little unnaturally

red igloo
#

I have this issue where when you move in a direction and jump and you let go of wasd the player will immedietly stop moving which I dont want . What I want is when I jump and move forward and let go the player will move in that direction. I'm very confused on how to implement it.

rich adder
#

you need some deceleration logic coded in manually

#

you're immediately stopping velocity by setting it to 0 right away without inputs

#

the same way you make "gravityVel" you need also motion velocity you track, slow / speed up

sharp bloom
#

Is there a way to "select" several gameobjects, store them inside a list and retain the ability to adjust them directly?

#

I mean like being able to loop through that list and disabling each one, etc.

#

I tried creating a public list, dragging the gameobjects from inspector into there, but it seems that doesn't work for what I'm trying to do

sharp bloom
#

Seems they no longer reference the actual gameobject in the scene

#

I don't know whetever I have to instantiate them through the script in order to do stuff with them

rich adder
true owl
#

I'm confused why I get all these errors after I save my files while the game is running?

sharp bloom
rich adder
#

maybe make a video of issue?

sharp bloom
#

Like so, and I want to control how many of these fish objects are activated at a given time

rich adder
rich adder
# sharp bloom

when you find yourself numbering variables like this is best to always use a collection

sharp bloom
rich adder
#

in what way doesn't work ?

#

it should work fine

#
  1. how are you sure the function is running
  2. are you checking the correct objects
sharp bloom
#

Must have hit it by accident

sharp bloom
#

It was being automatically disabled every time I hit play

rich adder
#

that means you might have a Null Ref in Awake

sharp bloom
#

Yes I figured, I put everything to Start and it works for now

polar acorn
true owl
#

my issue is it's weird though because it works when I run it normally but if I save my code and rerun while it's running

#

that's when the issue happens

polar acorn
#

Yeah so don't do that

#

That doesn't work

true owl
#

wym isn't that a normal feature?

polar acorn
#

Absolutely not

true owl
#

oh

polar acorn
#

It's never worked

edgy tangle
#

No. It needs to recompile

true owl
#

I see

#

okay got it

polar acorn
#

They've tried to add options for it and it sometimes works but only if you're changing POCO objects that don't touch any Unity code

#

but if you do anything that's a behavior or scriptable object the entire thing just instantly dies

true owl
#

okay appreciate it thank you everyone

#

also does LayerMask.GetMask() do a OR or an AND of the layers inside of it

LayerMask.GetMask(ScStrings.GROUND, ScStrings.RAIL, ScStrings.WALL) I want this to mean that if it's a GROUND or RAIL or WALL

#

but i'm not sur

#

sure

rich adder
true owl
#

wym

#

what is that, rather

rich adder
#

do you want multiple layers in one variable?

true owl
#

yeah I want an OR of them

rich adder
#

yes so use a serializedLayerMask then assign the values in the inspector

true owl
#

interesting

#

what's the difference

rich adder
wraith shuttle
#

i have been facing this problem for a day 💀💀

polar acorn
#

Show the inspector for the bullet

wraith shuttle
#

btw i changed speed to 10 and it doesnt work

polar acorn
#

Did you change it on the prefab

wraith shuttle
#

so yeah

polar acorn
#

This is an instance of the prefab

wraith shuttle
#

oh shitto i forgot

#

and i noticed smth strange i go backwards

#

when i increased the bullet speed

#

and u right i changed it and the only problem it falls

#

and not go forward at all

polar acorn
#

Seems like your bullet is facing down then

#

Select whichever object has the gunScript on it and show the transform arrows in the scene

wraith shuttle
#

Sure

polar acorn
#

Is that what you want

wraith shuttle
#

btw i changed script to transform.translate(vector3.forward * time.deltatime * Speed); and it goes to the left

wraith shuttle
#

u smart tbh

#

and u right as always stupid me thanks brother

#

i will basically change the forward thing

polar acorn
#

That would be why it's not working

wraith shuttle
#

i used linearvelocity too

polar acorn
#

If you have a rigidbody you should use it

wraith shuttle
#

hmm it still falls

#

though i changed it from forward to left to make it go -1,0,0

keen cargo
#

Hey yall, have a bit of a weird situation with my first person camera rotation - the camera rotates faster while the player is moving, and there's some weird quirks with the camera rotation in general, doesn't behave naturally and jumps ahead at times

player is controlled using rigidbody, interpolation is on - turning off interpolation helps with the camera rotation speed, however the camera still jumps ahead

using UnityEngine;

public class PlayerCamera : MonoBehaviour
{
    public Transform cameraHolder;
    public Rigidbody playerRb;
    public float sensitivity = 5f;

    private float xRotation;
    private float mouseX;
    private float mouseY;
    
    private void Update()
    {
        mouseX = Input.GetAxis("Mouse X") * sensitivity;
        mouseY = Input.GetAxis("Mouse Y") * sensitivity;
    }

    private void FixedUpdate()
    {
        // Rotate the camera holder (vertical rotation - pitch)
        xRotation -= mouseY;
        xRotation = Mathf.Clamp(xRotation, -90f, 90f);
        cameraHolder.localRotation = Quaternion.Euler(xRotation, 0f, 0f);
        
        // Rotate the player body (horizontal rotation - yaw)
        playerRb.MoveRotation(playerRb.rotation * Quaternion.Euler(0f, mouseX, 0f));
    }
}
wraith shuttle
#

finally it worked

#

thats what i used

keen cargo
#

might've gotten my issue solved too with the following

public class PlayerCamera : MonoBehaviour
{
    public Transform cameraHolder;
    public Rigidbody playerRb;
    public float sensitivity = 5f;

    private float xRotation;
    private float yRotation;
    private float mouseX;
    private float mouseY;
    
    private void Update()
    {
        mouseX = Input.GetAxis("Mouse X") * sensitivity;
        mouseY = Input.GetAxis("Mouse Y") * sensitivity;
        
        // Rotate the camera holder (vertical rotation - pitch)
        xRotation -= mouseY;
        xRotation = Mathf.Clamp(xRotation, -90f, 90f);
        cameraHolder.localRotation = Quaternion.Euler(xRotation, 0f, 0f);
        
        // Rotate the player body (horizontal rotation - yaw)
        yRotation += mouseX;
        playerRb.rotation = Quaternion.Euler(0f, yRotation, 0f);
    }
    
}
rich adder
polar acorn
keen cargo
#

oh yeah that's a huge mistake, it causes so many issues

#

rigidbodies aren't meant to be transformed or translated

#

especially if you have interpolation on in them

wraith shuttle
#

didnt see the chat for sometime mb

#

but i dont know what to do espically now the problem is back

#

it falls down even when i change up to left or to anything

rich adder
eternal falconBOT
wraith shuttle
rich adder
wraith shuttle
rich adder
#

also show origin of the bullet

wraith shuttle
rich adder
#

and dont ss code

lapis yew
#

if youre using a rigibody why dont apply force in the gun script

wraith shuttle
#

thanks

rich adder
wraith shuttle
wraith shuttle
#

and to change the transform.translate to rb.linearvelocity

keen cargo
#

if you don't understand how to make code blocks in discord then you can use one of those links and post code in there instead

rich adder
wraith shuttle
rich adder
#

no use links

wraith shuttle
#

thanks

rich adder
#

codeblocks are meant for small code

keen cargo
#

his looked small enough, though yeah it's probably easier to just use the links

rich adder
#

an entire class i not small code lol

keen cargo
#

oh he posted an entire class? 💀

#

use the links brother

wraith shuttle
#

what to do to continue

rich adder
#

jesus christ dude

wraith shuttle
wraith shuttle
rich adder
#

making a game is more complex then copy and pasting

wraith shuttle
frigid sequoia
#

Can I make all those default values of the Selectable that I am not using not show in inspector? Cause they seem quite hard to find on the Selectable Interface

keen cargo
#

just a quick question, have you went through the unity learn stuff

rich adder
keen cargo
#

@wraith shuttle

wraith shuttle
keen cargo
#

finish all of it

wraith shuttle
#

and plane

#

and the other stuff

#

and watched a yt tut

rich adder
#

clearly wasnt enough..

keen cargo
#

it's hard to believe that you went through everything if you don't know about sending links

rich adder
#

anyway show the required stuff. and make a thread so you don't flood other peoples questions

wraith shuttle
#

simple as that

keen cargo
#

brother make a thread

rich adder
#

what was hard about changing

rb.linearVelocity = Vector3.left * Speed * Time.deltaTime;
to
rb.linearVelocity = Vector3.left * Speed;

#

and also that direction looks sus.. why is it left. You have to show all the pivots

#

again in a thread..

wraith shuttle
wraith shuttle
rich adder
#

that wont fix falling directly but other issues later on / change of fps

wraith shuttle
#

i wanted to make sure that it isnot that

#

i changed it later to forward

#

and now it works thanks

keen cargo
#

if you come back when it's not working again then please make a thread

wraith shuttle
#

confusing ik

wraith shuttle
rich adder
#

don't see how that fixed falling

#

btw deltaTime was reason it was slow unless speed around this high Speed = 100f

wraith shuttle
rich adder
#

very skeptical

tawny ermine
#

Because they are live in everything the do

keen cargo
#

what?

rich adder
#

what?

polar acorn
#

what?

keen cargo
#

is that a bot? super sus username

polar acorn
#

probably

tawny ermine
keen cargo
#

what is this about the live support team????

rich adder
#

spambot going haywire

wraith shuttle
#

ehh i was wrong i didnt finish all the unity pathway

keen cargo
#

<@&502884371011731486> i think we got a spambot, seeing weird stuff from the python server as well, looking at their messages there

#

don't double ping

wraith shuttle
#

i hate myself cyaaaa

rich adder
wraith shuttle
#

didnt do the sound effect , etc ...

frosty hound
#

@tawny ermine There is no off topic here. If you're not contributing to the conversation, please don't post.

rich adder
keen cargo
golden notch
#

cameraObject = Camera.main.transform; is null, it shouldn't be. I am following a tutorial and so far the camera is null for some reason.

polar acorn
golden notch
polar acorn
#

Are you getting an error? Or is the code just not doing what you expect?

golden notch
#
PlayerLocomotion.HandleMovement () (at Assets/Scripts/PlayerLocomotion.cs:29)
PlayerLocomotion.HandleAllMovement () (at Assets/Scripts/PlayerLocomotion.cs:23)
PlayerManager.FixedUpdate () (at Assets/Scripts/PlayerManager.cs:22)```
#

when i start the game, this spams my console

keen cargo
#

That looks like it's an issue at playerlocomotion

#

Where is it attached to

golden notch
#

the character

#

does the camera need to be in the character too?

keen cargo
#

Check if the character has everything assigned to it

#

No you don't need to put the camera there

golden notch
keen cargo
#

show the playerlocomotion script in full

golden notch
polar acorn
golden notch
#

it still says 29 what?

keen cargo
#

hmmm so the cameraObject = Camera.main.transform; line could be the problem, because i don't think that's how you get the transform of the camera

i believe what's happening there is that you're trying to get the transform of the camera class itself?

polar acorn
golden notch
#

ook it says 30 now

polar acorn
#

Try logging both and see which one is null

keen cargo
#

Debug.Log(whatever you're logging)

polar acorn
keen cargo
#

i think the issue there is the camera, you'd have to reference it in another way

polar acorn
#

If the camera were the problem, the null reference exception would be in awake when they try to get .transform from it

keen cargo
#

yeah you're probably right, do try logging though

golden notch
#

i think i fixed it

#

i forgot to add one of the scripts to the character

#

now i can move it too

#

the camera doesn't move though

#

i'll work on that

#

thanks guys

hushed ridge
#

how come rigidbodies are allergic to stopping

#

my bullets hit the ground and rotate along a flat plane forever

rich adder
#

also should probably put up angular drag higher

teal viper
twin pivot
twin pivot
stray summit
#

hi guys

teal viper
stray summit
#

can you help me how to make annotation and line renderer in unity

twin pivot
#

ah sorry

teal viper
twin pivot
prime cobalt
#

Hey so is there a way to make it so that an input axis will just instantly go to zero when nothing is being pressed instead of the smooth return to zero?

wintry quarry
#

GetAxis has smoothing

prime cobalt
#

OK thanks

wraith shuttle
twin pivot
golden notch
#

why does it say Scene instead of the animation name?

cinder crag
#

so i got this code where im trying to play a different sound depending on how high i slam from , so if i slam from a not so high ground then play the small calm slam sound but if i slam from high ground then play the aggresive big slam sound, for some reason even if checked everything , the big sound sometimes works fine but then decides to not work fine

ivory bobcat
cinder crag
twin pivot
wintry quarry
#

and your IDE should show the options too

twin pivot
#

i misunderstood lol, thanks for the help

golden notch
#

welp... idk why it's doing this

unkempt flicker
#

Whatever animation you are trying to use is 0 frames long - no animation

Which would probably be why you are getting that the 'position' is out of range

ivory bobcat
cinder crag
golden notch
ivory bobcat
golden notch
#

yeah i tried everything i could think of, idk how to properly export animations even with the animation helper that I am using

unkempt flicker
cinder crag
ivory bobcat
stable moat
#

hi sorry to interrupt anyone im not sure if im in the right place for this im working on a project for school this is not my major thank goodness but i got stuck with the code of the game in the project we are making and im not sure about 2 things when i put '.m_BoundingShape2D' i get and error also player.transform.position; and newPos is giving me an error as well any solutions ?

eager spindle
#

Hover over m_boundingshape2d and tell us the rrror

stable moat
# eager spindle Hover over `m_boundingshape2d` and tell us the rrror

in need the player to move in front of a boundary i have set, basiclly they walk into the first boundary that switches cam positions and then there's another bound that if they walk into that it would switch the positon again so i need to move the player in front of the second boundary thats what its for i hope that explains it

ivory bobcat
#
Vector3 newPos = -player.transform.position;```
stable moat
ivory bobcat
#

Also, I'm not sure about the 2d variant but the 3d confiner is expecting a collider2d but you're trying to assign it a cinemachine confiner 2d (?) apparently. Show your updated code.

#

I'm assuming you accidentally changed the type for map boundary to confiner 2d when the error was produced, script hasn't been saved or something else

ivory bobcat
ivory bobcat
#

Specifically, we need to see the field declaration and current error line after the script has been saved.

toxic verge
#

can anyone help me learn how to make a first person walking script i cant find any good tutorials

stable moat
tacit torrent
#

Sorry my wifi cut out...

I'll look into these methods and decide which one works

toxic verge
polar acorn
toxic verge
polar acorn
#

I'm pretty sure I could trip over seven of them on my way to the bathroom if I'm not careful

#

Where are you looking that there are none. Show your search results

ivory bobcat
# stable moat

I'm not sure which version of cinemachine you're using but according to blue the new field should be BoundingShape2D instead of the older m_Bou...

toxic verge
#

they are all either about animations or i tried and dont work but i did it correct

wintry quarry
toxic verge
wintry quarry
#

you would have to show a tutorial you tried and what you did and what happened

wintry quarry
polar acorn
#

That third one is animations, but all the rest are character controllers that'll work

toxic verge
#

https://www.youtube.com/watch?v=f473C43s8nE

the character just falls dont and the camera doesnt work

FIRST PERSON MOVEMENT in 10 MINUTES - Unity Tutorial

In this video I'm going to show you how to code full first person rigidbody movement. You can use this character controller as final movement for your game or build things like dashing, wallrunning or sliding on top of it.

If this tutorial has helped you in any way, I would really appreciate...

▶ Play video
toxic verge
wintry quarry
#

prove it

toxic verge
wintry quarry
#

Because the tutorial works

#

and yours didn't

toxic verge
#

sure

polar acorn
ivory bobcat
# toxic verge how do you know

It's the most common plausible cause for YouTube video tutorials working but the user's copy not working - human error.

polar acorn
#

I literally keep a running tally of this

toxic verge
#

im pretty sure this is the exact same (other than my model because its not a capsule like his)

polar acorn
toxic verge
polar acorn
toxic verge
#

and your supposed to help me answer

#

not laugh at me like im some idiot

wintry quarry
#

don't start changing things until you get the tutorial working and you understand the whole thing

toxic verge
#

i havent changed anything

wintry quarry
#

You're not using a capsule, for one

toxic verge
#

other than adding a collider to my model so it wouldnt fall

toxic verge
#

because i like my player model

wintry quarry
#

The player model is irrelevant

toxic verge
#

why

wintry quarry
#

it's a first person controller

#

first off

#

second off - the movement etc is capsule based

toxic verge
#

but it will be multiplayer

wintry quarry
#

You need to learn to crawl before you start doing olympic marathons

#

worry about that later

toxic verge
#

i know how to crawl

wintry quarry
#

trust me it's not relevant

#

If you can't make a first person controller, you are still learning to crawl in Unity

polar acorn
toxic verge
#

so i spent a long time learning blender and my models are irrelevant

wintry quarry
#

your models are irrelevant for the thing you're trying to do right now which is make a first person controller

toxic verge
wintry quarry
#

the tutorial uses a capsule

#

you should be using a capsule

toxic verge
wintry quarry
#

worry abouit that after

#

it's not hard, but it's not worth jumping ahead

polar acorn
#

The actual model doesn't matter, only the collider is relevant for movement

ivory bobcat
#

Get the tutorial working first. Not wing it as you go

#

It'll be easier to eliminate issues that way

toxic verge
#

ok

#

i will try that

polar acorn
wintry quarry
#

yes you'd have to also show that each object has the right components, and that the fields are all assigned correctly

toxic verge
#

i have implemented the capsule and done the tutorial but it still doesnt work

wintry quarry
#

show the objects

#

we need to see the inspectors of the various objects to make sure you've set them up properly

polar acorn
#

And say what the actual problem is

wintry quarry
#

you should also be more specific about what "doesn't work" means

ivory bobcat
#

Do you fall through the world, aren't able to rotate, not move, camera doesn't follow etc

toxic verge
#

thank you guys for your help

golden notch
#

Assets\Scripts\InputManager.cs(58,34): error CS0117: 'Color' does not contain a definition for 'FromArgb' WHAT?

sour fulcrum
#

Color does not contain a definition for FromArgb

golden notch
#

new Color(1f,0f,1f);
Assets\Scripts\InputManager.cs(59,46): error CS1503: Argument 2: cannot convert from 'double' to 'float

wintry quarry
#

check your using directives

golden notch
#
using System.Collections.Generic;
using UnityEngine;```
wintry quarry
#

Make sure you're looking at line 59

#

what's on line 59?

golden notch
#

Gizmos.DrawWireSphere(hit.point, 0.2);

wintry quarry
#

You forgot the f

#

on 0.2f

golden notch
#

and a runtime error, great

#

fixed that issue though

#
UnityEngine.InputSystem.LowLevel.NativeInputRuntime/<>c__DisplayClass7_0:<set_onUpdate>b__0 (UnityEngineInternal.Input.NativeInputUpdateType,UnityEngineInternal.Input.NativeInputEventBuffer*)
UnityEngineInternal.Input.NativeInputSystem:NotifyUpdate (UnityEngineInternal.Input.NativeInputUpdateType,intptr)```
wintry quarry
#

show the rest of the stack trace

golden notch
#
UnityEngine.Input.get_mousePosition () (at <0b0249d5e61a446b913cd2910a5a40f5>:0)
InputManager.SelectItem () (at Assets/Scripts/InputManager.cs:56)
InputManager.<OnEnable>b__9_2 (UnityEngine.InputSystem.InputAction+CallbackContext i) (at Assets/Scripts/InputManager.cs:27)
UnityEngine.InputSystem.Utilities.DelegateHelpers.InvokeCallbacksSafe[TValue] (UnityEngine.InputSystem.Utilities.InlinedArray`1[System.Action`1[TValue]]& callbacks, TValue argument, System.String callbackName, System.Object context) (at Library/PackageCache/com.unity.inputsystem@1.0.2/InputSystem/Utilities/DelegateHelpers.cs:51)
UnityEngine.InputSystem.LowLevel.<>c__DisplayClass7_0:<set_onUpdate>b__0(NativeInputUpdateType, NativeInputEventBuffer*)
UnityEngineInternal.Input.NativeInputSystem:NotifyUpdate(NativeInputUpdateType, IntPtr)```
wintry quarry
#

Seems pretty straightforward

#

your code is trying to use Input.mousePosition but you switched to the new input system

golden notch
#

strange as the tutorial i am watching used that just fine somehow

wintry quarry
#

In the tutorial they are not using the new input sytem

#

or they are using "Both"

ivory bobcat
#

Their player settings might be set to both whereas yours isn't

golden notch
#

so what do i remplace 'Input.mousePosition' with then?

wintry quarry
#

Mouse.current.position.ReadValue()

golden notch
#

what the actual...
Assets\Scripts\InputManager.cs(56,57): error CS0103: The name 'Mouse' does not exist in the current context

#

i swear i attract all the errors and i hate it

#

i just want to make a cool game

slender nymph
#

Are you missing a using directive?

wintry quarry
#

your IDE will automatically suggest the fix

#

follow it

golden notch
#

i'm using Visual Studio and it has zero context on what is and is not valid, idk how to set it up properly

slender nymph
#

in fact, while typing that your IDE should have suggested the Mouse class with the correct namespace

eternal falconBOT
wintry quarry
#

you need to set it up^

#

that should be done before anything else

golden notch
#

i don't even see a workloads tab

wintry quarry
#

where are you looking

golden notch
#

i looked in unity, and on visual studio (on the hub) and when it's open for a new project

wintry quarry
#

neither of those are where the instructions tell you to go

golden notch
#

oh i thought it meant if i already had it installed

golden notch
#

well i messed up 2022 version of Visual Studio

#

2019 is fine though

twin pivot
#

Having IDE makes this so much easier

languid jacinth
#

on mobile rn so figured forwarding would be best because files

twin pivot
languid jacinth
#

oh my bad, should i do screenshots instead?

naive pawn
#

no that's worse

#

!code

eternal falconBOT
naive pawn
#

it's not that we don't allow files, but they just aren't a good way to show what you have

#

though, i'd recommend you wait until you can get back on PC so you can actually test stuff or give more info from your project

languid jacinth
#

ill get back on rn i just figured it would take a lot longer for a response so i got off

twin pivot
#

This channel is quite quick with responses in my opinion

naive pawn
#

eh it fluctuates with time of day lol

languid jacinth
wintry quarry
languid jacinth
#

the way my game is set up its going to be a co op fps tps shooter kind of like fallout is, right now in a host/client instance of the game i have set up through relay, when both of us look around in first person it doesnt show either of us actually looking around, however in third person everything works perfect. im not sure exactly what im missing

wintry quarry
languid jacinth
#

yes

#

on either of our screens

wintry quarry
#

WHich object is your code actually rotating

#

and is that object network synced

#

and is the rotation synced for it

#

Also does the object you are rotating have any connection at all to the visual object you expect to rotate

#

I see this:

    private void LateUpdate()
    {
        if (playerRoot != null)
            playerRoot.rotation = Quaternion.Euler(0f, yaw, 0f);

        if (headBone != null)
            headBone.localRotation = Quaternion.Euler(pitch, 0f, 0f);

        if (IsOwner && fpsCam != null)
            fpsCam.transform.localRotation = Quaternion.Euler(pitch, 0f, 0f);
    }```
#

I would guess for one that the camera is not visible in any way, so the up and down pitch look certainly won't be visible

#

similarly for the headBone - you would need to be syncing that

#

and playerRoot

languid jacinth
#

im rotating the player root and yeah i have a network object on it as well

wintry quarry
#

with what settings

#

do you ahve a NetworkTransform

languid jacinth
#

yes

wintry quarry
#

with what settings

languid jacinth
#

the only way ik to do this is w screenshots so

wintry quarry
#

What doe this hierachy look like, and what is your network topology?

#

if third person works properly I would really just guess that the two scirpts are rotating different objects.

#

Oh also:

SendYawToServerRpc(yaw);```
languid jacinth
#

im running a host client set up where i host with unity relay and he uses my code to join me

wintry quarry
languid jacinth
#

would it be best to use an rpc for fps as well

wintry quarry
wintry quarry
languid jacinth
#

client then

wintry quarry
languid jacinth
#

i just dont think its an issue with the networking, i feel like its in the scripting because idk how my third person one would work and the fps not

wintry quarry
#

it's an issue with networking and its interaction with your code

#

your code is not doing what it needs to do to effectuate a change in the rotation of the object over the network

languid jacinth
#

then what is my third person code doing that my first person doesnt

wintry quarry
#

well as mentioned it's doing the RPC

#

for one

#

for two it might just be rotating the correct object

#

it's hard for me to know just from seeing the code which objects are actually being rotated

#

because I don't know which object each script is attached to nor which objects are being referenced in the inspector

languid jacinth
#

they are both set up the same way under fpscam and tpscam, with the root object set as my military character

wintry quarry
#

also are both of these scripts active at once

languid jacinth
#

they are only active based on what camera im on, i use camswap to disable the non active pov

#

could it be because my p1cam updates netLook.Value on the server but it doesnt update the local yaw/pitch on the server

#

im genuinely lost on how i made it work on one camera but not the other

wintry quarry
#

Well I noted that RPC thing a while ago have you tried that?

#

networking is very hard 🙂

languid jacinth
#

thats why im trying to figure it out first, so that way i can have all that worked out before i start adding everything else in. i am trying to see if i can get it to work differently with and without the rpc but it seems to do the same

thick spoke
#

welp, any ideas, so i am making a tower defense game, so i got the enemys path, i made it so that it goes in order of the stuff inside the parent, do i have to sort it manually?

wintry quarry
#

What are you trying to figure out here or achieve?

thick spoke
# wintry quarry you made it so _what_ goes in the order of stuff inside _what parent_?

i am going to explain it clearly, sorry for my vague explanation earlier, so i got towers spawning , they are supposed to go on the path shown in the picture (i dont have intersect texture yet) the way i programmed is for the code which is attached to the enenmy, to find the tag "Path" which is attached to the parent of the road, you can see it in the picture, its called Enemy path. after it finds the tag, it goes through the children in order, here comes my problem, it takes a bit of time to do it manually, is there any other ideas, beside timeline

wintry quarry
#

basically you would need to build a graph representation out of this

thick spoke
wintry quarry
#

and then you can do any off the shelf pathfinding algorithm like Djisktra's or A* on the graph

thick spoke
thick spoke
wintry quarry
#

you should use a tilemap

#

and then you can just do a pathfinding algorithm on the tilemap grid

wintry quarry
thick spoke
#

i see, thank you, i will try to learn about it

wintry quarry
#

The other option is to manually order them yes

#

but that's going to be a huge pain in the ass

#

pain to create, pain to maintain

#

also how would it work for the intersection parts?

thick spoke
#

yeah, agreed, i guess i will try to learn them

wintry quarry
#

you could certainly do a waypoint-based system

thick spoke
wintry quarry
#

that might actually be better for this - if they need to loop

thick spoke
#

i still tryna make the texture, the picture i provided uses asset store, i just dont know where to edit stuff inside unity, i tried importing it into blender

thick spoke
languid jacinth
#

I added a debug log to show the pitch and yaw it is sending to the server, it is constantly showing the right values but the rotation isnt changing still

thick spoke
naive pawn
thick spoke
#

does obs support mp4?

#

yep

naive pawn
#

pretty sure it does, if you can't find it you can just convert the file you have online

thick spoke
#

why does that happen? any ideas?

wintry quarry
thick spoke
# wintry quarry bad code presumably

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

[RequireComponent(typeof(Enemy))]
public class EnemyMover : MonoBehaviour
{
[SerializeField] List<Waypoint> path = new List<Waypoint>();
[SerializeField] [Range(0f , 5f)]float Speed = 1f;

Enemy enemy;

// Start is called before the first frame update
void OnEnable()
{
    FindPath();
    returntostart();    
   StartCoroutine(PrintwaypointName());

    
}

void Start()
{
    enemy = GetComponent<Enemy>();
}

void FindPath()
{
    path.Clear();
    GameObject parent = GameObject.FindGameObjectWithTag("Path");

    foreach(Transform child in parent.transform)
    {
        Waypoint waypoint = child.GetComponent<Waypoint>();

        if(waypoint != null)
        {
            path.Add(waypoint);
        }
        
    }
}

void returntostart()
{
    transform.position = path[0].transform.position;
}

void finishPath()
{
    gameObject.SetActive(false);
    enemy.StealGold();
}

IEnumerator PrintwaypointName()
{
    foreach(Waypoint waypoint in path)
    {
        Vector3 startPoisiton = transform.position;
        Vector3 endPoisiton =  waypoint.transform.position;
        float TravelPercent = 0f;

        transform.LookAt(endPoisiton);

        transform.position = waypoint.transform.position;

        while(TravelPercent < 1f)
        {
            TravelPercent += Time.deltaTime * Speed;
            transform.position = Vector3.Lerp(startPoisiton, endPoisiton, TravelPercent);
            yield return new WaitForEndOfFrame();
        }
        
    }

    finishPath();   
    
}

}
`

wintry quarry
#

close, but no cigar

#

!code

eternal falconBOT
thick spoke
wintry quarry
#

Also do your enemies have a Rigidbody on them?

thick spoke
thick spoke
wintry quarry
#

not sure what you mean by that

thick spoke
wintry quarry
#

You should double check there is no movement code on any other script as well

#

also Lerp isn't really appropriate here unless you can guarantee the waypoints are perfectly evenly spaced

#

MoveTowards would be better

wintry quarry
#

there might be something in another script

thick spoke
thick spoke
#

yep they are evened, i just checked

wintry quarry
#

regardless your "speed" is now expressed in terms of 1 / waypointDistance instead of just being an actual speed this way

#

also is any other script enabling/disabling this component by the way?

#

perhaps it's best if you just share the rest of your code

thick spoke
wintry quarry
#

using the paste site as you did before is fine

thick spoke
wintry quarry
#

the three scripts on the enemy would be a good start

thick spoke
#

sure

#

wait a miute

#

i think i found out the problem

#

ah fuck my life

#

i had to of the mover script on my "ram" each one had a diffrent speed, :/

wintry quarry
#

yep that'll do it

thick spoke
#

sorry for troubling you 🙏

wide whale
#

building the game on Unity 6 suddenly always ends on
Running Backend without any messages, how to fix this

#

[it was originally 2023.2.20f1]

surreal coyote
#

Hi, does anyone have any idea whats causing the jittering on objects when moving and looking around with the camera? im using a rigid body on the player and here is my movement and camera code:

void Update()
    {
        if (!isLocalPlayer) return;

        HandleLook();
    }

    void FixedUpdate()
    {
        if (!isLocalPlayer) return;

        HandleMovement();

        rb.angularVelocity = Vector3.zero;
    }

    private void HandleMovement()
    {
        Vector3 move = new Vector3(moveInput.x, 0, moveInput.y);
        move = transform.TransformDirection(move);

        Vector3 targetVelocity = move * moveSpeed;
        Vector3 velocity = rb.linearVelocity;

        rb.linearVelocity = new Vector3(targetVelocity.x, velocity.y, targetVelocity.z);
    }

    private void HandleLook()
    {
        Vector2 lookDelta = lookInput * lookSensitivity * Time.deltaTime;

        transform.Rotate(0f, lookDelta.x, 0f);

        cameraPitch -= lookDelta.y;
        cameraPitch = Mathf.Clamp(cameraPitch, -85f, 85f);

        if (cameraHolder != null)
        {
            cameraHolder.localEulerAngles = new Vector3(cameraPitch, 0f, 0f);
        }
    }
teal viper
keen dew
#
  1. Don't multiply mouse input by deltatime
wide whale
frail hawk
#

also i would change the order of these 2 lines

        cameraPitch -= lookDelta.y;
        cameraPitch = Mathf.Clamp(cameraPitch, -85f, 85f);
surreal coyote
#

thank you, i did what dlich said and rotated via rigidbody instead of transform and removed the multiply by deltatime and it is much better, there seems like theres a little jittering still but that might just be my eyes messing with me lol

mighty citrus
#

Hello! I've had a bit of an "issue" of serializing a dictionnary and followed an idea of having two seperate lists as [SerializeField]. Would it be possible to have a common size, so that if I change that size value in the inspector it also increases the size of both lists?

north kiln
mighty citrus
#

damn so I do have to use the custom Dictionnary then :/

naive pawn
mighty citrus
#

Is it an already existing asset?

timber tide
#

Just make a struct with key and value then make the dictionary at runtime

mighty citrus
#

if possible I want to make prefabs of them

timber tide
#

Array of structs that hold those values -> initialize dictionary in awake

tender gazelle
#

so i really need some help. idk why but my Character jumps in the air. I've watched every single video on youtube. asked Chat Gpt and much more but i never risolved it. And i need to finish this as a School Project so i really could use some help.

mighty citrus
#

so something like this:

struct pair{
  private ressourceType key;
  private int value;
}
hidden marten
#

is this an optimal way of adding force if im using velocity to move the player? (im worried because the debug.log(force) stops giving readings once it is less than 3)

timber tide
#

Is there a reason you're setting velocity if you're using forces

frail hawk
#

seems like you are playing animations when you should not.

#

i would simly move the logic from the !isGrounded if statement into the if statement on line 41 and get rid of the was grounded part

mighty citrus
#

I can't see the array in the inspector, am I doing something wrong?

[SerializeField] private List<pair> ressourcesCosts;

struct pair
{
    public RessourceInfo.ressourceType ressource;
    public int amount;
}

timber tide
#

[Serializable]

#

For structs and classes

mighty citrus
#

oh do I put it in front of struct?

timber tide
#

Before it, ye

mighty citrus
#

kk thanks!

tender gazelle
frail hawk
#

i would use a Trigger to play the jump animation instead a bool that you have to set back

#

this is the part that causes the problem , the wasgrounded and isgrounded part

tender gazelle
frail hawk
#

show your new code (as codeblock or use a codebin)

naive pawn
#

!code

eternal falconBOT
tender gazelle
frail hawk
#

it is still messy, you are still using both bools and please send code instead image of code

red igloo
# surreal coyote Hi, does anyone have any idea whats causing the jittering on objects when moving...

I've been playing around with different camera configurations in Unity to achieve a non-jittery camera and I think I might've come across the best solution.

Timestamps:
0:00 - Introduction
0:42 - Chapter 1: Understanding the problem
1:45 - Chapter 2: FixedUpdate vs Update
4:56 - Chapter 3: The solution
5:17 - Chapter 4: The solution part 2
6:18...

▶ Play video
tender gazelle
# frail hawk it is still messy, you are still using both bools and please send code instead i...

using UnityEngine;

public class PlayerMovement : MonoBehaviour
{
public Animator animator;
public float moveSpeed = 5f;
public float jumpForce = 10f;

private Rigidbody2D rb;
private SpriteRenderer spriteRenderer;
public Transform groundCheck;
public LayerMask groundLayer;

private bool isGrounded;
private bool wasGrounded;

void Start()
{
    rb = GetComponent<Rigidbody2D>();
    spriteRenderer = GetComponent<SpriteRenderer>();

    if (groundCheck == null)
    {
        Debug.LogError("GroundCheck object is not assigned.");
    }
}

void Update()
{
    wasGrounded = isGrounded;
    isGrounded = Physics2D.OverlapCircle(groundCheck.position, 0.2f, groundLayer);

    float horizontalInput = Input.GetAxisRaw("Horizontal");
    rb.linearVelocity = new Vector2(horizontalInput * moveSpeed, rb.linearVelocity.y);

    if (horizontalInput > 0)
        spriteRenderer.flipX = false;
    else if (horizontalInput < 0)
        spriteRenderer.flipX = true;

    if (Input.GetKeyDown(KeyCode.Space) && isGrounded)
    {
        rb.linearVelocity = new Vector2(rb.linearVelocity.x, 0f);
        rb.AddForce(Vector2.up * jumpForce, ForceMode2D.Impulse);
        animator.SetTrigger("Jump");
    }

    animator.SetFloat("Run", Mathf.Abs(horizontalInput));

    if (!isGrounded)
    {
        animator.SetFloat("VerticalVelocity", rb.linearVelocity.y);
    }
    else
    {
        if (!wasGrounded)
        {
            animator.SetTrigger("Land");
        }
    }
}

void OnDrawGizmos()
{
    if (groundCheck != null)
    {
        Gizmos.color = Color.red;
        Gizmos.DrawWireSphere(groundCheck.position, 0.2f);
    }
}

}

red igloo
#

I fixed mine by using cinemachine

surreal coyote
hidden marten
vital helm
#

hello, how can i make growing objects that stops if it cant grow anymore, like when it ran out of space to grow it stops growing in 2d

verbal dome
#

And what shape is it

vital helm
#

just a simple square

#

something like this

verbal dome
#

You could do a Physics2D.OverlapBox on each side of it

#

And grow towards the sides that weren't blocked

#

BoxCast is also possible and can be more accurate for this but is more complex to implement

vital helm
#

what's the difference?

verbal dome
#

BoxCast is like RayCast but it shoots a box

#

So it can tell you how far the box "traveled" before it hit anything

#

While OverlapBox only tells you if anything was in the box area you checked

vital helm
#

oh i see

#

thank you so much

trim gyro
#

Alright so Ive got the basic direction I wanna go with design, but I don’t know where to start in coding

frosty hound
#

You !learn the basics before jumping into making your game.

eternal falconBOT
#

:teacher: Unity Learn ↗

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

odd edge
#
//audioSource.clip = self.SoundEffects.JumpSound; // self is the component same component as this script

why does this not work

#

it says it needs an object reference but i gave that right?

naive pawn
#

it's commented out

odd edge
#

no not in the original code

odd edge
#

i did ```cs
// Your code here

#

like it said

#

but why does it not work

#
audioSource.clip = self.SoundEffects.JumpSound; // self is the component same component as this script

why does this not work

naive pawn
eternal needle
odd edge
polar acorn
#

You appear to be trying to access an instance variable with the class name rather than a variable

polar acorn
eternal needle
# odd edge

also show the relevant code rather than just the one line

#

are you calling this from a static method

odd edge
polar acorn
eternal needle
#

DashSound and JumpSound are instance variables, so you cant access them via the type SoundEffects

#

is there a reason this is even a class

#

just put the dash sound and jump sound inside Move and capitalize Move to keep it consistent

polar acorn
# odd edge No?

Then you don't have access to those variables because they only exist on an instance of SoundEffects

odd edge
polar acorn
#

You probably shouldn't use nested classes until you've fully grasped the difference between a class and an instance

odd edge
polar acorn
odd edge
polar acorn
# odd edge Instance?

A class is not an object. It's a pattern that tells an object what it can do. Until you create an instance of the class, it does not exist

polar acorn
#

A blueprint of a house is not a house

odd edge
eternal needle
eternal needle
polar acorn
eternal needle
#

unless im remembering wrong

polar acorn
#

It's not serializable and they don't have a variable that can hold one

eternal needle
#

either if its for seeing in your IDE or inspector, you wouldnt want to just make classes like this because it becomes more annoying to write. For now you should definitely avoid classes within classes

odd edge
#

Ok

cinder crag
proper pasture
#
if (dataFloatActive[i] < (6 / 255) || dataFloatActive[i] >= (249 / 255))
{
  floatSmoothingMultiplier[i] = 0; // Set to 0 here
}
  if (dataFloatActive[i] <= 30/255 && dataFloatActive[i] > 6/255) 
{
  floatSmoothingMultiplier[i] = ((dataFloatActive[i]-6/255)/((30-6)/255))* floatSmoothingMultiplier[i]; 
}
  if (dataFloatActive[i] < 249/255 && dataFloatActive[i] >= 225/255)
{
  floatSmoothingMultiplier[i] = -((dataFloatActive[i] - 6/255) / ((255 - 6)/255))* floatSmoothingMultiplier[i];
}
  else
{
  floatSmoothingMultiplier[i] = 1;
  // if not in these ranges, smoothing is unchanged
}
// Finish Dynamic Smoothing
Debug.Log(dataFloatActive[0]);
Debug.Log(floatSmoothingMultiplier[0]);

Is this a valid IF statement?
I am trying to change an array indices 'floatSmoothingMultiplier' to be a function of the corresponding indices in the array 'dataFloatActive'
The values in 'dataFloatActive' range 0-1, and the floatSmoothingMultiplier is set to 1 before this block of code

Outputting 'dataFloatActive' at the indice of 0 into the console shows that it does change properly when triggered, but it either uses the 'else' portion of the statement, or uses the first 'if' statement if the 'else' is empty
The math does work properly if it is forced, but the if statement just.. doesnt work?

zenith cypress
#

6 / 255 is 0, 249 / 255 is 0. If there is no float in the operation, you will be hitting integer math, which has no decimal places.

proper pasture
#

both of these arrays are declared as 'public float[]' near the start of the script im modifying

#

in the console, 'dataFloatActive[0]' is outputting 0.0196, which corresponds to the 5/255 I am inputting. The second value in the pair, which is stuck at 1, is the floatSmoothingMultiplier[0]. But in the if statement, it should be 0?
If I make the else statement empty, it gets stuck at 0

proper pasture
#

Should I declare the variables its comparing to as floats, then put them in?

eternal needle
#

it doesnt matter that dataFloatActive[i] is a float. (6 / 255) is still 2 ints so the result is an int, thus 0. Afterwards its compared to with dataFloatActive[i] < (6 / 255) so its dataFloatActive[i] < 0

proper pasture
#

ah ok

trim aurora
#

can anyone help me with my portal not changing scenes even tho it's working on other levels

trim aurora
# frail hawk post some code please

void Update()
{

}
private void OnCollisionEnter2D(Collision2D other)

{
if (other.gameObject.CompareTag("Player"))
{
SceneManager.LoadScene("Level 9");
}
}

trim aurora
#

no there weren't

#

it's just not registering

ivory bobcat
#

Maybe the other object wasn't tagged "Player"?

trim aurora
#

nope i made sure it was tagged

ivory bobcat
#

Place a log to see if it occurred and what the tag of the object was

frail hawk
#

i am assuming the scene doest exist.

proper pasture
trim aurora
#

nah the scene does exist. can i share my screen somewhere bc i suck at explaining im sure the fix is simple i'm just not seeing it

frail hawk
#

check the "scenes in build" window and see if the scenes you try exist there

trim aurora
ivory bobcat
#

You'll need to provide some info for us to check where you might have made a mistake.

frail hawk
#
 private void OnCollisionEnter2D(Collision2D other)
  {
      if (other.gameObject.CompareTag("Player"))
      {
          Debug.Log("working");
          SceneManager.LoadScene("Level 9");
      }
  }

this could give you a hint

trim aurora
#

aight let me try it out

ivory bobcat
tender gazelle
#

oh ok👍

naive pawn
#

spamming your post is not acceptable either, please remove your posts

trim aurora
frail hawk
#

no logs

#

also you need only one collider why do you have so many

trim aurora
#

cause i was testing with multiple colliders to see if one of them was the issue

polar acorn
eternal needle
trim aurora
tender gazelle
polar acorn
trim aurora
polar acorn
#

Through the rigidbody or the transform

#

Not going to get a collision event with that

trim aurora
polar acorn
trim aurora
trim aurora
polar acorn
#

Don't use transform to move an object with a rigidbody on it

ivory bobcat
# trim aurora wdym

Transform teleports and object and doesn't respect the physics engine/simulation

true owl
#

for some reason both of the Debug.Log's are running

#
    void OnJump(InputValue value)
    {
        // Can jump only if player collider is touching ground, preventing multi jump
        if (value.isPressed)
        {
 
            Debug.Log($"IsGrounded: {PlayerState.Instance.IsGrounded}");
            // checking for valid jump coniditions 
            if ((PlayerState.Instance.IsGrounded || PlayerState.Instance.IsOnRail) && canJump)
            {
                Debug.Log("Running typical jump");
                PerformJump();
                canJump = false;
            } else if (canJump) { // these are performed in the case that a normal jump should've gone through but didn't cause the conditions weren't met
                JumpBuffer();
                ApplyCoyoteTime();
                canJump = false;
            }
            PlayerState.Instance.IsJumping = true;
        }
    }
#

specifically in this part, even though I have an if statement

#

So it ends up printing out both "Running typical jump" and "applying coyote time", when it's only supposed to apply the coyote time when I'm slightly late on my jump

grand snow
#

its currently (is grounded OR is on rail) AND can jump)

true owl
#

yes but it's an if and else if

#

so if the if runs the else if shouldn't?

grand snow
#

correct but I see no log in the else if(canJump) section above

true owl
#

I'm sorry I posted the full code above

#

but essentially there's a log for "Applying coyote time" elsewhere

#
    void ApplyCoyoteTime() {
        
        // if they're not touching any layers and the time since they've been falling is less than the allowed coyote time
        // perform a jump
        if (PlayerState.Instance.CheckIfNotTouchingLayers() && timeSinceStartedFalling < jumpBufferTime && PlayerState.Instance.TimeSinceLeftJumpableSurface() < jumpBufferTime) {
            Debug.Log("Applying coyote time");
            PerformJump();
        }
        
    }
#

right there

grand snow
#

Have you used a debugger to check what is happening?

true owl
#

Unity has a debugger?

grand snow
#

screenshots bad !code

eternal falconBOT
grand snow
#

share it properly 🤦

faint tulip
frail hawk
#

@true owl kind of strange your if statements can you explain what you want, you are checking for canjump then again else if canjump

#

you could put the canjump into the very top if statement if (value.isPressed)

#

these kind of things are small but have big impact and can solve things easly

#

especially when you have a lot of code

true owl
#

so the issue is it's pretty much supposed to print either "Running typical jump" or "applying coyote time"

#

but it prints both resulting in a huge jump

#

only when i am just barely off the ledge (the coyote case)

shell sorrel
#

so i have my movement setup as a state machine but the coyote time is really easy since i just let a jump still happen if a jump has not been used and you have been in the falling state for less then a very small amount of time

true owl
#

I apply the coyote time with that same logic

#

PerformJump() contains the actual logic for jumping

#

and it's called within ApplyCoyoteTime() if the conditions are met

shell sorrel
#

yeah so more or less the same, i did not look at the code, and reading above i thought you were trying to like do it based on distnace or somethign

true owl
#

oh no, it's the same thing based on time passed since left platform and in falling state

shell sorrel
#

though i feel your buffered jump sounds a little odd since you are doing it with a raycast before you hit the ground

true owl
#

really what's wrong with it

shell sorrel
#

it would allow them to get slightly more height then a normal jump

true owl
#

well it says that if there's a jump at this time, then wait till you touch the ground and do a normal jump

#

so it's the same

#

I think

shell sorrel
#

ah why the need for a raycast

true owl
#

it checks if there's an input in this distance, which is basically the buffer I allow for an input

#

I thought the easiest way was a raycast

shell sorrel
#

i did my simply as a if you hit jump and are not grounded it records what time it was pressed, then when you become grounded then it sees if its been recent enough to use it

true owl
#

that also makes sense

#

i feel like both are valid

#

I'd just rather deal with raycasts over times

#

it's easier imo

shell sorrel
#

but yeah good movement code tends to get quite huge, not even feature complete for the one i am doing at work and its already 3kloc

true owl
#

ah okay gotcha

#

i appreciate the suggestion, I think i'm gonna stick with the raycast for now

#

i'll probably end up doing a refactor in the future

golden notch
#

ok so my player is moving down very slowly

#

when they are falling

polar acorn
#

You are probably setting the Y velocity to 0 somewhere in your movement code

frail hawk
golden notch
#

moveDirection.y = 0; yeah hmmm i need to resume that tutorial

#
    {
        //Debug.Log(cameraObject +", " + inputManager.verticalInput);

        moveDirection = cameraObject.forward * inputManager.verticalInput;
        moveDirection = moveDirection + cameraObject.right * inputManager.horizontalInput;
        moveDirection.Normalize();
        moveDirection.y = 0;
        moveDirection = moveDirection * movementSpeed;

        Vector3 movementVelocity = moveDirection;
        playerRigidbody.velocity = movementVelocity;
    }```
frail hawk
#

yeah as digi said

polar acorn
#

instead of setting it to 0

unborn valley
#

God i'm trying to make a loading system for a revolver and my code is so stupidly ugly

#
private void Load()
    {
        int bulletsToLoad = weaponCapacity - loadedBullets;

        if (bulletsToLoad <= storedBullets)
        {
            storedBullets -= bulletsToLoad;
            loadedBullets = weaponCapacity;
        }
        else
        {
            storedBullets = 0;
            loadedBullets += storedBullets;
        }
    }
#

There's gotta be a cleaner way to do it ugh

rocky wyvern
#

Sounds like you need mathf.min

unborn valley
#

Sorry lol lemme check the docs up to see how that'd work

frail hawk
unborn valley
#

No yeah how would you even use Mathf.Min in that context

polar acorn
#

It returns the smaller of two values

unborn valley
#

I know, but still, how'd you apply it?

polar acorn
#

You'd get the min of bulletsToLoad and Stored bullets, then subtract that from stored bullets and add it to loaded bullets. No if statement required

unborn valley
#

Please allow my peanut brain to process

#

Wait

rocky wyvern
#

Like bulletstoload = mathf.min(
capacity - loaded,
stored);
Then just add and subtract bulletstoload from your tracked stored and loaded

#

You don’t need any checks because it will never be lower than 0 or make the loaded higher than capacity

#

And will at most be the correct amount to reload

unborn valley
#

Oh yeah that makes sense

#

I'll go correct my yandev-esque code then

#

Thanks

proper pasture
# eternal needle realistically it should work if you put it on just one of the two but yea might ...
                                        {
                                            floatSmoothingMultiplier[i] = 0; // Set to 0 here
                                        }
                                        if (dataFloatActive[i] <= 30.0f / 255.0f && dataFloatActive[i] > 6.0f / 255.0f)
                                        {
                                            floatSmoothingMultiplier[i] = ((dataFloatActive[i] - 6.0f / 255.0f) / ((30.0f - 6.0f) / 255.0f)) * floatSmoothingMultiplier[i];
                                        }
                                        if (dataFloatActive[i] < 249.0f / 255.0f && dataFloatActive[i] >= 225.0f / 255.0f)
                                        {
                                            floatSmoothingMultiplier[i] = -((dataFloatActive[i] - 6.0f / 255.0f) / ((255.0f - 6.0f) / 255.0f)) * floatSmoothingMultiplier[i];
                                        }
                                        else
                                        {
                                            // if not in these ranges, smoothing is unchanged
                                        }
                                        // Finish Dynamic Smoothing
                                        Debug.Log(dataFloatActive[0]);
                                        Debug.Log(floatSmoothingMultiplier[0]); ``` 

Ok tried it and.. still didnt work right
unborn valley
proper pasture
unborn valley
#

It's a me issue not a you issue dw

rocky wyvern
#

I’ve read your original message but I still don’t know what you’re trying to achieve

#

Ok so you’re just doing some funky maths to an array of floats from input numbers from an array of floats?

#

What’s the expected outcome and what’s happening instead

proper pasture
#

ok, so the dataFloatActive controls the position of the fixture at the bottom with red arrows pointing to it. Its angle is changed according to an input of 0-255, which is translated to 0-1 somewhere before my edit to this script.
The fixture is intended to smoothly go full circle multiple times, which translate to what is effectivley a sawtooth pattern if one were to plot the dataFloatActive value vs time.
The problem is that the floatSmoothingMultiplier being anything other than 0 when dataFloatActive switches from 0 to 1 or 1 to 0 causes the fixture to do a backflip to try to smooth it as if it tried going the other direction

rocky wyvern
#

I will say that your third if statement will never be true
It’s like if i is less than 0.98 and greater than 1

#

Can you explain in simple terms how you want the fixture to move

#

Because this solution does feel very unnecessary

#

Have you considered using animations

proper pasture
#

it uses animations, however the position needs to be controlled via DMX input (audio visual stuff).
I will get a video of it

dire prairie
#

Hi, I'm a beginner in this, does anyone know how to make the same door as in phaspomohbi? That you press the left button and it opens

hollow wagon
#

could anyone help me? i wanna make a game but idk anything i just wanna make a simple chareccter w animation walk ing running crouching but idk how is there maybe someone who can help or a yt vid that tells how i cant find any

rocky wyvern
quick fractal
hollow wagon
dire prairie
#

or can you send me code to script?

quick fractal
#

If you don't know anything, start with something very simple, like a C# course, anything to get you familiar with the language will go a long way

#

then think about Unity

edgy tangle
#

my favorite software dev saying: “usually the problem is between the keyboard and the chair”

polar acorn
rocky wyvern
#

Only the new input system has changed in regards to what you’re trying to create, but the old input system is still usable so nothing in old tutorials should simply ‘not work’

dire prairie
quick fractal
#

Most old things are marked as obsolete, and most have comments directing you to the correct field

#

A tutorial being old isn't usually a problem

rocky wyvern
#

If you are truly beginner and wish to implement this

#

I would suggest you look into how raycasting works, so you can know if the player is looking at a door

#

And to look into animations and how to control them from scripts, to make the door actually move

dire prairie
#

i am gonna never give up with my door

rocky wyvern
dire prairie
#

okay thanks

proper pasture
#

wai- it was the wrong file format

proper pasture
# rocky wyvern Can you explain in simple terms how you want the fixture to move

This is the intended behavior, where the fixture is able to spin fully in circles. The animation only has it going 0-360 degrees, but the input is a sawtooth pattern, rising to 1, then instantly dropping to 0 to restart the cycle. This has the smoothing off.
At low speeds, it begins to become jittery. with only increments of 1.4 degrees available for the input, it jumps around if small changes are made. This is why I want to add smoothing to it
https://youtu.be/Kt27KSuHqmM

rocky wyvern
#

ok and what about it do you need to change based on user input?

proper pasture
#

What I am trying to do, is scaling the smoothing strength with respect to the current angle/value.
I am trying to make the smoothing reduce to 0 when the variable dataFloatActive gets close to 0 or 1

#

The console in the video is outputting the dataFloatActive, and floatSmoothingMultiplier
the floatActive is what controls the position of the animation/fixture

rocky wyvern
#

and just have it be on or off?

proper pasture
rocky wyvern
#

so why not just use the animation like in the first video? im confused

#

if that's the intended movement

proper pasture
#

The problem with adding extra animations for finer movements is that... I need to add an entire set of 36 animations, and add more asynchreadback entries, doubling the number from 36 to 72, which will likely cause performance issues

formal plaza
#

can anyone help me with this error?
i disabled burst, reinstall unity and delete my libary+obj but nothing works

rich adder
#

idk com.unity.collab is very old so idk whats happening there..

naive pawn
#

is that a stacktrace? what's visualscripting doing there?

rocky wyvern
rich adder
#

my guess dependency for something

#

visual graphs maybe?

rocky wyvern
#

You don’t need to track all those values

#

Transforms do it for you

naive pawn
proper pasture
formal plaza
#

So i need to swap from UVC to git?

rich adder
#

are you actually using uvc ?

formal plaza
#

Have no idea, im New in working with Unity and scripts 😇🥹

rich adder
#

I would switch though if you are trying to collab via version control

naive pawn
rich adder
#

is that a brand new project though? maybe its something else

true owl
#

https://pastebin.com/DRkm8WAp

okay so I'm basically having this issue when he's sliding down the wall it will still apply the snapping, which I don't want. I think this is happening because of the raycast line being so thin it's hitting some very small area in between my blocks such that it's applying the snap, how can I fix this?

proper pasture
# rocky wyvern What do you mean

I cant fully explain, but the script im editing is part of VR Stage Lighting
It may be possible, but needs another script to track the rotation and to keep it going, and that is bund to fail at some point

#

and its not reccommended to do that

formal plaza
#

Its a new project and i work with it since 2 days

naive pawn
#

@formal plaza @rich adder may i suggest taking this discussion to #💻┃unity-talk? doesn't seem to really fit here (and also could expand to helping the other guy)

formal plaza
#

Okay

#

So i try to swap from UVC to git tomorrow and i Hope it will be fixed then

naive pawn
#

are you actually using it though

#

if you aren't you could just delete the package

green copper
#

what the best practice for creating structures for loading data?

Having a "fresh save" file and giving the player a copy of one, or having a state or flag like "firstTimeInitialize" and have functions that generate the starting game state when the player loads without loading from an existing save file?

formal plaza
runic shore
#

hey, my friend and i trying to work tog on the same project using git but he gets this error "failed to find entry points" we trying to fix this for the last 5h but....

rocky wyvern
rocky wyvern
rocky wyvern
#

Ah your friend isn’t soba flow?

#

Just same error same time that’s a coincidence

runic shore
#

XD

rocky wyvern
runic shore
#

i did just giving me another error and then returning to this error