#💻┃code-beginner

1 messages · Page 598 of 1

trail heart
#

And words after those as well

simple vine
#

its just darkness

teal viper
#

There's more than 5 links. And you can use any of them.

simple vine
#

there all darkness

strong wren
simple vine
#

i see darkness on it

teal viper
# simple vine

Paste the code, save, share the link. It's not rocket science.

simple vine
#

ok

teal viper
#

If that website doesn't work, try a different one.

trail heart
#

Or even just the discord code syntax that's explained after the links in the bot message

simple vine
#

theres no share button

#

wait that might of done it

#

is that it

#

they are the codes

simple vine
teal viper
simple vine
#

what logs

teal viper
#

Debug logs.

simple vine
#

where

teal viper
#

In your code

simple vine
#

but where

teal viper
#

Debug.Log

simple vine
#

where do i add it

teal viper
#

Do you understand what your code does?

simple vine
#

i didnt make it so how do i know where it goes

simple vine
#

they make stuff work

#

and stuff

teal viper
#

If you understand it then you should know where to put logs.

trail heart
#

It looks like you might have two components here that both try to control the Nav Mesh Agent

simple vine
#

but i didnt make it

teal viper
simple vine
#

so no

teal viper
simple vine
#

but he made alot of stuff that my friends uses that works

teal viper
#

I recommend you pause your project and go !learn the basics properly

simple vine
#

and it helping me

eternal falconBOT
#

:teacher: Unity Learn ↗

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

simple vine
#

ok

trail heart
#

Without understanding how your own game's systems work, you cannot implement fixes or debug methods we would suggest

simple vine
#

ok

#

i dont understand it still

teal viper
simple vine
#

i didnt i just dont understand

teal viper
#

Don't understand what?

simple vine
#

the thing

teal viper
#

What thing?

simple vine
#

the scripts

supple wasp
#

What are you saying

teal viper
simple vine
#

can you just send a monster moving scrpit

supple wasp
#

See that's more or less easy

#

To program yourself like this

teal viper
simple vine
#

huh

#

spoon-feeding???

teal viper
#

Learn properly and write it yourself.

supple wasp
#

And when I started learning to program, my head started to hurt.

simple vine
#

bruh why

teal viper
# simple vine bruh why

If you want people to write code for you you gotta hire someone. Programming is labor. And no one likes working for free.

simple vine
#

i find videos tho

teal viper
simple vine
#

they most likey put it in the comments

supple wasp
#

Well, the pugs, if you want to program, you have to start with the basics of coding.

simple vine
#

but that takes too long

supple wasp
#

It's true but it's worth it

#

Look at me, I started with the same thing and look at me now

simple vine
#

idk how to script

supple wasp
#

I already know more or less about programming

supple wasp
# simple vine idk how to script

You just have to search on yt or other places on the internet on how to start programming but BE CAREFUL you only have to learn the code for the type of game you want to make.

simple vine
#

horror

supple wasp
#

If your game is about horror, then you have to search on the internet.

simple vine
#

ok

supple wasp
#

This is what I did and it worked for me

simple vine
#

IT WORKED

thorny flame
#

is there a difference between None and Missing if im checking for null? trying to run an event when it becomes unassigned/null but its not firing

stray wraith
#

Anyone know how I can make an InputAction always trigger when one of its buttons is pressed, regardless of another button being already down? I have a little mechanic in my game where you can essentially jump twice, but if you jump with, let's say space and you don't release it, then preceed to jump with up arrow, it won't do anything because space is already down. Any fixes for that?

wintry quarry
#

none means actually null

#

If it's missing it won't be because it was assigned as null it's because the object was destroyed

west radish
queen adder
#

hello, i'm using unity cloud code js scripts and I want to just simply wipe any players inventory when their user id is provided in the params. Does anyone know if it's even possible to do that, or is there a better way of doing it, idk it's just not working for me at all

solid jay
#

How can I rotate an Object around the local axis shown in the editor, bc transform.localrotation doenst work and space.self with transform.rotate also doesnt work

queen adder
#

@solid jay

solid jay
#

bro with code

queen adder
#

oh idk

deft breach
#

you can always use transform.LookAt() with a Vector3

#

where do you want to point it? @solid jay

solid jay
#

well I want to make a free cam which works in every orientation like in space engineers the player controller

deft breach
#

for free cam just use cinemachine its way easier and faster to implement

#

Just add Cinemachine FreeLook Component @solid jay

solid jay
#

but the free look needs a target to look at

deft breach
#

your player

solid jay
#

Ok I may havent made it clear I meant like a spectator camera with free looks, sorry for the confuision

rancid tinsel
#

!ide

eternal falconBOT
deft breach
rancid tinsel
#

turns out I had to manually add the Visual Studio Editor package to unity (never had to do that before) and regenerate project files

#

so weird

solid jay
deft breach
#

You can do something like this: transform.RotateAround(transform.position, transform.up, Time.deltaTime * 90f); where transform.up is the axis to rotate around on (the y axis in this case)

#

or this: transform.Rotate(0, yAmount, 0, Space.Self); @solid jay

solid jay
deft breach
#

transform.localRotation = Quaternion.Euler(x, y, z); @solid jay

solid jay
#

not the same thing

deft breach
#

transform.localEulerAngles = new Vector3(x, y, z) @solid jay

#

man I got no damn clue what your up to if your making a free cam just use a simple one from the internet or ask chatgpt and if your making first person cam + movment just follow one of the 10000 tutorials on YT. otherwise these are the ways to set rotation if that doesnt work for you i dont know what will @solid jay

wintry quarry
solid jay
#

this is what im trying to get, that no matter which way the player is rotated it always rotates to the left when i move the mouse to the left etc @deft breach

#

and that also with the x axis

radiant frigate
#

hello! im trying to make a variable of type Rect Transform but when i drag in a Rect Transform it says "type mismatch"

#

does anyone know why this happens and how to solve it?

#

ty in advance!

rich adder
rich adder
#

yea thats not allowed

radiant frigate
#

oh

#

makes sense

#

didnt think about that

rich adder
radiant frigate
#

you are my saviour

#

ty

radiant frigate
#

now it works, ty!

deft breach
#

@solid jay ``` float newRotationX = transform.localEulerAngles.y + Input.GetAxis("Mouse X") * freeLookSensitivity;
float newRotationY = transform.localEulerAngles.x - Input.GetAxis("Mouse Y") * freeLookSensitivity;
transform.localEulerAngles = new Vector3(newRotationY, newRotationX, 0f);

rich adder
#

bad idea to read and set the eulerAngles

deft breach
solid jay
#

well it doesnt work

rich adder
#

still wrong anyway

#

you should never touch the euler angles manually to avoid gimbal locking issues nvm unity internally changes into quat

#

thats the whole point of using Quaternion

deft breach
#

unity docs does it

rich adder
deft breach
#

I thought its ok to do if unity docs does it

rich adder
#

hmmm apparently unity does set them to quaternion internally but as it states, you shouldnt read and write from euler angles

#

When using the .eulerAngles property to set a rotation, it is important to understand that although you are providing X, Y, and Z rotation values to describe your rotation, those values are not stored in the rotation. Instead, the X, Y & Z values are converted to the Quaternion's internal format.
When you read the .eulerAngles property, Unity converts the Quaternion's internal representation of the rotation to Euler angles. Because, there is more than one way to represent any given rotation using Euler angles, the values you read back out may be quite different from the values you assigned. This can cause confusion if you are trying to gradually increment the values to produce animation.

void thicket
#

Bad idea to round-trip it, to be specific

timber tide
void thicket
#

The vector you set is not same as the vector you get

#

It converted to Quaternion and loses euler axis info

timber tide
#

I think to get a nice sample from the input is to evalute atleast a few frames of input to determine the direction

#

so to compare the most growing axis and direction on that axis

solid jay
timber tide
#

Probably how I explained it

deft breach
#

thanks i understand the issue now

timber tide
#

I don't think for this question you need the current transform rotation anyway

rich adder
#

whats wrong with Transform.Rotate again?

raw mountain
solid jay
teal viper
verbal dome
rich adder
verbal dome
rich adder
#

well its Euler input that rotates quaternion

rich adder
timber tide
rich adder
#

dont u want local rotate? transform.rotate should be fine

solid jay
rich adder
deft breach
rich adder
verbal dome
solid jay
#

yes wait a sec i will show you

timber tide
#

Do you do a flip when you go above 90 on the tilt

solid jay
timber tide
#

oh you do do a flip

solid jay
#

yes

verbal dome
#

Yeah I was imagining a space game

timber tide
#

So where's the snapping come into play. Seems smooth to me

verbal dome
#

So yeah, transform.rotate

solid jay
timber tide
#

Ah, may have misinterpreted it then. I assume you wanted it such that it only rotated to specific directions

solid jay
rancid tinsel
#

oh well at least it works now

solid jay
# verbal dome So yeah, transform.rotate
rotationInput.x = playerInputAction.BlueprintMode.Camera.ReadValue<Vector3>().y * sensitivity * Time.deltaTime;
rotationInput.y = playerInputAction.BlueprintMode.Camera.ReadValue<Vector3>().x * sensitivity * Time.deltaTime;

transform.Rotate(new Vector3(rotationInput.x, rotationInput.y, 0)); // Rotate Player Based On Mouse Input

when I do it like this it is all weird an doesnt work at all

verbal dome
#

Also rotating the X and Y axes in separate Rotate calls might be better here

stark burrow
#

Calling cc.Move multiple times in update loop for character isnt recommended, but is enemy script calling public method with cc.Move in player after player update fine?

rich adder
verbal dome
#

AFAIK the multiple Move calls is bad only because CC's isGrounded property only gets affected by the last move call

#

But yeah, that sounds weird

#

What is the mechanic here? Why is the enemy "moving" the player?

solid jay
verbal dome
#

Because rotating X and Y at the same time can combine into a Z rotation

solid jay
# verbal dome ^ <@752867612337111080> try this

like this?

rotationInput.x = playerInputAction.BlueprintMode.Camera.ReadValue<Vector3>().y * sensitivity * Time.deltaTime;
rotationInput.y = playerInputAction.BlueprintMode.Camera.ReadValue<Vector3>().x * sensitivity * Time.deltaTime;

transform.Rotate(new Vector3(0, rotationInput.y, 0)); // Rotate Player Based On Mouse Input
transform.Rotate(new Vector3(rotationInput.x, 0, 0));
verbal dome
#

Sure

#

Btw Rotate has an overload Rotate(x, y, z) which is easier to read/shorter than that Vector3 one

solid jay
verbal dome
#

What are you looking at? The inspector?

#

Or does it actually rotate on its own local Z axis?

#

If you see non-zero Z values in the inspector, that's fine

solid jay
verbal dome
#

I did a lil test scene to replicate that issue

#

Can probably test the fix later when i got more time

#

Q and Z (or whatever keys you use for Z rotation) would roll the up axis around your forward

timber tide
#

I dont use rotate, but I'm pretty sure just using angle axis would work fine

#

then multiply the quaternions out

solid jay
steel smelt
#

try rotating along local axes before you dive further

#

theres a space parameter for rotate

#

space self relates to local space

void thicket
#

Self is default

solid jay
verbal dome
#

And no DM's, I'll ping you here if anything

solid jay
spark moth
#

hi

steel smelt
#

@solid jay I don't understand what you're doing with the camera. This relates to accumulated delta on those respective axes?

#

Anyhow, if so, then the y movement should probably relate to a rotation along the local x, whereas the x movement should relate to a rotation along the local up axis

spark moth
#

i'm trying to develop a game with a movement just like subway surfer but when i want to change the lane in the game, sometimes it doesn't change it and i have to press the button again. i'll send the code in the next message and if there is anything wrong about it please tell me and if u want more details i'll send more about my game

#

the code:using UnityEngine;

public class SPlayer : MonoBehaviour
{
public Rigidbody rb;
public float forwardMove = 30000f;
public float sideMove = 6f;
public float moveSpeed = 5f;
Vector3 targetPosition;
int currentLane = 0;

private void Start()
{
    targetPosition = transform.position;
}

private void FixedUpdate()
{
    
    rb.AddForce(0, 0, forwardMove * Time.fixedDeltaTime);
    
    if (Input.GetKeyDown(KeyCode.LeftArrow))
    {
        if (currentLane > -1)
        {
            currentLane -= 1;
        }
    }

    if (Input.GetKeyDown(KeyCode.RightArrow))
    {
        if (currentLane < 1)
        {
            currentLane += 1;
        }
    }
    
    targetPosition.x = currentLane * 3;         
    rb.MovePosition(Vector3.Lerp(rb.position, targetPosition, moveSpeed * Time.fixedDeltaTime));
}

}

eternal falconBOT
steel smelt
#

@spark moth FixedUpdate isn't guaranteed to catch input.

cosmic dagger
spark moth
#

so i should change the fixed update to update right?

cosmic dagger
#

You do not multiply by deltaTime when using AddForce in FixedUpdate . . .

spark moth
#

so how should the code be written like?

cosmic dagger
#

Store the input in Update and check its value in FixedUpdate . . .

timber tide
# solid jay can you send me maybe a dm then to explain it more since I dont really know what...
public class AngleAxisTest : MonoBehaviour
{
    public float sensitivity = 2f;
    private float yaw = 0f;
    private float pitch = 0f;

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

        yaw += mouseX;
        pitch -= mouseY;

        Quaternion yawRotation = Quaternion.AngleAxis(yaw, Vector3.up);
        Quaternion pitchRotation = Quaternion.AngleAxis(pitch, Vector3.right);

        transform.rotation = yawRotation * pitchRotation;
    }
}

AngleAxis my beloved

#

tested and it works fine

cosmic dagger
#

Choose a method to move the object: by force, by velocity, by using MovePosition (kinematic Rigidbody), or manipulating the transform . . .

spark moth
cosmic dagger
spark moth
#

this is just a test:

steel smelt
#

E-

cosmic dagger
# spark moth this is just a test:

As the message from the bot suggested, use a paste site when posting large code. It takes up the entire chat and we miss questions and answers from other people . . .

spark moth
verbal dome
#

Using constants Vector3.up and Vector3.right doesn't make sense when you are in space

timber tide
#

Hmm, I feel like that would be kinda nauseating

verbal dome
#

It makes sense in space games

timber tide
#

I dont think that would work with mouse though, you'd need a key for the roll

verbal dome
#

Sure, that can be Q and E keys for example

#

My point is that using world axes here is out of the question

timber tide
#

Oh yeah that totally looks like some key input

cosmic dagger
spark moth
cosmic dagger
spark moth
inland latch
#

hi, does anyone know if there's a way to change the default presets, specifically for importing images, on all projects? (or atleast newly created ones), i want to change the max size to the max option, and the compression to none by default accross all projects without having to change the settings manually or make a preset every time i start a new project

rich adder
inland latch
#

but it doesn't work across projects ?

rich adder
inland latch
#

why isn't there just an actual way to change default settings...

rich adder
#

🤷‍♂️

spark moth
inland latch
#

if i have to import a file and set it up as a default preset every time then it's barely a default setting

#

that's not far off from just changing the settings every time

fleet venture
#

its not possible to put something form sceneview into an prefab right? but can i put one prefab into another

#

i mean like in the code section

cosmic dagger
fleet venture
#

so as a field

inland latch
#

then, how do i change the default settings for new projects

cosmic dagger
inland latch
#

that's a dumb solution to an issue with unity itself

#

that is just unnecessary if they let you change project defaults

spark moth
#

@cosmic dagger i have to go can i give a friend req to u so u can help me more?

cosmic dagger
spark moth
#

ok thanks anyway

dreamy rose
#

when i remove the animation

#

it works completely fine

rich adder
dreamy rose
#

because

#

i added the animation

rich adder
#

well yeah your root object has bad pivot

dreamy rose
#

wdym?

#

well uh how do i fix my root object pivot?

rich adder
#

why do you have so many cameras

dreamy rose
#

its just a cemra hold er

#

dw thats not the problem

rich adder
#

you have 2 main camera components

dreamy rose
#

yeah i deleted the other one in the video

#

no ieda

#

wh it was there

rich adder
#

can you show like the way its actually setup then

#

cause nwo you have main camera and player camera

dreamy rose
#

sure ills end you the code i can explain it if u want

rich adder
#

ok

dreamy rose
#

its a code that makes it so the camera pos in the player object updates the positon of the main camera to the camera pos every frame does that make sesne?

#

sense?

rich adder
#

yeah but thats not the issue if the root of the parent is wrong in the first place

dreamy rose
#

wdym

#

ik thats not the issue

#

you were just asking

rich adder
#

you were showing why the camera is on his shoulder

dreamy rose
#

yeah im asking why its like that

rich adder
#

when you set something to = transform.position just goes to whaetver the pivot is

#

if your model has the pivot there, then it will go there

dreamy rose
dreamy rose
rich adder
#

like not a video, send the actual code

dreamy rose
#

alright

#

wrong bif

#

vif

#

mb

rich adder
#

dont send code as images

dreamy rose
#

want me to copy paste it?

rich adder
#

the code is to give context for the rest of how you handle parenting / positioning

dreamy rose
#

i screen recorded iot

rich adder
eternal falconBOT
dreamy rose
dreamy rose
rich adder
dreamy rose
#

camera holder

rich adder
# dreamy rose

where is cameraPos at during animation/play mode. click on it and show its gizmos(arrows)

dreamy rose
#

it changes when iclick play

#

give me as econd

rich adder
#

seems like animation might be shifting your transforms

dreamy rose
#

yeah

#

i tried to see if there's a problem in bledner but everything looked normal

rich adder
#

where is the armature at before playmode

dreamy rose
#

hold on

#

wrong

#

vid

#

danmi t

#

@rich adder here

rich adder
#

you can see the issue now right

dreamy rose
#

yeah

#

lol

#

how do i fix that tho?

#

that wasnt a problem before i imported the animation tho

rich adder
#

just put the position to 0 , 0, 0

dreamy rose
#

oh okay

rich adder
#

player Obj too

#

generally child shouldnt be offset

#

unless you got some extreme case, like the cameraholderpos to the head pos etc

rich adder
#

mouse input shouldn't need Time.deltaTime

#

thats why you got it cranked to 300

#

the mouse axis is actually the distance that it took from last frame so its already framerate independent

dreamy rose
#

oh okay

#

also uh

#

it still didnt work

#

for some reason

#

let me screen record thjis rq

rich adder
#

wdym doesn't work

void dawn
#

ok so i have this system where the player has all the guns in his inventory but can only use them if he walks past the gun , bur for some reason it isnt working , i dont know what happened if its in the code or in the inspector , let me show you the code

code for the guns be picked and unlocked https://paste.ofcode.org/3aR4vDkK2dZJDsX6LcVkWAH

code for the players inventory called weapon manager https://paste.ofcode.org/kAs9wybiFvXB2dTBL674Uk

code for the weapons https://paste.ofcode.org/XYZ4GUVHNDSfy8URF8y2Zb this is the first one

and this is the second one https://paste.ofcode.org/32SR5s8nbEj5NrwSX4QrJwf

dreamy rose
void dawn
#

if anyone is able to help me they get a free drawing

dreamy rose
rich adder
dreamy rose
#

whatta fuck

#

i didnt see that

#

why is he nested there

rich adder
#

lol you tell me

dreamy rose
#

i remobed

#

him

#

its still the same

rich adder
#

you literally dragged it there in the video

dreamy rose
#

lol i have no uidea why he was there

#

probably BY accident LMAO

#

either way

#

i dragged it out

#

its still the same issue

rich adder
dreamy rose
#

i have no idea how to check that could you tell me ?

rich adder
#

click each object and make sure the arrows are where they need to be, eg not offset

dreamy rose
#

oh

#

u mean that

#

okay

rich adder
#

if the change during animation, you messed up somewhere there. are you using a humanoid rig ?

dreamy rose
#

iyeah im using a humanoid rig

rich adder
#

unity is pretty pick with that

dreamy rose
#

damn its centered in blender i think thanks for the help 🐱

rich adder
#

make sure you set the Root baked and all that jazz

#

I'm not very good with animations but I'd start checking the bake modes

dreamy rose
#

oh yeah i could try that

rich adder
#

yeah afaik those keep the object in its place when not using root motion you want those on

rich adder
# dreamy rose alright thanks

this guy explains this pretty good iirc this video back in the day
https://youtu.be/9bV0K-pifXE

Root motion project repository:
https://github.com/RoundBearChoi/RootMotionExperiment

I'm using humanoid in this project. If you want generic, check out this project (it's the same idea):
https://github.com/RoundBearChoi/GenericRootMotionExperiment

Check out my 2.5D platformer:
https://www.youtube.com/playlist?list=PLWYGofN_jX5CNMI6tqlxNtTc7v9...

▶ Play video
void dawn
#

hey guys i provided alot of information , can anyone help please ?

rich adder
#

what did you try to debug the issue

#

this is a lot of systems to check through

rich adder
#

tbh i dont got the time rn

void dawn
rich adder
#

" tried changing the code"

rocky canyon
#

need to know atleast why ur changing code

rich adder
#

thats not debugging

rocky canyon
#

just throwing stuff at the wall isnt the best way to progress

rich adder
#

Debugging is trying to narrow down the issue

#

trial by elimination

#

Debug values, make sure they are what you expect them to and if not, narrow where they are going wrong

willow shoal
#

hi. i have a problem with my script with scene teleport to second teleport scene. After make this SetActive false its not working again if make SetActive true : / i trying fix it but i dont know how

rich adder
willow shoal
#
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class escape : MonoBehaviour
{
    public void FixedUpdate()
    {
        if (Input.GetKey(KeyCode.Escape))
        {
            SceneManager.LoadScene("startmenu");
        }
    }
}
rich adder
willow shoal
#

after SetActive true from false its not working ;-;

rich adder
#

there is no SetActive here

willow shoal
#

this is not working script after setactive false

rich adder
#

set what active?

#

from where

#

how

#

also never good idea to put inputs in FixedUpdate

willow shoal
#
public GameObject fPlayer;
    
    void Update()
    {
    if         (Input.GetKeyDown(KeyCode.Escape))
    {
            
            fPlayer.SetActive(true);
    }
willow shoal
#

so any idea?

rich adder
rich adder
#

this is a mess

rocky canyon
#

not sure if that fits in the puzzle here just saying

rich adder
#

you havent explained exactly where does False come in

deft breach
#

why the SetActive(false)?

willow shoal
#
public GameObject fPlayer;
    
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            
            fPlayer.SetActive(true);
        }
if (Input.GetKeyDown(KeyCode.Space))
        {
            
            fPlayer.SetActive(false);
        }
```} okey now?
rich adder
#

so you are setting it to false in the inspetor?

rocky canyon
#

that should work..

#

just note that the ESC key also unfocuses the game window

#

breaks out ur mouse..

rich adder
#

na

rocky canyon
#

u have to reclick the game window to retrieve inputs again..

rich adder
#

this will just set it to inactive

rocky canyon
#

might want to use a different key to test

#

instead of Esc

willow shoal
#

but my srcipt up not working after setactive false ;-;

#

and then on

deft breach
#

what are you trying to do here?

rocky canyon
#

which script?

rich adder
rocky canyon
#

explain more detail

rich adder
#

Update doesnt run on disabled gameobject

proud fossil
#

I'm guessing he disabled the object with the code dx

rich adder
#

assuming so yes

proud fossil
#

if u wanna do that u need another object with that code

#

or just anything else

rocky canyon
rich adder
#

anyway gotta go, goodluck with this one guys

willow shoal
rocky canyon
#

if u disable a gameobject all the components on it are just as disabled

rocky canyon
#

it isnt the same gamebject as this script is it?

deft breach
#

@willow shoal are you just trying to load a new scene when esc is pressed or are you trying to do something different?

rocky canyon
#

better yet explain
what ur trying to do:
what ur expecting to happen:
what actually happens:

#

and more than just IT doesnt do the thing

willow shoal
deft breach
#

what? If your only loading a new Scene put that into Update and remove all the SetActive stuff

#

but I dont quite get it

willow shoal
rocky canyon
#

if u load a new scene all thats gonna go away anyway..

willow shoal
#

exit button after make this on not working

rocky canyon
#

the script doesn't transfer over unless u make it..

#

if theres the same script in the new scene thats a different instance of that script

#

and starts fresh w/ default settings

deft breach
#

is fPlayer the Exit button?

rocky canyon
#

show inspector.. show what u have assigned.. show what object has the script ur referencing..
which object is hte fPlayer..

willow shoal
rocky canyon
#

show a video of the hieararchy as u play test..

#

give us something

deft breach
#

yes show video

willow shoal
rocky canyon
#
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class escape : MonoBehaviour
{
    public void FixedUpdate()
    {
        if (Input.GetKey(KeyCode.Escape))
        {
            SceneManager.LoadScene("startmenu");
        }
    }
}```

so far we know this script is on the `exit` gameobject correct?
proud fossil
rocky canyon
proud fossil
#

I feel like we're just going in circles rn

deft breach
#

So did i get this right @willow shoal :

  1. You load the start Menu with the Exit Button on it by pressing Esc
  2. Your Exit Button is Disabled for some reason and your waiting for another Esc Press to enable the Exit button (fPlayer)
  3. And with Space you disable the Exit button??
rocky canyon
#

^ a description/explaination like this would be HUGELY benificial

#

until we get one i agree with @proud fossil

willow shoal
#

but after space and then again press exit its not working

#

i cant record because somethink with computer is wrong i sorry ;/

#

for show i need instal a program

deft breach
#

Ok wait so your in your Game (Main Scene) and then you press Esc to get to the Main Menu. The Exit Button is on the Main Menu right? What is the Space pressing for?

willow shoal
#

two exit should change scene

rocky canyon
#

put debug.logs in ur code..

willow shoal
#

becasue open option and then quit

rocky canyon
#

u have to re-click the scene window to refocus

willow shoal
#

oh

rocky canyon
#

u cant press two exits w/o having to click the window between

supple sand
rocky canyon
#

BECAUSE as i said earlier ESC is a hotkey for editor to Unfocus the window (so u can move ur mouse around)

#

u should use different keys to test ur system

#

and then swap over to esc before the build

willow shoal
#

okey

supple sand
#

Input needs to go in update not fixed update

rocky canyon
willow shoal
#

u give me idea for just change button for options

#

xd

proud fossil
#

man that felt like a whole puzzle game

rocky canyon
#

i personally use the ~ key for escape menus

#

so aggravating to lose focus

rich adder
rocky canyon
#

probably could just change the hotkey to that insted

rocky canyon
proud fossil
#

I remember doing that once lol

rich adder
#

Good ol days of OnTriggerStay also

rocky canyon
#

some people still put their rigidbody inputs in fixed..

rich adder
#

why is my E key brokenn

rocky canyon
#

gives me soo much anxiety

rocky canyon
rich adder
#

Oh OnTriggerEnter is even worse you gotta be quicksilver

dreamy rose
#

i need some more help for some reason my players center of gravity is somewhere else how can i fix this

dreamy rose
deft breach
#

Set PlayerObj Position to (0, 0, 0) @dreamy rose

rocky canyon
#

u can also do it via code

#

also.. u could do urself a favor and move the player to match its transform..

#

no reason to have the pivot way out there in outter space

deft breach
dreamy rose
#

the pivot just moves

#

away

#

from the oplayer

rocky canyon
#

move ur children and stuff to the pivot.. and then move the entire thing back to where it should be

dreamy rose
rocky canyon
#

how???

dreamy rose
#

idk hive me as eonc to try it

#

itm ight work

#

look

rocky canyon
#

what u have selected is Player

#

its showing its pivot

dreamy rose
#

yeah

rocky canyon
#

if u move the things inside

#

that pivot will not move..

dreamy rose
#

oh

#

my fault im new ti thus

#

this

#

so i just

#

mvoe everything else

#

to

#

0 0 0?

deft breach
#

yes move your children to (0, 0, 0) and then move your Player to the middle

rocky canyon
#

u want ur ROOT object to have its pivot at 0,0,0

#

with a scale of 1:1:1

#

always and forever lol

dreamy rose
#

oh my god

#

it worked

rocky canyon
#

the graphics and everything else should be children

dreamy rose
#

thats so stupid wow

rocky canyon
#

thats the objects that u re-arrange

dreamy rose
#

tysm guys

rocky canyon
#

luckly u had ur pivot mode set to "Pivot" and we could see

#

if u had it on Center.. it would be a problem someppl might not notice

#

and it def just complicates things (especially with a rigidbody involved)

rocky canyon
#

with correct pivots u shouldnt even need to worry about the rigidbody's COM

stark quartz
#

hey guys, i'm trying to do a parallax background that scrolls towards a direction, but i'm not too sure on how to approach it.
after some googling i have encountered some tutorials, but none of them tackle both independently scrolling towards a direction and being parallax at the same time.

#

after trying it out for myself i have gotten 2 different scripts:

rocky canyon
#

use !code external paste websites for code that lengthy from now on if u could thankyou 🙏

eternal falconBOT
rocky canyon
#

not u matiego

willow shoal
#

oh i miss sorry wait

stark quartz
#

here

willow shoal
#

hi again. i learn and testing somethink.. where i should add

SceneManager.LoadScene("startmenu");```
 for  
```cs
private float delayTime = 1f;
private bool holdDelay = false;
IEnumerator DelayTimer()
{
    holdDelay = false; 
    yield return new WaitForSeconds(delayTime); 
    if (Input.GetKey(KeyCode.F))
    {

        holdDelay = true; 
    }
} 
lofty jacinth
#

Alright
I learnt the basics of C# n am ready to try the engine
Any tips on how I should begin or any tutorials to follow??

rocky canyon
#

much cleaner for big code blocks

eternal falconBOT
#

:teacher: Unity Learn ↗

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

willow shoal
#

i dont know how to make this work with my scene manager

stark quartz
# stark quartz https://paste.mod.gg/bpoxxnkkunrk/0

the current setup:
the main background asset being the parent of 2 other copies of itself, placed both the right and left of itself.
the idea is that the background images would move left constantly, and update accordingly to make itself look seamless.

rocky canyon
#

just jump in the deep end and roll w/ it

rocky canyon
rocky canyon
#

can u describe the parallax affect? theres different types

#

is this for background/ landscape for a side scroller?

stark quartz
#

yes, similar to thishttps://www.youtube.com/watch?v=AoRBZh6HvIk
but i need the background to scroll independently in 1 direction, while also being affected slightly by parallax.

We're going to add parallax to our 2D scene's background layers, then make it endlessly scroll!
This is a complete tutorial - from adding player, setting up the camera - to a beautifully scrolling background! Basically make a whole endless runner / side scroller in 7 minutes :o

FREE Player Package: https://www.patreon.com/posts/102090173
FULL P...

▶ Play video
#

but what's happening is that the background asset (the train tracks in this example) keeps in place instead of moving towards the left

raw mountain
stark quartz
#

there's that, but then again it doesn't move at all which is not intended

#

also FixedUpdate was already applied

stark quartz
ruby python
#

Hi all, I'm having such a weird brain fart at the moment.

I've got this spawner script (basically when the c130 hits the trigger, I want to 'start' the spawn countdown that lives in update, but for the life of me I can't figure out how to do it. I tried a simple boolean in the OnTrigger (spawnThings = true), but when I put the boolean check in my update it breaks the countdown timer. Would anyone have any ideas please?

https://hastebin.com/share/okuwovucir.csharp

timber tide
#

Define break

ruby python
#

Sorry, the timer gets to 0 once, but on the second run through it stops before hitting 0

#

Sokay, I think I fixed it by changing my approach slightly.

proper yacht
#

I'm using Debian 12 and when add sprites in Tile Pallet Unity slows down considerably

#

It looks this way

#

When I delete folder Tiles it works fine

#

As I understand that's an optimization issue

#

The amout of tiles is big

hot laurel
#

no clue, you can profile the editor and check what happens

sand snow
#

um ik this is a dumb question but for some reason i cant figure it out, but why are two of my gameobjects passing through eachother instead of colliding? they both have colliders, and neither of them have "is Trigger" on. my game is 2d and they are both on the same z axis

grand snow
proper yacht
#

There's a lot of them

grand snow
#

i wonder if its trying to make thumbnails and its super slow

ruby python
sand snow
rocky canyon
ruby python
# sand snow no

for physics to work, iirc at least one of the objects need a rigid body

rocky canyon
#

if ur translating.. "teleporting" transform.position = something.. etc then the oclliders wont respect collisions

#

also should be using a rigidbody on them if they intend on colliding with other objects

sand snow
rocky canyon
#

rigidbody says it intends on being used by the physics system
a collider only doesn't do anything but define the shape (defines shape and boundary of an object for collision detection)

grand snow
proper yacht
#

When I've loaded for the first time it showed something but I didn't notice

vapid ledge
#

are unity tilemaps actually used in bigger projects or are they more a kind of beginner/accessibility thing? i have one that works fine but it seems pretty limited in terms of detecting collisions and auto tiling when there are lots of different tile types

tulip stag
#

I always get this error no matter which file path I choose

        {
            // Goes to Sources folder and checks if it exists
            if (!Directory.Exists(filePath))
            {
                UnityEngine.Debug.LogWarning($"Source folder not found! Creating: {filePath}");
                Directory.CreateDirectory(filePath);
            }

            string json = SerializeToJson(source);
            File.WriteAllText(filePath, json);
            Debug.Log($"Saved Source to {filePath}");
        }```
grand snow
tulip stag
#

It's the same for any folder path i choose

grand snow
wintry quarry
slender nymph
#

don't crosspost. also !collab 👇

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

grand snow
rich adder
void dawn
#

sorry my anger but im just stuck , i dont know what to do , i remade the scripts i need 3 times by now and none of them work how they should

#

am i just stupid ?

wintry quarry
#

Yeah you seem to be trying to write the file data to the folder path @tulip stag

tulip stag
#

ohhhhhhhhhh 😵‍💫

#

Honestly, my code was pure spaghetti. I deleted my entire save system (wasnt much) and am starting from the beginning

#

and yeah. Methinks that's what the problem was

rich adder
#

is working now?

tulip stag
#

Just so I know for when I hit that same obstacle— what's the right syntax for specifying folder and file name in File.WriteAllText?

tulip stag
rich adder
#
public static void SaveToFile(Source source, string filePath, string fileName)
    {
        Directory.CreateDirectory(filePath);
        filePath = Path.Combine(filePath, fileName);
        string json = SerializeToJson(source);
        File.WriteAllText(filePath, json);
        Debug.Log($"Saved Source to {filePath}");
    }```
tulip stag
#

ugfhhhhhhhHhHHhhhh my code is getting too complicated and I'm losing sight of all the moving pieces 😭

#

Trying to spot my error there was a nightmare because I kept jumping from file to file. Too many references!

rich adder
#

if you want to ease spaghetti you can try observer pattern, avoids a lot of two way spaghetti

grand snow
#

Ha i didn't realise it was that simple 😐 , glad its fixed

young mirage
#

Whats the best learn to start off doing as a complete beginner to Unity?

rich adder
#

this will give you all the lessons to get your foot in the door

young mirage
#

Thank you!

sand snow
#

does anyone know how to fix my animation from looping? I am making a game over screen and want "game over" to pop up, but the animation keeps replaying (loop is unchecked) i want game over to stay on the screen, not disappear and reapper over and over

sand snow
# rich adder show code

it just instantiates a prefab with an animator component, the animation isnt ran through code

#

should i still show code?

rich adder
sand snow
#
{
    public AudioSource gameOver;
    public Text gameOverText;
    public Button tryAgain;
    [SerializeField] GameObject parent;

    private void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.gameObject.CompareTag("Enemy"))
        {
            EndGame();
            Debug.Log("Collision Detected!");
        }
  
    }
    void EndGame()
    {
        gameOver.Play();
        Instantiate(gameOverText, parent.transform);
        Instantiate(tryAgain, parent.transform);

    }```
#

the object spawns and the animation is instantly played because its a component

rich adder
sand snow
edgy sand
#

so I'm following a blackthornprod tutorial on making a card game and someone pointed out in the comments section that doing this

public void Update()
{
  deckSizeText.text = deck.Count.ToString();
  discardSizeText.text = discardPile.Count.ToString();
}

is a bad idea because it updates way too often, however I'm struggling a little to find a good way to make it only update on effect. Anyone have any insight?

sand snow
#

thats what i was trying to say, the animation isnt in the code at all, its done through the inspector

rich adder
#

though i heard text was optimized for TMP as such that only when value updates does it refresh it.

edgy sand
#

whelp what I'm gonna do is ignore it for now lol

#

when it becomes a problem I'll deal with it

rich adder
#

though its good habit to learn the observe pattern at some point

#

its pretty powerful and its not that difficult

edgy sand
#

I definitely will, but I'm trying to prioritize getting things functional before I get them pretty

rich adder
#

I mean observer pattern is not just "being pretty" ..but do ya thing..

edgy sand
#

can you elaborate?

#

because I might be misunderstanding this then lol

sand snow
#

you can see to the right there is the animator and on the screen is the animation editor

rich adder
# edgy sand can you elaborate?

in most cases you don't want to poll every frame for something , you can avoid it w
the observe pattern, helps improve many things , among one of them is not having to poll for changes

edgy sand
#

I'll take a look at it then, thank you :)

primal cliff
#

Very very quick question, I have an object that needs several sounds (and therefore several audio sources), assuming I have 2 audio sources what would I write in this overload to select which one? (writing a string gives an error)

rich adder
rich adder
#

the overload isn't for distinguishing which one it is..

polar acorn
primal cliff
#

I wasn't thinking right, got it thanks

rich adder
#

sometimes you need multiple audiosources if they go into different mixer tracks for example

#

or play at same time

rich adder
#

the animation you put it in the controller yes? show that controller

rich adder
#

open it

#

as in did you not put the clip in it?

sand snow
rich adder
sand snow
rich adder
# sand snow

hmm alright nvm then. only one thing left. select GameOver clip and show the inspector for it

sand snow
#

like the game over text?

#

and show the inspector tab for it?

rich adder
#

the no the Animation Clip

#

Game Over

sand snow
#

im not sure i understand im sorry, i thought thats what i just did

rich adder
#

the animation CLIP that says GameOver

#

select it

#

the Clip Asset with the Triangle

sand snow
#

okay i fixed it, i unchecked the loop time earlier, im not sure how it rechecked itself, maybe i was playing the game

sand snow
rich adder
rich adder
eternal falconBOT
#

:teacher: Unity Learn ↗

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

rich adder
#

it has detailed lessons to learn each tools and also how to control states

sand snow
#

sorry for the confusion earlier, i thought the clip asset was called animation or something, thats why i was so confused, sorry about that

#

thats why i didnt understand

sand snow
#

why can i not drag a game object into my prefab inspector? its a button that say try again, and when you click it, it is supposed to restart the game, the code works but i cant put the code into the button (but only when the button is a prefab) if it wasnt a prefab, it works

rocky canyon
#

the code has to be on a gameobject.. and that gameobject is whats referenced within a button component

hot laurel
#

you cant serialize reference to scene GameObject in to prefab

rare elm
#

i added a package to my project by double clicking a .unitypackage. it turned out to be the wrong version, so i grabbed another version, and installed that. apparently now i have both installed. i went to the package manager to remove it but i don't see it in the list. how do i remove one of these packages?

rocky canyon
#

prefab shouldnt matter.. but it needs to be in the scene for the Monobehavours to run

rocky canyon
#

if not its scattered thruout the project most lkely and will have to be manually removed

rare elm
#

... really?

#

i don't understand why it isn't in the package manager

rocky canyon
#

yes, it doesn't work the same as something from the packagemanager

rare elm
#

damn. i have to start over, don't i

rocky canyon
#

where all the files are in deterministic places.. ur unitypackage shoulda had everything within a subfolder

rare elm
#

it's a single file

#

oh wait, you mean after installation

rocky canyon
#

b/c its not from teh packagemanager.. its a unitypackage..

#

different things

rare elm
#

where would i look for this folder

rocky canyon
#

it'd be in the Assets folder

sand snow
rocky canyon
hot laurel
#

would be good to share screnshoots, so we can see what you see

hot laurel
#

you trying to set reference of a scene object to prefab asset, which is not supported

sand snow
#

so should i instead keep it as its own game object and the enable/disable it using script?

#

that way the button will work i think

hot laurel
#

you can

  • have instance of prefab in scene with reference to scene gameObject
  • adds by code a reference to that GameObject to spawned instance of that prefab
sand snow
#

ohhhh okay that makes morew sense actually, thank you

rare elm
rocky canyon
#

yup.. you'll need to grab those references at runtime..

#

prefabs need references that either

  • in the scene with them
  • contained within the prefab themselves
#

basically needs to know what instance of the prefab has the script
not the actual prefab.. as those don't exist until u spawn them.. or physically drag them into the scene..

hot laurel
#

scene GameObjects serialization forces this behaviour, if they were serialized by sceneID and some additional data then it would work somehow but it would create infinite dependency in some cases😬

mystic lark
#

I am getting the null refrence error i tried doing checks even did return; but it still gives me the error

#

cs 29

hot laurel
#

did you tag the object correctly?

mystic lark
#

yes but the object is a prefab

hot laurel
#

its instance of a prefab or a prefab?

earnest wind
#

uhm
did i do something wrong here?
Debug.Log("pos2 = " + pos2 + " pos1 = " + pos1 + " Mathf Lerp = " + Mathf.Lerp(pos2 - 0.5f, pos1 - 0.5f, 1f));
shouldnt the result be 1, 0, and 0?
cause 1 - 0.5 = 0.5, 0 - 0.5 = -0.5
and lerp 0.5 and -0.5 = 0??

mystic lark
#

is that the problem?

hot laurel
#

so if its not an insteance then you mean a prefab which is an asset that its not in the scene

#

so you cant search in scene for it

mystic lark
#

but arent i searching for it with a tag

hot laurel
#

its not in scene, you cant search for it in scene then

#

instantiate that prefab in scene and search

#

then you get results other than null

mystic lark
#

it makes sence

#

thanks

modest dust
earnest wind
#

in other scripts

#

i though t = how fast it does it 😭

modest dust
#

Mathf.Lerp(a, b, p)
is the same as
a + (b - a) * p

#

0.5 + (-0.5 - 0.5) * 1 = 0.5 - 1 = -0.5

hot laurel
earnest wind
#

damn

polar acorn
sterile radish
#

how can i find all object of a certain type and then add them into an array at the start of the game?

rocky canyon
#

theres also (FindObjectsSortMode.InstanceID) and (.TransformHierarchy)

#

ihttps://docs.unity3d.com/6000.0/Documentation/ScriptReference/Object.FindObjectsByType.html

cobalt flare
#

How do i learn unity?

north kiln
#

!learn

eternal falconBOT
#

:teacher: Unity Learn ↗

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

surreal plover
#

No I dont believe so

#

It has something to do with the input assembler

#

I cant figure out what exactly it does

rocky canyon
#

the only thing i can find about them comes up about bit fields and bit packing structs..
other than named paramaters Car myCar = new Car(make: "Tesla", model: "Model S", year: 2025);

polar acorn
#

This is hlsl, not C#

rocky canyon
#

aye that explains it lol

somber otter
#

I have what is probably a pretty silly question. I wanted to try learning to use the animation tree. I got this far from a tutorial, however I just don't really know where to go from here. The animator is added as a component to my mannequin model, do I need to write a script where certain inputs change values called x and y? Any help is appreciated.

#

I've tried setting it as my layer default state, and also tried a transition from my idle when any movement is detected, but im obviously missing something pretty big.

cosmic dagger
somber otter
#

It was a super short video that ended as soon as they were done adding the animations as motions. They just said you're ready for the next steps that I'll go over in another video and I cannot find said video on their channel at all so

#

I'm gonna figure it out eventually, there's just nobody with a breakdown of how to implement this from beginning to end that I have seen.

cosmic dagger
#

This looks like a blend tree. There should definitely be videos on how to move a character using a blend tree . . .

solid heart
somber otter
misty moon
#

In my code, I have a playercontroller, which handles all player actions.
However, I find it quite cluttered. In the attachement, I have 8 methods that I have to scroll through when working on other parts of the playerController.

What's the correct way to handle this?

#

I understand that I'm meant to use code blocks, but as this question has nothing to do with the content of the code, I figured a screenshot would do

misty moon
cosmic dagger
azure citrus
#

hello, i want to make the player move along as the train moves like how it works in real life. Is there a way I can approach this?

I'm thinking of detecting distances between player and each carriage, and see if its 0 or negative then add the train's movement to the player's movement

tiny wind
#

when I update my game and want to publish it, do I need to Build it again?

timber tide
#

Pretty much, but sometimes just changing a few things doesnt seem to do a full recompile

tiny wind
#

ight thx

timber tide
#

if you are debugging your build tho, make sure you select dev build as that'll greatly reduce the time

#

and provide you with a console to print to

eternal needle
ruby python
#

Mornin' all,

I was just wondering if anyone would be kind enough to take a look at this and see if they can see what I'm missing (why my 'targetting' is off) please?

As you can see on the image the vertical targetting is 'off' (the red are my collision planes, enabled visuals for testing). I'm not really sure what the issue is. 😕

using UnityEngine;
using UnityEngine.UI;

public class UIController : MonoBehaviour
{
    [SerializeField] Vector2 cursorHotspot;
    [SerializeField] RawImage reticle;

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

    // Update is called once per frame
    void Update()
    {
        reticle.transform.position = Input.mousePosition;
    }
}

This is my reticle code, pretty simple etc.

And this is my turret controller Code (gets rotations based on the raycasthit screen position etc. etc.

https://hastebin.com/share/jigicenuka.csharp

#

Just because it doesn't show up in the screen grab. The system cursor arrows 'point' is dead centre of the reticle.

tiny wind
#

how do I share my game to another computer? can I just put the whole folder in a drive and send it?

#

GitHub?

eternal needle
# ruby python Mornin' all, I was just wondering if anyone would be kind enough to take a look...

there are a ton of issues here. first, you have no debugs in your code, so of course theres no way u can be sure of where the issue is.
add some way to check that the UI controller is moving the object correctly (its probably not since mousePosition is pixel coordinates)
2nd you shouldnt be modifying the x and z of a quaternion. a quaternion is not euler angles so this doesnt make sense to do

slender nymph
#

github is a host for git repositories

ruby python
# eternal needle there are a ton of issues here. first, you have no debugs in your code, so of co...

I do have a habit of removing debugs when posting code, just for ease of reading, sorry. 😕
The UI Controller is moving the reticle object correctly, at least on the X and Y (you can';t see it on the screen grab but the reticle is locked to the 'system' mouse pointer 'arrow point'
But, saying it out loud, it occured to me that it's possibly to do with the Z positon of the reticle.

Thank you, I'll take another look at the turret controller.

I am so out of practice with this stuff. lol.

west radish
#

to check, try moving the turrets position so that it is directly under the camera

#

I'm curious to see if the beam ends up hittng the reticle when you shoot

ruby python
#

Oh god. lol. That made it sooooo much worse. lol. So yeah, definitely something going on with my aiming script. Will have a look and rework it 🙂

#

LMAO

#

Of all things. I was getting the direction based on localPosition. Shoulda been Position. I'm such an idiot. lol.

#

Fixed it now 🙂

#

Thanks for the suggestions folks 🙂

west radish
#

ah! glad its sorted

ruby python
#

It's always something really stupid like that. lol.

west radish
#

welcome to programming!

ruby python
#

uh huh. Haven't done any Unity stuff for a few months, so still getting back into the swing of things. lol.

cobalt flare
#

!learn

eternal falconBOT
#

:teacher: Unity Learn ↗

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

tiny wind
#

this was literally just working a few moments ago, what on earth happened

burnt vapor
tiny wind
#

Hmm, I dont recall making one

burnt vapor
#

Sorry, my event knowledge is not that great since I barely use them

#

It is probably the fact you can't invoke like this. I think the button is only able to invoke the event. Maybe it has a "RaiseOnClick" method?

slender nymph
#

assuming it's UnityEngine.UI.Button, onClick is a UnityEvent so it does have an Invoke method and there wouldn't be anything special preventing that method from being called outside of the Button

thorny flame
#

i have a rotating platform and the player script supports that, but its very jittery when standing o nit, why could that be?

slender nymph
#

see #854851968446365696 for what to include when asking for help
but i'd bet it's actually your camera updating out of sync with the object it is following

thorny flame
#

its first person, so not out of sync

slender nymph
#

how have you confirmed that

#

because just saying "first person" does not magically make your camera update on the correct timestep in the correct part of the frame

tiny wind
slender nymph
#

that would be the button component from unity ui, the one on a canvas

tiny wind
#

oh ight

slender nymph
#

is that the kind of Button you are attempting to get with the GetComponent?

#

from what little information you've provided i'm going to assume you accidentally imported the UIElements namespace instead of the UI namespace, they are completely different. make sure you are using the correct one

tiny wind
slender nymph
#

and UIElements is incorrect here. canvas ui types exist in the UnityEngine.UI namespace. UnityEngine.UIElements is for the UI Toolkit stuff which does not exist as individual objects in the scene

tiny wind
#

yeah I get it now, so, do you know how to fix this?

slender nymph
#

does the error only appear in visual studio or does it also appear in the unity console?

tiny wind
#

it does aswell

slender nymph
#

you haven't done something silly like uninstall the ui package, right?

tiny wind
#

nope

slender nymph
#

show the error in the unity console

tiny wind
# slender nymph show the error in the unity console

Ok so wait, I got somethign mixed up, the Console error was because I forgot to put the full line of code buttons[currentPosition].GetComponent<Button>().onClick.Invoke();
but when I put the whole line, UnityEngine.UIElements showed up on my code and the console is now saying this

slender nymph
#

that first error is just an editor error and is irrelevant. the second means you still haven't bothered removing the UIElements using directive

#

and if you type out that line and it automatically adds the UIElements namespace then you need to start paying better attention to what you are autocompleting

tiny wind
slender nymph
#

right so when i asked before if it also showed up in the unity console, when you confirmed it did, was that a lie? because i asked that for a specific reason

tiny wind
slender nymph
#

close visual studio, go into the external tools settings in unity, regenerate project files, open visual studio again

tiny wind
#

ight

silent shale
#

Whats the problem?

slender nymph
#

!code
also provide info about the error

eternal falconBOT
silent shale
#

rb.linearVelocity = new Vector3(rb.linearVelocity.x, 0f, rb.linearVelocity, z);

#

Problem is with "Vector3"

slender nymph
#

yes, Vector3 only takes 3 arguments, you are passing 4

silent shale
#

How to fix it?

fleet venture
#

uh? why is this what happens if i do?

slender nymph
# silent shale How to fix it?

you currently pass a float, another float, a Vector3, and whatever z is supposed to be. perhaps you meant to pass 3 floats

slender nymph
#

yes that is clear. however i wanted them to come to that realization their self by reading the code

late badger
#

fairs

fleet venture
silent shale
#

thanks anyway

slender nymph
#

pay very close attention to what you typed

#

and if you do not see red underlines in your code indicating an error, then get your !IDE configured 👇

eternal falconBOT
fleet venture
#

can visual studio not render this? i normally use rider so idk

#

in rider this gets rendered

silent shale
fleet venture
#

like in rider its not just html

#

or whatever

teal viper
fleet venture
#

or whatever its called in c#

teal viper
#

Aaah

fleet venture
#

like it gets rendered in intellij and rider like this

teal viper
#

It should work in VS to a degree. If used correctly. Donno. I barely use it.

fleet venture
#

oh

#

ye i am used to rider so idk either

real thunder
#

I tried to make a property out of an array and it works except even debuglogs in the setter are not called, how does it work?

fleet venture
#

its kind of hard to read them when they dont get rendered tbh

ivory bobcat
real thunder
#

I have no idea!

ivory bobcat
#

Unless you've got some code to share, folks will likely not be able to help you

real thunder
#

I have something like

[SerializedField] GameObject[] _stuff;
private GameObject[] stuff
{
  set{_stuff = value; Debug.Log("Log");}
}

setting works but I ain't getting logs logged out

#

yeah wait

#

here, it was not actual code

ivory bobcat
#

Looks fine. How're you calling it?

real thunder
#

I realize I do nothing with an array itself, I just expect it to log every time I modify any element

fleet venture
#

how do i render an outline around a sprite?

#

in 2D

#

i couldnt get the outline component to do anything

real thunder
#

seems like it's valid that it's not logging anything when I access elements

#

now my question is how to make something happen every time I modify an element of an array? if it's possible

#

I retroactively realized that I need some stuff to happen every time I do that

#

and modifying each line where this array is called sounds like a hassle so can I avoid it?

fleet venture
real thunder
fleet venture
#

so then how do i make an outline for a sprite

real thunder
#

I am unaware of other solutions but writing a shader 🤷‍♂️

fleet venture
#

ok but how hard is a shader?

real thunder
#

yes

fleet venture
#

ye thats what i was worried about

real thunder
#

I have no idea honestly, might be not that hard, I am just sure it's not trivial

fleet venture
#

ok ill try following this tutorial ig

real thunder
#

you don't have to write them tho, shader graph exists, but I have almost no experience at neither writing or noding a shader

real thunder
fleet venture
#

this is not great but with a bit of tweaking maybe

real thunder
#

is that a shader?

fleet venture
#

yes

#

the white line is the shader

#

the black is already on the texture

real thunder
fleet venture
#

i succesfully made the line thicker but now i need to fix the places where its like not rendering

#

okay so the outline gets cut off because the texture stops there

#

how do i add padding

#

there is this extrude edges but it doesnt seem to do anything

undone spindle
#

I am learning from a Leonty source, and the instructor has a different version than mine. When I write the code he writes, I don't see the same results as he does. Is the issue related to the version?

slender nymph
solid heart
solid heart
gaunt fjord
#

Hi guys. So basically, I've watched bro code's tutorial on C# and I'm familiar with the very basics, but I'm wondering if it's a good idea to learn C# alone and then switch to learning the Unity game engine itself, since I imagine it would go much faster and smoother if I did both at the same time but I'm not sure how to go about it.

gaunt fjord
wintry quarry
#

I knew C# before I learned Unity

#

it made it significantly easier to learn Unity

#

Because I didn't struggle with basic C# coding concepts

gaunt fjord
#

Alright then, thanks bro

void dawn
#

if you are able to fix my project you get a special prize

so here is the link for my project, i got problems with 3 scripts in specific

WeaponManager.cs – Manages weapons, unlocking, switching, and equipping.
WeaponPickup.cs – Handles weapon pickups when the player collides with a weapon.
WeaponCheat.cs – Unlocks all weapons when pressing F12 (cheat feature).
im trying to make a quake like game but these scripts aint working , i have tried debugging all day none of these scripts work as they should, i dont know what im doing wrong, if you are able to fix my problem i will make a drawing for you of your choice
the weapon manager tries to unlock the guns but the player cant equip them, the only gun the player can use right now is the pistol, the gun he starts with, the player also has a all the guns in his inventory but he cant use them because to unlock them he has to walk into a gun on the ground and unlock it with the WeaponPickup script , the WeaponManager takes care of the player inventory and what guns he has unlocked or not. the WeaponCheat is more like a developer feature were the player unlocks all the guns so i can test them all

if you can make these 3 scripts work as they should, send me the result and i can give you the drawing you want

here is the link to the project https://drive.google.com/drive/folders/1oBaAE0wfZ-6hBSVx-ACt0XRo2xG-OzCM?usp=drive_link

polar acorn
#

No one's going to download your project and make it for you. Chances are you're trying to make something beyond your ability too fast, scale down and try again.

simple vine
#

guys i was follwoing the How to Make a Slender-like Horror Game in Unity (Part 3) tut by Omogonix and the int and page collect text wasnt working

buoyant finch
eternal falconBOT
#

:teacher: Unity Learn ↗

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

buoyant finch
# simple vine but this guy make tut

that guy wants to inspire and teach you how those systems work he/she is making work and how you too can do something like that . He/She is not teaching you how to copy paste

simple vine
#

ye but that says 750 hours to learn it

polar acorn
simple vine
#

and thats why

buoyant finch
simple vine
#

im not saying excuses

polar acorn
rich adder
buoyant finch
simple vine
#

this is being useless

rich adder
#

it takes literal years, you're in for a long one

buoyant finch
# simple vine this is being useless

I too am making a passion project and encounter many obstacles but I always find a way through it not by any video but through self urgence and passion

buoyant finch
polar acorn
simple vine
agile igloo
#

hey guys a question;

so im making a main menu, and all the pages like options, customization, etc. i would like to make them as own scenes that i load additively

when two scenes load the canvases of both overlap and i cant press the back to main menu button

am i doing something wrong, is there a way to create layouts better in unity, or should i somehow try to scale the canvases so they dont overlap

simple vine
buoyant finch
polar acorn
rich adder
simple vine
rich adder
polar acorn
simple vine
polar acorn
simple vine
agile igloo
rich adder
agile igloo
polar acorn
simple vine
#

ye the E

polar acorn
simple vine
#

that the video not me

buoyant finch
agile igloo
#

@buoyant finch come again?

swift crag
#

interaction, perhaps?