#💻┃code-beginner

1 messages · Page 643 of 1

teal viper
#

Parent it to the green slots.

fair shore
teal viper
shut swallow
#

Heya, was following https://www.youtube.com/watch?v=NsSk58un8E0 tutorial and got stuck on making the character move, I probably did something stupid but when i debug test if i have the correct directional input it does show the correct direction (timestamp starts @ 9:10)

This one is a bit different than the last couple devlogs. I thought it would be fun to share a longer video where I actually make a thing. Might be super boring? Idk!

Links:
https://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/
https://youtu.be/7daTGyVZ60I
https://youtu.be/tYc1yUt0IeA
https://github.com/TheAllenChou...

▶ Play video
craggy pelican
#

hi i am new visual effect graph . How can i play only system (6) IMPACT FLIP in my scene

shut swallow
#

which is a huge issue

formal valley
#

hi
how can I make camera waypoint in unity
like chase mission.

upbeat seal
#

Hi I'm using unity version 2023 and I'm quite near a project deadline, how can I get the old navmesh ?

fierce shuttle
mystic glacier
#

👋

#

I'm dragging and dropping a material onto a terrain but it doesn't work. How can I use a material on a terrain?

#

This is how my material looks like

fierce shuttle
stuck field
rancid tinsel
#

hey guys where can i ask about unit testing help?

#

is this the right place?

runic lance
compact rivet
#

This is super basic

#

But I'm having some trouble instantiating a prefab at a parent's location

#

I have to create a speech bubble on an enemy but I can't figure out how to spawn it at their location

mystic glacier
#

👋

#

I want to draw a white dot crosshair circle. I think I should do this by code because sprite would be pixelated in small sizes. However when I tried to do it by code, it also turned out to be pixelated. How can I draw a white dot crosshair circle in the center of the screen?

eager spindle
#

it would be much easier to do this with unity's UI though, not sure what you mean by the sprite being pixelated in small sizes

warm field
#

is there a way to lock the camera rotation of a player when the cursor is visible?(i tried using an if, but that did not work)

fervent abyss
#

is there any way to create a coroutine that returns a type?

#

for example a coroutine that returns a string

grand snow
warm field
#

for some reason the camera can rotate even with the cursor unlocked

#

even though i specifically requested it to not work while the cursor is unlocked

#

figured it out, at least temporarily

mystic glacier
#

👋

warm field
#

welp i did not figure it out

mystic glacier
#

When I crouch walk to left my camera seems fine, but when I crouch walk to right I have this issue. Is this related to my animation or my player controller (which handles camera movement)?

warm field
#

anyone know why the code does not set my walkspeed to 0?

 void Moving()
 {
     if (Input.GetKeyDown(KeyCode.Escape) && moveSpeed == 0.125f)
     {
         moveSpeed = 0;
     }
     else
     {
         moveSpeed = 0.125f;
         float currentSpeed = Input.GetKey(KeyCode.LeftShift) ? sprintSpeed : moveSpeed;
         float moveForward = Input.GetAxis("Vertical") * currentSpeed;
         float strafe = Input.GetAxis("Horizontal") * currentSpeed;

         Vector3 move = transform.forward * moveForward + transform.right * strafe;

         if (move.magnitude > 0)
         {
             rb.MovePosition(rb.position + move * moveSpeed);
         }

         onGround = Physics.Raycast(transform.position, Vector3.down, groundCheck, groundLayer);
         if (Input.GetButtonDown("Jump") && onGround)
         {
             rb.AddForce(Vector3.up * jumpForce, ForceMode.Impulse);
         }
     }
fringe carbon
mystic glacier
fringe carbon
mystic glacier
#

That's literally Windows 11...

#

Oh, you replied to that message

hexed nymph
#

Yoooo I've tried to delay a function inside another script with this code:
StartCoroutine(respawnScript.RespawnPlayer("p1"), 0.7f);

but the console gives me an error

mystic glacier
hexed nymph
#

"error CS1503: Argument 1: cannot convert from 'void' to 'string'"

ivory bobcat
mystic glacier
ivory bobcat
#

Place some logs to see if the lines of code are being executed

hexed nymph
# mystic glacier What does your respawn script look like?
    {
        if (player == "p1")
        {
            p1clone.spawnedP1Go.transform.position = respawnPoint.position;
        }
        if (player == "p2")
        {
            p2clone.spawnedP2Go.transform.position = respawnPoint.position;
        }
        if (player == "p3")
        {
            p3clone.spawnedP3Go.transform.position = respawnPoint.position;
        }
        if (player == "p4")
        {
            p4clone.spawnedP4Go.transform.position = respawnPoint.position;
        }
    }```

this is the RespawnScript that has the function I want to call
warm field
hexed nymph
warm field
#

finally i managed to get the camera stopping to work

#

uhh, why does my & open a call stack instead of typing &

naive pawn
#

also, perhaps each player should be able to respawn separately instead of it being a central thing

covert flower
#

I've been stuck in an issue for an hour now with the
Transform.lookAt function.

It automatically adds 90 to y axis rotation and I have no clue why

#

I can showcase the script in a minute

mystic glacier
#

Hey

#

What's the best way to check if a player is grounded?

#

It should work even for mountain slopes

rich adder
rich adder
tidal quest
#

hey guys, its me again lmao. Im tryna make a button on the pause menu which respawns the player. The button is set to interactable but the function i want it to do doesnt show as an option. I also then tried coding the button and come across the same. i will attach code to the manual button and the respawn cs and also the proof that the function doesnt show on my options

rich adder
tidal quest
#

Button

#

Respawn code

rich adder
#

the function is private

#

why do you expect it to showup in the dropdown if its private

tidal quest
#

which sorry

rich adder
#

show the inspector for the button requested

#

if you are trying to use MBsOnMouseUp that only works on colliders / physics

tidal quest
rich adder
#

anyway regardless, its private so its not gonna show up in dropdown

tidal quest
#

i made it public it still isnt there

rich adder
tidal quest
#

im aware the bottom is unticked

rich adder
tidal quest
#

yeh

#

miseplt it like a waldo too lmao

rich adder
#

if its public then it will show up. Also name the function something else to remove confusion with unitys MB

#

and Save.

tidal quest
#

it is public with new name and not showing up

#

and saved

rich adder
tidal quest
#

i cant take an ss of it it disspeaers can i use my phone?

rich adder
tidal quest
rich adder
# tidal quest

doesnt seem you dragged the script from the inspector but from the Project window..

tidal quest
#

i don't understand sorry, can you re-word?

polar acorn
# tidal quest

You need to drag in an object with the script on it not the text file containing the code

tidal quest
#

Love this?

rich adder
tidal quest
rich adder
#

now you dragged the gameobject / instance of the script

tidal quest
#

I thought you were asking if I put the script in the box

rich adder
#

script is just a text file. The one on the gameobject is the actual Instance of that component (script)

tidal quest
#

i face another error now

#

upon clicking the button

rich adder
#

lovely how you cropped the error

tidal quest
rich adder
#

well take a look at this image carefully

#

the print works because it is before the line error

tidal quest
#

what have i done wrong?

#

it should run a function, that fucntion should respawn the player no?

#

aha i see

#

it wont let me put the player in that box to respawn them though now lmao

#

it will now, and now i have loads of errors

rich adder
#

Null Reference Exception is the most common thing you will be encountering and should learn how to debug / dissect it

#

Null reference means it tries to access something on a Null object

tidal quest
#

yeah

rich adder
#

ok so line 16 complains about Respawn.RespawnP();

#

how can you access RespawnP() if Respawn doesn't exist to be accessed

tidal quest
#

it does exist, that is a section of code

rich adder
#

no that just tells the computer you want to use template like a, Class of type Respawn

#

(this class / object has these specific functions you can use)

#

the computer has NO IDEA which ONE specifically you want to run those on

#

thats why we do Assignment

tidal quest
#

respawn is a section of code i access respawn to acces respawnP NO?

rich adder
#

the computer doesnt care about the textfile itsellf

#

You have to tell it which specific Respawn you want , aka an INSTANCE of an object

#

as mentioned earlier, an instance doesnt exist unless you create one. In Unity COMPONENTS are INSTANCES that get created when the script is put on the gameobject

tidal quest
#

ive done this

rich adder
#

but you didnt tell it which Respawn Component , the instance you want to use

tidal quest
rich adder
# tidal quest

idk what exactly ur showing here. you linked it but your error says you didn't so you either using the wrong prefab or you have a copy

tidal quest
#

im unsure

rich adder
tidal quest
#

it send and recives

#

complain no object given

#

when i gave it one

#

i included the game screen to show i clicked the button

vestal pilot
#

i might be being stupid... im trying to rotate to make a text sign face the player, however i dont want it to tilt up and down. so im using the quaternion face command to get the right angle and i want to turn that into a euler angle to then clamp the downwards tilt out.
if there is a A face B command in euler that would solve the issue, or if i could convert the quaternion to euler angles? anyone got any ideas

rich adder
slender nymph
#

eulerAngles is a Vector3, but target is a Quaternion variable

eager elm
#

try Quaternion.EulerAngles()

slender nymph
#

it's not that you cannot convert to eulerAngles, it's that you cannot store a Vector3 value in a Quaternion variable

vestal pilot
vestal pilot
rich adder
polar loom
slender nymph
#

and not everything goes into the square hole

polar loom
#

do you want the errors it gives me or nah

eager elm
#

I assume public;ic is an error

polar loom
#

yea i look in my console and its says ; is an error

#

it tells me its expected twice and the other error is invalid token

vestal pilot
naive pawn
#

yeah python is an outlier in that

#

js has dynamic typing too and doesn't really do that
in fact most advice says to default to const in js, and avoid let if possible

rich adder
#

when data scientist make a language 🥵

naive pawn
#

i don't think lua really does that either, but i haven't done much lua yet.

polar loom
naive pawn
eternal falconBOT
polar loom
slender nymph
#

having a configured IDE is required to get help here

sudden quiver
#

How does kinematic movement work, i cant find a guide

I have a 3d game but it is purely left and right movement

graceful onyx
slender nymph
#

save your code because the error is different than what you actually have

graceful onyx
#

hmm lemme check

rich adder
#

c# is case sensitive

graceful onyx
#

im a beginner

#

never programmed b4 so im just following tuts rn

slender nymph
# graceful onyx Huh

also if you are still using sublime then stop and use a supported IDE that you actually configure. because as i just pointed out to someone else, having a configured !IDE is required to get help here

eternal falconBOT
graceful onyx
#

I used mono tho

#

i got completions n stuff

slender nymph
#

mono hasn't been supported for years

graceful onyx
rich adder
#

why are you using Monodevelo

#

its old af

shadow rain
#

yk how uv got the main aspect

#

whats the other aspect

graceful onyx
#

oh rlly

shadow rain
#

hright

graceful onyx
#

i just like how sublime looks

shadow rain
#

height

#

instead of camera.main.aspect

#

whats the height

rich adder
shadow rain
#

sry

#

ok so how do i reference the other aspect that isnt camera.main.aspect like the height

rich adder
#

which height are you talking about here ? the screen ? the frustum ?

shadow rain
#

screen

rich adder
#

you meanScreen.height?

shadow rain
#

how do i get the screen height

slender nymph
#

did you google it

shadow rain
#

yeah

#

i did

#

didnt help

slender nymph
#

then you didn't google it

rich adder
#

or you just skimmed the results

shadow rain
#

i did but whatever u say

frosty hound
shadow rain
#

right i didnt search that

graceful onyx
shadow rain
#

but oh well

#

its not even 3d

#

its 2d

frosty hound
#

Even after saying you did. Again, waste less time. Thanks.

shadow rain
#

no but i wasnt thinking and said liek how to get the second aspect ratio or smth

naive pawn
#

the second aspect ratio.... what even

shadow rain
#

right guys

naive pawn
#

an aspect ratio is the ratio between the width and the height
cameras aren't 2.5d in unity

shadow rain
#

idk

sour fulcrum
#

Mr President the second aspect ratio has been searched

shadow rain
#

i wasnt thinking

#

was rushing

naive pawn
#

please think first

#

don't rush

shadow rain
#

yeah

naive pawn
#

we have all the time in the world

#

you'll just waste more time if you can't think straight or communicate clearly

shadow rain
#

right well im sry

sudden quiver
#

This is my movement script currently

How do i let that if statement at the end check if IsGrounded == False, cause currently it says that error

slender nymph
eternal falconBOT
sudden quiver
rich adder
naive pawn
# shadow rain

also, stuff about the screen and stuff about the camera are different things
the code here is for world-space (unity units) width, but the height of a screen would usually be in screen space (pixels), as Screen.height gives

the height of the camera in world-space units is Camera#orthographicSize * 2.

shadow rain
#

yeah thanks

mystic glacier
#

I have a jump system and I have my jump animation's root transform position (Y) baked into pose. However when I jump, my character collider almost doesn't go above at all. It does, but it's very small. It's not aligned to the jump animation at all. What should I do to fix this case?
This is my player controller: https://pastes.dev/qqeukmOmF2

#

If I don't bake root transform position (Y) into the pose the capsule collider somehow works, but my falling animation plays twice.

sudden quiver
#

i got the VS code plug in

#

and i went to the package manager and enabled it

rich adder
# mystic glacier

because Youre not actually jumping in the code, you're just using animation

rich adder
#

there is more

mystic glacier
slender nymph
#

at no point do you actually call the JumpAddForce method

mystic glacier
slender nymph
#

why is that in the animation event?

mystic glacier
sudden quiver
rich adder
mystic glacier
rich adder
#

wahetevr clip has the animation event

mystic glacier
#

If so, yeah, also I can assure you that function is getting called, I have did a Debug

#

If I don't tick "Bake Into Pose" here (Jump animation), the capsule collider moves correctly as shown in the video, but Landing plays twice as you can see in the Animator tab

slender nymph
slender nymph
#

ah of course, you already posted it there and decided you should crosspost

mystic glacier
slender nymph
#

don't crosspost

mystic glacier
mystic glacier
rich adder
slender nymph
rich adder
slender nymph
rich adder
sudden quiver
rich adder
#

as it uses transforms moving in animation to move it

naive pawn
mystic glacier
sudden quiver
naive pawn
#

install tool is the thing that installs and manages sdk

sudden quiver
#

and i see a thing that says it Intalls SDK, thats fair to assuem i have installed SDK

naive pawn
#

sdk isn't an installer

slender nymph
sudden quiver
#

I AM NEW TO THIS

naive pawn
sudden quiver
#

THIS IS THE BEGGINER CHAT

rich adder
slender nymph
sudden quiver
slender nymph
#

the entire vs code window

naive pawn
#

do you know what a window is

rich adder
#

the entire window mate they literally said it

naive pawn
#

on your pc

sudden quiver
rich adder
#

this is like computer usage nothing to do with code

sudden quiver
rich adder
#

VS CODE

naive pawn
#

the vscode window

sudden quiver
#

And vs code has different pages in it?

naive pawn
sudden quiver
#

which page do you need a screenshot of

rich adder
slender nymph
naive pawn
rich adder
#

window means what Windows defines as window, the entire frikken app

sudden quiver
#

well sorry im new to this and asking questions

#

you guys are hear to help, not here to be assholes to someone trying to learn

rich adder
#

mate we get you're new but there is a bit of brain work needed on your end

#

this is Game Development after all...something already complex in itself

naive pawn
#

ok so if you don't know something, ask instead of assuming

i do realize that's kinda hypocritical since you asked if the install tool was the sdk, but.. it's an install tool

sudden quiver
slender nymph
sudden quiver
naive pawn
slender nymph
sudden quiver
naive pawn
#

christ chill

sudden quiver
#

if you dont feel like teaching then leave this chat?

frozen crypt
#

urime ethe ty

#

yoo whats good everyone

naive pawn
#

not the vibe, apparently

rich adder
naive pawn
eternal falconBOT
sudden quiver
#

ok i have the .net whatever and its highlighting my code that has an error red

sudden quiver
#

does it say what the error is somewhere? or just that there is an error?

rich adder
#

ok good

#

now its configured

naive pawn
naive pawn
#

press ctrl+`, it should be beside the terminal tab

sudden quiver
#

this is just giving me the same error that unity gave?

rich adder
#

now this is a straight up c# issue.
using Method vs a methodgroup / delegate when you omit the ()

naive pawn
#

granted we might still have to translate error messages if you're unfamiliar, but this should help simple mistakes

narrow pulsar
#

im not sure how to refrence bullet script on line 26 so it will fire

#

here is bullet script

rich adder
#

flashbangjesus

naive pawn
#

good lord

rich adder
eternal falconBOT
narrow pulsar
#

oh sorry i just downloaded vscode

#

mb

rich adder
#

I think I'm blinded

narrow pulsar
#

ya

slender nymph
rich adder
#

here

slender nymph
#

anyway, you need to use the variable you have not the class

narrow pulsar
#

wym by the variable i have though

slender nymph
#

or use GetComponent on other if you need to get the instance that was collided with

slender nymph
narrow pulsar
#

yeah

slender nymph
#

if you don't know what a variable is, then stop what you are doing and go through the beginner c# courses pinned in this channel

rich adder
narrow pulsar
#

i do know what a variable is

rich adder
#

then its time to do c# beginner courses

slender nymph
rich adder
polar acorn
sudden quiver
#

This is my movement code and it like works but its like laggy? and you cant jump if you are moving (you get like stuck in the floor and it doesnt let you off the ground)

eternal falconBOT
#

mad No

Be mindful, if someone requests your code as text, don't send a screenshot!

hexed nymph
#

Yoooo I want to make a CineMachine camera with TargetGroup (2D) and I want that by script add a new target to the group using a prefab's transform but it doesn't work

hexed nymph
#

void Start()
{
cam = GameObject.FindWithTag("Cinemachine");
        cam.GetComponent<CinemachineTargetGroup.Target>();

List<CinemachineTargetGroup.Target> targets = new List<CinemachineTargetGroup.Target>();
        targets.Add(new CinemachineTargetGroup.Target {trans, 0.8f, 1f});

{```
#

and it gives me this error:

Cannot initialize type 'CinemachineTargetGroup.Target' with a collection initializer because it does not implement 'System.Collections.IEnumerable'\

rich adder
sudden quiver
rich adder
#

even if you used kinematic you're not moving the actual rigidbody

sudden quiver
#

wdym

hexed nymph
sudden quiver
#

i found a youtube guide and it said this was kinematic, is it not?

rich adder
sudden quiver
#

Would character controller be better than kinematic?

rich adder
#

you have a public Rigidbody rb; and you're not even using it

sudden quiver
#

yeah that was from my previous code that i deleted

rich adder
#

there is no "better" in terms of use. Some fit for certain cases and some dont

sudden quiver
#

well im wanting to make a fighting game so like movement is pretty important to feel snappy and good, what would you recommend?

rich adder
#

both can be coded to be "snappy"

#

its all about doing it correctly lol

#

there are also premade controllers that already solved certain issues like KCC etc.

sudden quiver
#

what does Kinematic like mean? i just know its a setting for rigidbodys

rich adder
#

gravity included, they can't be pushed by a dynamic rigidbody etc.

sudden quiver
#

cause rigidbody uses unitys physics which is why it feels weird and floaty?

rich adder
#

somewhat

#

they are tuned to be close to realistic, games are not meant to be realistic so things need to be tuned

#

(Unity didnt make the physics)

sudden quiver
#

how would i make rigidbody not feel floaty?

#

or would it be better to just use character controller or kinematic

rich adder
#

increase gravity, give mroe force on jumps etc

sudden quiver
#

how do i increase gravity?

rich adder
#

mate these are questions for google im not a search engine

#

ez pz

sudden quiver
#

ah, my game is 2d though so i dont think that would work

#

well its not 2d

#

its 3d, but locked to 2d

slender nymph
#

not a code question. and that's just a gizmo, you can disable gizmos to hide them

ionic osprey
#

thanks

slender nymph
#

note that gizmos will also only ever be drawn in the editor as they are just for debugging purposes

sudden quiver
tribal edge
#

Grats!

sudden quiver
#

now i have a problem is i get stuck to walls when i like jump

rich adder
#

welcome to the most common thing that happens in unity

sudden quiver
#

how would i fix?

#

just remove friction from the walls or somethign?

rich adder
#

not on the walls

sudden quiver
#

remove the players friction?

rich adder
#

if you look "stuck in wall when moving rigidbody" you see plenty of different solutions

sudden quiver
#

ty

#

well its not stuck in wall

rich adder
#

the dirty quickfix is having no friction on player collider physics material

sudden quiver
#

its like if i jump and contiune to hold into the wall i get suspended

sudden quiver
#

oh wait i also want to disable airmovement anyways so maybe thatll fix

#

ill do that first

rich adder
#

putting on walls isnt very scalable in the long run

sage crescent
#

@sudden quiver You should get in the habit of googling your issue first and if you can't find any results or are still confused, ask for help.

Being able to google your issues is a skill in itself and a large part of any development

sudden quiver
#

well me disabling airmovement worked fine for now, ill roll with this till i have more problems

rich adder
#

if that doesnt change its one thing, but if ever did something extra to track

hexed nymph
polar dust
#

I think the error is because youve got an incorrect type for the listList<CinemachineTargetGroup.Target>

rich adder
#

the compiler thinks that they are trying to create Target as a Collection rather than the struct it is

#

because they put { } instead of ( )
but even still doesn't seem the Target have constructor with 3 params anyway

polar acorn
slender nymph
#

it's a class not a struct, and they appear to be attempting to use object initializer syntax

polar dust
#

surely the curly braces is a secondary issue, Cannot initialize type 'CinemachineTargetGroup.Target' with a collection initializer to me sounds like the actual list hasnt initialised, meaning the incorrect .add with the curly braces isnt an error that the compiler has managed to reach yet

slender nymph
#

sounds like the actual list hasnt initialised
that is incorrect. it seems the compiler thinks they are using a collection initializer syntax rather than object initializer syntax, though they are mostly identical in appearance so idk why it would think that

#

unless this isn't even where the actual error is

#

i'm still not convinced they are using a configured IDE

cinder wind
#

Assets\FIrst Person\Scripts\InputManager.cs(7,25): error CS0426: The type name 'onFootActions' does not exist in the type 'PlayerInput'
i cant figure out this error im following a vid if anyone wants to have the link pls how to fix?

polar acorn
eternal falconBOT
cinder wind
rich adder
polar acorn
slender nymph
cinder wind
#

i dont know what that stuff is

polar acorn
#

new Thing() {foo=a, bar=b, baz=c} would work

slender nymph
#

right but you specifically pointed out the curly brackets instead of the missing field names

polar acorn
slender nymph
#

that class has no constructor so they aren't trying to use a constructor

polar dust
rich adder
#

holy hell that targetgroup thing is wild

#

not even a constructor for that with 3 vars ?

polar acorn
polar acorn
#

If there's one problem with Cinemachine it's that they seem to be really averse to you doing things in code without the inspector

slender nymph
#

at least it is getting better, with cinemachine 3 they finally exposed the option for multiplying your input by deltaTime so you don't have to manually divide it by deltaTime or write your own input processor for it

rocky canyon
#

ya, i'll usually code my containers to do all the stuff i need and tracking and w/e.. cinemachine usuallly just sits at the lowest level of my hierachy..

#

^ speaking of...

#

anyone know how to contend w. this error.. lol all im changing is the FOV

#

extra clicks in resentment

rich adder
#

do you have the "Save During play" on ?

rocky canyon
#

in the component?

rich adder
#

cinemachine yea

rocky canyon
#

um let me check 👀

rich adder
#

iirc that was a thing on virtual camera

slender nymph
#

doesn't seem like an error, more of a confirmation that you do want to keep the settings you've manually changed while in play mode due to the Save During Play option enabled

rocky canyon
#

thank you nav

#

yup, box that was it

#

i didn't even notice that was a thing

#

is that a new thing with cm3.. ❔ .. i just dont remmber it

rich adder
#

its always been there

slender nymph
#

i don't think so, i think the confirmation might be new but i'm not super sure about that. i know the save during play attribute has existed for a while

rich adder
#

I guess 3.0 gives you that in editor warning

#

tbh I never left Save During Play on 2.0 to notice if it did or not

rocky canyon
#

yea, i dont recall.. tbh i upgraded cm3 without looking a whole lot at the new editor setups

#

i jsut figured out how to assemble the cams and stuff and went on my way lol

rich adder
#

I saw body Transposer and all this stuff got split into other components immediately panicked and switched back to 2.x
I couldnt find the usual things easy

rocky canyon
#

priorities and toggling cams transition like they used to, im sold

rocky canyon
#

red cinemachine cam scares me now

#

my project blows up

rich adder
#

I just need to check the docs again fro 2.x to 3.x transition, idk what happened to some components got renamed too

slender nymph
rich adder
#

Yeah this is what it is, just at glance, once i read the docs again it will probably be better

#

iirc there is a video guide on Unity Talk in the past i need to revist

rocky canyon
rocky canyon
#

oh they got pre-docs

#

i check docs when i get stuck 😬

rich adder
#

I usually do but since those projects were old this sentiment hit home now especially lol ..

While it is possible to upgrade an existing project from CM 2.X, you should think carefully about whether you are willing to put in the work. It might be better in many cases just to stick with CM 2.X, which will continue to be supported for a while in parallel with CM 3.X. If you do choose to consider upgrading your project, this guide will give you some pointers to make the process smoother.

polar dust
#

https://youtu.be/h7gpymxdLrQ?t=68 what i havent managed to figure out is how you'd create a third person camera, with the newest version of cinemachine, where you can actually tilt the camera up and down via the vertical arm length

In this video, we'll show you how to create a third-person follow camera in Unity using Cinemachine. You'll learn how to handle camera control with mouse input, and solve common issues like the camera going behind walls or obstacles. We'll guide you through setting up camera transitions and camera shake with step-by-step instructions and practic...

▶ Play video
#

all its ever done for me is have the camera point directly to the arm length, and moves up and down with it, so the camera never actually tilts up and down

#

the actual target the camera points at has to be rotated for the third person camera to also rotate

distant plank
#

yo im trying to make dark fantasy game. and i need help. im new and i wanna make small but great game so if yall can help dm me

rich adder
eternal falconBOT
#

:loudspeaker: Collaborating and Job Posting

We do not accept job or collab posts on Discord.
Please, use Discussions to promote yourself as job-seeking, advertise commercial job offers, or look for non-commercial projects to participate in:
Collaboration & Jobs

distant plank
#

i just wanna do test game. for the future

rich adder
distant plank
#

not serious game

#

to release or smth

#

i wanna learn from this mini games

rich adder
#

realistically no one is going to do that for you unless there is incentive to do so

#

if you want to learn then just learn

distant plank
distant plank
rich adder
#

start here on !learn pathways

eternal falconBOT
#

:teacher: Unity Learn ↗

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

rich adder
#

its a starrt. You're not going to make your dream game right away but you can get to it.

distant plank
#

ik how to put textures and make cahr and camera and like that for now

#

im gonna try to learn more

rich adder
#

well that has everything you need for the most part

#

code included

#

there are also more resources in the 📌

distant plank
#

yo i got 1 more question

#

how to i make my game look 2000s style . blury and choppy .

#

or is that just from textures

slender nymph
#

start by learning how to make a game first before choosing a specific art style

distant plank
#

like basic things

#

textures and staff

slender nymph
#

way to ignore what was said

distant plank
rich adder
sour fulcrum
rich adder
#

2000s I think Ps2 / gamecube / xbox which looked really good

distant plank
#

or lunacid

#

or dread delusion

#

its not old but it has same style

rich adder
#

its just the quality of the texture that usually give it a certain look, and how the poly are stylized

#

people were also a lot creative back then because of hardware limitations

distant plank
#

i got old blocky textures and im gonna try to make something rn.

distant plank
#

yo how do i create water in my game

rich adder
distant plank
#

okay

rich adder
slender nymph
# distant plank oh its code?

they meant not a code question because this is a code channel. but you should stop worrying so much about specific features of your game and start with learning the fundamentals as has been pointed out to you multiple times.

distant plank
rich adder
#

yea you're jumping way ahead w the looks before even learning the editor / baics

distant plank
#

then where the fk do i ask

distant plank
hexed nymph
#

I put it like that bcause I saw a website that did that too

hexed nymph
#

but now the error is:

CinemachineTargetGroup.Target' does not contain a constructor that takes 3 arguments

slender nymph
#

that's still incorrect. show the website you had copied the original code from because i'm 100% certain you missed some important stuff

hexed nymph
#

does anyone knows how to solve this?

slender nymph
#

yes, notice how that has extra stuff you didn't copy

#

when using object intializer sytax you need to include the field/property names

polar dust
#

wait, if Target isnt a struct, why have they written
targets.Add(new CinemachineTargetGroup.Target { target = theTransform[0], radius = 0.8f, weight = 1f });

instead of writing
targets.Add(new CinemachineTargetGroup.Target() { target = theTransform[0], radius = 0.8f, weight = 1f });

slender nymph
#

that's the same thing

polar dust
#

you can initiailise a new class without () ?

#

or construct, proper terminology eludes me 😆

slate heath
slender nymph
slate heath
#

oh

#

idk havent learned C#

polar dust
#

i might have done that in a few occasions without ever realizing, instinctively, i think its something id always do (using () that is)

slender nymph
#

here is an example of both working. where the () is included when initializing a class that has no ctor and where it is excluded when initializing one that has a parameterless one
https://dotnetfiddle.net/aEerWM
it is not optional when the object only has parameterized ctors though

polar dust
#

i think what it is for me is that ive always associated () with a class, but structs i dont tend to use constructors in

#

seeing var y = new Test2 { x = 1}; my brain goes "thats a struct"

#

funny how pattern recognition works

acoustic belfry
#

Hi, i did this code for a parallax for each image of the background to move, but for an strange reason is jittery and flickering, why?

using UnityEngine;

public class NewMonoBehaviourScript : MonoBehaviour
{
    private float startPos, lenght;
    public GameObject cam;
    public float parallaxEffect;
    void Start()
    {
        startPos = transform.position.x;
        lenght = GetComponent<SpriteRenderer>().bounds.size.x;
    }

    // Update is called once per frame
    void Update()
    {
        float distance = cam.transform.position.x * parallaxEffect;
        float movement = cam.transform.position.x * (1 - parallaxEffect);
        transform.position = new Vector3(startPos + distance, transform.position.y, transform.position.z);
        
        if (movement > startPos + lenght)
        {
            startPos += lenght;
        }
        else if (movement < startPos + lenght)
        {
            startPos -= lenght;
        }
    }
}```
timber tide
#

Is this script what the background/parallax image is on?

#

I'd start debugging the values to make sure they aren't erratic first off, and if the values seem fine then try sticking it in late update perhaps

slender nymph
#

yeah this could be an issue of the object updating before the camera does, and since it relies on the camera's position it may appear jittery as it is updating a frame too late to be correctly in line with the camera's updates

timber tide
#

usually I see this stuff with lerp too so the cut between directions isn't too instant which helps bring down some of the jerkyness

slender nymph
#

yeah could smoothdamp or lerp the position so it doesn't appear jittery

acoustic belfry
slender nymph
#

by either using Vector3.Lerp or Vector3.SmoothDamp

acoustic belfry
slender nymph
#

what is the exact error message

acoustic belfry
#

what i said, without the or
"the name of type "Lerp" doesnt exist in the type "Vector3"

slender nymph
#

they are methods, not types. you do not new them

acoustic belfry
#

huh?

slender nymph
#

look at the documentation, there are examples

acoustic belfry
#

i discovered that the
else if (movement < startPos + lenght) was actually
else if (movement < startPos - lenght)
and the jittery leave, but now i have another issue, the screen doesnt reset propely, i mean, when i get out of bounds it should reset due it being infinite, but instead the background glitches

#

why

slender nymph
#

well you have an error you have hidden, have you confirmed it isn't related to that

acoustic belfry
#

i dont even know what they mean

rich adder
#

editor bugging out

acoustic belfry
#

i dont know what i did, but it got fixed

#

thanks :3

zenith aspen
#

can someone help me? ive followed a tutorial on how to make crops and it keeps deleting itself after it fully grows, please dm me

rich adder
hallow rock
#

hey

#

i need some help on unity

#

im trying to get this in unity, but need a mono file. I used visual studio 2022, how can I get this to work?

ivory bobcat
#

How to properly post large or inline !code

eternal falconBOT
polar dust
#

@hallow rock you put emojis in your comments?

hallow rock
#

yeah.

#

i need to find how to do a mono file using via visual studio

polar dust
#

how do you put the emojis in there?

hallow rock
#

im not sure, jusr helping my friend.

polar dust
#

be honest, did gpt write the code

#

(the answer is yes)

hallow rock
#

no, this is my friends code,

#

i jusrt asked for perms to use it,

polar dust
#

no it isnt

hallow rock
#

and helping him do it.

polar loom
polar dust
polar loom
#

these are the two errors

polar dust
#

mainly because most of the time its broken beyond repair, the person posting it has no way of ever understanding what it actually is doing

#

its all around not worth the time

hallow rock
polar dust
#

with a trained eye, its very easy to spot

earnest wind
hallow rock
earnest wind
earnest wind
hallow rock
earnest wind
#

thats my question

hallow rock
#

just wont work

earnest wind
earnest wind
hallow rock
earnest wind
hallow rock
#

horror though

earnest wind
# hallow rock horror though

all of them are the same, they all add horror, anyways this is not a place to chat, its for coding help, so i guess goodluck

polar dust
#

btw if the link in the code you sent was a real url, you might have compromised yourself

#

that looks like some kind of token

hallow rock
#

bruh it is

polar dust
#

generally when posting code for any kind of bot youre writing, anything that uses an api. you want to omit any private data

hallow rock
#

watch

#

oh

polar dust
#

id take a look at the channel, i wonder if somebody could be able to post using your bot

prime cobalt
#

I've got a basic script for picking up and moving objects that I mostly got through a tutorial but I want the object to turn to face the camera when they're first picked up while still doing it via rigidbody to make it get blocked if there's something in the way.
TLDR; is there a way to make a rigidbody quicky spin to match a rotation without overshooting that rotation?

slender nymph
#

MoveRotation

polar dust
#

i dont know api stuff too well, but i know that i shouldnt be able to know the name of the channel your bot has access too 😆

earnest wind
slender nymph
prime cobalt
#

Is MoveRotation worldspace or localspace?

slender nymph
#

world, just like pretty much everything else on the rigidbody

prime cobalt
#

For some reason it isn't working. It'll just not rotate it unless I just don't move my mouse or anything around for like a 5-10 seconds (sometimes longer) then it snaps into place.

timber tide
#

where the logs at

jolly mist
#

I'm finding some conflicting info on AddForce, I thought with ForceMode.Force and ForceMode.Acceleration you did need to use fixedDeltaTime but I just read a couple of forum posts saying that AddForce already handles that.
Is this true?

slender nymph
#

you should not be multiplying your forces by deltaTime, all physics should be handled in FixedUpdate which is already on a fixed timestep and those forcemodes mentioned do include time in them as well

still linden
#

Hello where i ask my question on unity ?

slender nymph
#

and don't crosspost

prime cobalt
slender nymph
#

i have no idea what you are asking with that last bit because it doesn't make a whole lot of sense

prime cobalt
#

If the rotation is frozen I can't rotate things using torque, but if there's no torque if it gets impacted in the right way it just starts spinning around in the air.

slender nymph
#

why are you trying to rotate using torque if you want it to attempt to rotate to a specific rotation?

#

or do you plan to calculate the exact amount of torque needed to do that factoring in things like drag/friction?

prime cobalt
#

I want it to get blocked if there's anything in the way. So if like reaching the desired rotation would cause it to clip through the floor/walls/other props it gets blocked.

#

And just using rotation causes it to clip into stuff

slender nymph
#

well yes, just assigning the rotation does not move it in a way that would respect other colliders

prime cobalt
#

Oh well I gave up and used and it works. I'll just try and figure out everything it did to learn.

acoustic sequoia
#

hey everyone,
when i'm itterating over all keyValue pairs in a dictionary, how do i remove an element without causing a error during the itteration foreach loop?

eternal needle
#

Reverse for loop is the common way

acoustic sequoia
# eternal needle Reverse for loop is the common way

the problem is my dictionary has random keys so i can't use an incrimentor to get the values...
storing the keys during itteration adn then removing them after will work for me..

but you said i shouldnt be itterating over a dictionary? how should i do it if i need to store a gameobject along with a key to keep track of it?

eternal needle
#

I don't know what the random keys or "incrimentor" really mean here or why this stops you from using a list

acoustic sequoia
# eternal needle Dictionaries arent ordered, I mean you can definitely iterate through it but it'...

i have alot of items that are stored by Vector2Int locations. i use this dictionary to see if one already exists in that location already to prevent duplicating items in my game. however, i am trying to also check to see if that gameobject has existed for a period of time and if it has, i want to delete it and make it a new possible location for a new gameobject to be instantiated at the users will. whats a better soluton ?

wintry quarry
acoustic sequoia
eternal needle
acoustic sequoia
eternal needle
#

The only thing is youd need some event or the plant would have to store a reference to the code that holds the dictionary, to do whatever logic you want

prisma quail
#
    private Vector3 StartHeadBob()
    {
        Vector3 pos = Vector3.zero;
        pos.y += Mathf.Lerp(pos.y, Mathf.Sin(Time.time * Frequency) * Amount * 1.4f, Smooth * Time.deltaTime);
        pos.x += Mathf.Lerp(pos.x, Mathf.Sin(Time.time * Frequency / 2f) * Amount * 1.6f, Smooth * Time.deltaTime);
        playerCam.localPosition += pos;

        return pos;
    }

How would I make the bob relative to where the player is facing? So when I turn to the side it bobs side to side instead of forward and backward, because it isn't relative to the player with this

wintry quarry
#

if playerCam is a child object of your player, this would make it relative to the player.

#

sort of at least.

#

Your math here in general is pretty weird and flawed

#

Like - you're starting with Vector3.0 every frame...
Then you're doling a Lerp towards some Sin wave, with deltaTime as T, which is not a correct lerp in many, many ways.

Then you're adding that to the cam's localPosition. It's just really odd and not going to result in an actual consistent sine wave if you're looking for a sine wave.

prisma quail
wintry quarry
#

get rid of the Lerp part entirely, it makes no sense here. You would just assign the localPosition directly to the result of the sin calculation. not add it

#

Also you didn't really answer about how the hierarchy is set up

prisma quail
#

This is the main part of the hierarchy, I use void update to set the camera position to the CameraPos under player, because I was following a tutorial

#

If you cant tell I'm really new to Unity

wintry quarry
#

in that case you should be setting hte position based on the player's Transform.

#

using. e.g. Transform.TransformPoint to get a world position relative to the player.

#

i.e. playerCam.position = playerTransform.TransformPoint(pos); that kind of thing - treating pos like a local position in the player object

cinder hatch
#

how do i make a basic interaction system?

#

aka press f and do something to an object in front of player

wintry quarry
#

with raycasts

#

and either an interface or a single component that reports being interacted with through events

cinder hatch
wintry quarry
#

just an Interact or Use function

#

you would have the raycaster call that function when you press the button

cinder hatch
#

ok

#

i'll see what i can cook up

#

thanks

ruby sparrow
#

this is what happens when I do git status on a project that I cloned from my friend's repo (and I didn't edit anything yet other than open the project), is this normal? or something wrong with the .gitignore or whatever

#

just lots of deletions

#

of what looks like temp files

eternal needle
#

i forgot exactly how this part works but you might still have to delete them since they're currently tracked

ruby sparrow
#

this is in the gitignore, so I think it should be ignoring them

#

alright, I'll just commit the delete and see if it comes back

slender nymph
#

the Library folder is automatically generated by unity so it will be regenerated the next time you launch the editor which is part of why it should be ignored, the other reason is that the library folder gets huge

eternal needle
#

rarely ever needed to do this myself so im unsure if theres a difference between pushing that commit and using the command

polar acorn
ruby sparrow
#

oh you might be right I'll let him know

pure hollow
#

Guys quick question if possible, im working on a unity project with given instructions, and in them it says to create an abstract method called "PerformAction" in the parent class Character, which will be inherithed by Player and Enemy, homever the instructions say that it should be implemented in Player to Attack and Interact and in Enemy to damage the player(not the attack action), and my question is, wouldnt it be easier to just add individual methods for Player and Enemy instead of a generic one? Also, can an abstract method can be implemented multiple times in a child class?

hexed terrace
#

the point of an abstract method, is to allow different classes to perform different code within the method and for any classes calling that class.method to not care about what happens. If you do two indvidiual methods for player/ enemy, then whatever is calling PerfromAction() now needs to know what it's talking to and to call the correct method when it doesn't need to

#

You cannot have more than one method with the same name and parameters

grand snow
#

To clarify, abstract functions work the same as virtual ones but MUST be implemented by child classes.
Virtual ones can optionally be overwritten.

analog otter
#

What even is a method? I just installed unity yesterday 😭😭

noble sage
analog otter
#

C# is unity?

#

Am not trying to argue. Just curious

noble sage
noble sage
analog otter
noble sage
analog otter
#

Are you a professional?

#

Pls be my guidan. I want to be a game maker.

noble sage
analog otter
#

Wish I had

#

I'll take curses then.

#

I'll learn c# from the link you gave. Then I learn unity.

burnt vapor
# analog otter I'll learn c# from the link you gave. Then I learn unity.

I suggest you learn C# without Unity being part of it at all.
https://learn.microsoft.com/en-us/dotnet/csharp/
Learning C# with Unity means you learn two things at once, which is just going to confuse you. Not to mention C# in Unity is VERY different syntax wise and it will require you to understand that while some things are possible, you should not use them.

analog otter
gentle bone
shadow rain
#

is there anyway to download my unity game onto my iphone for free without using xcode or renting any mac replictors or smth

grand snow
shadow rain
#

ok

#

thanks

zenith aspen
uneven summit
#

Hey guys, im looking into modding Schedule I. So far i've been able to decompile the game but the methods dont have anything in their bodies. Anyone have good resources I can look at?

uneven summit
#

Oops mbad then

odd widget
#

Hello. Right now i’m making an rpg game. Let’s say if i want to implement a passive skill system to the game, what would be the best way to do it? Especially if let’s say there’s a lot of different passive skill and each of them have different effect (reduce damage, lifesteal, atk up, etc). I’m not asking about the exact code, but more like, the logic of doing it. Should each passive have their own script and callable function? Or should i make it so that everytime i get damaged, i check if the skill exist, or what? Keep in mind the plan is that there will be a lot of passive

#

I’m not posting any code because rn I’m prioritizing on learning the general logic behind it first (and mostly because i don’t know how to approach it, i don’t know where to start so i don’t have any code)

teal viper
odd widget
#

The way the passive works in this project is like the player itself are able switch around the passive, so the triggers changes a lot. Hmm, what if i make an array of every triggers (on hit, on attack, etc) and everytime the player changes the passive, the list of passive inside the array changes. So everytime there’s a trigger it will check it’s corresponding array and trigger the passive inside them

#

Would that logic work

#

Thinking about this gave me headache lol

floral wren
odd widget
#

Hmm, how would i check for the trigger

#

If passive in player.passive_list and stuff_trigger then do x?

floral wren
#

You would simply have a "Initialize" and "Dispose" function that would handle registering to the appropriate system.

#

Some of your passive might want to have an "Update" function as well.

odd widget
#

Augh

#

Okay, i’ll try stuff first

#

Thanks guys

teal viper
#

You need to take some pen and paper and make a draft of your system design.

#

Of how you want it to work. When and how to apply bonuses. Should they modify the stats? Or just provide multipliers and added bonuses? Should you have separate lists for different types? Or iterate all the passives when looking for certain types? Etc, etc...

odd widget
#

Ugh yea, doing everything in head gives me migraine. If i do come back and show you guys, pinky promise not to laugh at my diagram. I have no experience in professional coding, only self taught

teal viper
#

We don't laugh. But we can send you to do some basics learning.

odd widget
#

i figured it out after 15 second of drawing

#

i'll just write the logic that i use so if anyone search maybe it'll help someone. There's a lot of passive in my game, and a many triggers too, but the player can only equip like 6 passive skill. So i figured out maybe it's okay to just send the type of trigger (and the values) to the equipped passive everytime any trigger triggers and let the function inside the passive script check the trigger, and if it pass the check it'll do the effect

#

if the passive is a stat boost or anything simple, just modify stat on battle begins maybe

#

idk why i overcomplicate stuff. thanks guys

zenith aspen
#

i followed atutorial on how to make a tree grow and it does it in stages but when it reaches its final stage it deletes itself can somebody help? im very new to game dev

#

ill post code now

cosmic quail
zenith aspen
zenith aspen
# cosmic quail oh you're right

yeah so idk what ive done wrong and i cant figure it out but i think its got something to do with the unregister plant stuff

cosmic quail
zenith aspen
#

yes

cosmic quail
sharp bloom
#

Why does this grid look so off?

zenith aspen
rocky canyon
#

are u using ur own hexagon tile image?

sharp bloom
#

I don't fully understand this component

sharp bloom
rocky canyon
#

im not that great at swizzle but i can try to help

rocky canyon
#

sometimes u try to use ur own and u dont always get the perfect dimensions the first time

sharp bloom
#

I can scale it in the x-axis by 20% to make it fit together

#

I have no idea why 1,1,1 scale looks so bad

rocky canyon
#

show ur tile

sharp bloom
#

I mean just this

rocky canyon
#

its a gameobject right?

#

yea that

#

ur scale of that needs to be 1

#

why is the X 1.2?

sharp bloom
rocky canyon
#

ohh so thats the scaling doing that

sharp bloom
#

With 1 scale it doesn't fit

rocky canyon
#

ahh gotcha

#

ive never used the grid component ive always made my own manager style script

sharp bloom
#

Yea no-one uses it

#

I just figured I might try it

cosmic quail
zenith aspen
rocky canyon
cosmic quail
# zenith aspen

i think i found the problem? try replacing "currentStage" with "currentStage - 1" on line 25

sharp bloom
#

Just setting that cell-x size to a random value like 0.87 seems to work

#

I have absolutely no idea what's the math behind that

rocky canyon
grand snow
#

I did my own hexagon grid cus the offset did not match what i wanted ✊

rocky canyon
#

yea.. im doing an offset myself

#

i think custom code would be bette

grand snow
#

Mine had a configurable "offset multiple" and ratio

cosmic quail
lone hamlet
#

let me take screenshots really quick

eternal needle
eternal falconBOT
sharp bloom
#

It's an irrational number actually

#

Checked the maths

#

So in this case sqrt(3)/2 for the cell size

lone hamlet
# cosmic quail you're gonna need to show your code

heres the code of the script i want to access gameobject from dontdestroyonload

public class PauseMenu : MonoBehaviour
{
    public GameObject pauseMenu;
    public static bool isPaused;
 
   public GameObject setting;

    // public GameObject[] rootsFromDontDestroyOnLoad;


   
    
    // Start is called once before the first execution of Update after the MonoBehaviour is created
    void Start()
    {

 
    setting = GameObject.Find("Optionss");

        pauseMenu.SetActive(false);
       // rootsFromDontDestroyOnLoad = DontdestroyOnLoadAccessor.Instance.GetAllRootsOfDontDestroyOnLoad();
       // setting = rootsFromDontDestroyOnLoad[2];
       
    }

    // Update is called once per frame
    void Update()
    {
        
        if(Input.GetKeyDown(KeyCode.Escape)){
            if(isPaused)
            {
                ResumeGame();
            }
            else 
            {
                PauseGame();
            }
        }
    }

    public void PauseGame()
    {
        pauseMenu.SetActive(true);
        Time.timeScale = 0f;
        isPaused = true;
    }
    public void ResumeGame()
    {
        pauseMenu.SetActive(false);
        Time.timeScale = 1f;
        isPaused = false;
    }
    public void Settings()
    {
        Time.timeScale = 0f;
        setting.SetActive(true);

    }
    public void QuitGame()
    {
        Application.Quit();
    }
}
#

im trying to access this gameobject when in ddol from the PauseManager

sharp bloom
#

It's inefficient

grand snow
#

Its public already so already assignable in inspector 🤦‍♂️

sharp bloom
#

Oh that too

#

Yeah just remove this
setting = GameObject.Find("Optionss");

#

You can drag and drop the gameobject to your PauseMenu script in the inspector

lone hamlet
#

i cant tho because its in another scene? sorry im new to unity, cramming this for a school project

sharp bloom
#

I think you need a singleton pattern in that case?

lone hamlet
#

im gonna go look that up

sharp bloom
#

Basically it's something like this

#

Then you can access the singleton class from anywhere using class.Instance

rocky canyon
#

its just hexagon grid bullcrap

#

u have to take into account the staggered rows in order to have correct spacing

lone hamlet
grand snow
lone hamlet
grand snow
rocky canyon
#

@sharp bloom the best i can figure out is to use a vector2 for ur spacing calculations

#

so u can fine tune the X and Y

lone hamlet
grand snow
lone hamlet
sharp bloom
rocky canyon
#

i ended up scaling my tile too

#

made it match the square unity sprite so i could use 1 as my base number

#

now to make 3d Orthographical grids since im this far 😈

lone hamlet
thorn holly
#

what job would be best for mesh generation? i see a bunch of jobs like IJobParallelForTransform, is there one for mesh gen?

queen adder
#

Destroy(WeaponsSpawn.transform.GetChild(0));

GameObject Instance = InvSlot[0];

Instantiate(InvSlot, transform.position, transform.rotation);

Can someone tell me why GameObject Instance = InvSlot[0]; this part is not working im trying to make a varible that contains the first gameobject of this array

wintry quarry
#

what's going wrong with it

#

My guess would be that this line is actually the one with the error:

Instantiate(InvSlot, transform.position, transform.rotation);```
#

If InvSlot is an array that makes no sense

#

Make sure you carefully read your error messages

#

they will tell you exactly what line the problem is on

queen adder
#

it says cannot apply indexing[] to an expression type

wintry quarry
#

Then InvSlot is not an array at all

#

so that would be your problem

queen adder
#

it is

wintry quarry
#

Prove it

#

show your full script and the full error message

#

!code

eternal falconBOT
sharp bloom
#

I've never seen this before

slender nymph
#

unless you've written some editor code, that isn't related to your code. it's an editor error

elder osprey
#

If I want to do rotations in my game, should I try to understand quaternions, or should I continue to convert them to euler and back?

slender nymph
#

with all of the helper functions, there's really no need to actually understand how quaternions work. you can just work with the euler angles you are already familiar

sharp bloom
west sonnet
#

I have multiple NPC's that use the same script. A script on one NPC is affecting all the other enemies. How can I prevent this?

For example, I have a script so that once you interact with an NPC, you can't interact with them again. Problem is, if I interact with 1 NPC, I can't interact with any anymore

cosmic quail
wintry quarry
#

Most likely stemming from you not understanding something fundamental about variables or scripts

west sonnet
#

!code

eternal falconBOT
west sonnet
#

This is my code

west sonnet
wintry quarry
#

And what code is checking it?

#

HasPickedUpBefore?

#

Which object is this script attached to?

west sonnet
west sonnet
#

HasPickedUpBefore so that you can't pick up the same NPC again, but you should be able to pick up other NPC's

wintry quarry
#

Has that been done for every NPC in the scene? Also are there NPCs that are spawned in and not in the scene at the start?

west sonnet
wintry quarry
#

add Debug.Log statements in the places where you expect code to run. Like in OnTriggerEnter2D before the if statement. And make sure the data is as you expect at that point.

median moon
#

Hi, could anyone please help me?
I'm currently making a twin-stick shooter, but my missiles don't collide with the enemy.
Both have colliders, but I don't know if there is more, for it to collide

cinder wind
#

does anyone know a site where i can learn c#?

whole osprey
thin dew
#

i'm asking that because of your name

cinder wind
thin dew
cinder wind
#

i just know to put ; at the end of lines and what the start and update things are and thats abt it

whole osprey
#

Murado linked the most official starting point out there a couple messages up (accidentally replied to me about something unrelated).

frail hawk
#

oh lol sry. ment to reply to Jawa

thin dew
#

https://learn.microsoft.com/en-us/dotnet/csharp/ you can use this to learn some basic concepts of it

if you have programmed before you just need to search up C# examples of what you already know

cinder wind
#

ok thanks

thin dew
#

no problem

cinder wind
#

trying to maek a bloxy fps

thin dew
#

cool

cinder wind
thin dew
#

keep in mind too a lot of people give overcomplicated answers to some really simple questions

#

for instance a couple years ago someone asked what a vector3 was and some guy wrote down the actual google definition of a math vector

#

really all you need to know is it's a structure that holds x y and z

cinder wind
#

@thin dew if u need anything animation or 3d related feel free to ask

thin dew
#

oh thanks but i use unity for 2d

median moon
#

@whole osprey
should I share screen?

thin dew
#

i know how to make 3d games i just find making 2d stuff more enjoyable

#

even out of unity

#

i prefer drawing over modeling any day

whole osprey
cinder wind
#

i actually work for ppl who use UE but i switched to unity bc i want a challenge

thin dew
#

interesting

#

i don't know much about ue

#

tbh

#

i know you can use c++ or their visual scripting interface

cinder wind
#

it got broing really fast and i was using ue4

thin dew
#

i hate visual scripting

cinder wind
#

its around 20 GB

cinder wind
thin dew
#

you also have to install the epic games launcher

thin dew
#

including fortnite

cinder wind
#

and ue5 is 100GB

thin dew
#

you have to install that one launcher to install an engine that's 5 times bigger

thin dew
cinder wind
#

yeah

thin dew
#

wow

cinder wind
#

yes and thats just the core UE5

eternal needle
thin dew
#

unity 6 is only 16gb for me

cinder wind
#

yeah its small

eternal needle
cinder wind
#

oh yeah sorry just got carried away

barren wing
#

henlo

#

can someone help me with a pause code?

#

ya see, when i press up, the character jumps with a impulse, pretty simple

but when the game is paused, if i mash up key, the character launches to the air when i unpause

#

it stacks the impulse

#

code is like this

wintry quarry
# barren wing

Well for one that implies you are running the jump code in Update

#

which is a bad idea for several reasons

#

but if you MUST do it

#

then you should make sure the game is not paused before you run that code.

barren wing
wintry quarry
#

physics stuff belongs in FixedUpdate

#

in general

barren wing
#

great part of the code belongs to the update 💀

wintry quarry
#

this problem is one reason why

wintry quarry
barren wing
#

aaa, thats why the left and right key is in the update

#

i get it now

wintry quarry
# barren wing i get it

your options are:

  • move the AddForce to FixedUpdate
  • Check if the game is paused before runing any of this code
#

FixedUpdate will not run at all when you have set time scale to 0

barren wing
#

@wintry quarry question

#

does the FixedUpdate have a problem with the GetKeyDown?

wintry quarry
#

yes

#

handle the input in Update

barren wing
#

because the character jumps... weird