#💻┃code-beginner

1 messages · Page 698 of 1

wintry quarry
#

Only in projects where you want to use the PlayerInput component and you want that component to use the same actions asset that is set there

rotund tiger
#

alr thanks, is there a tutorial i can watch to install this

rocky canyon
#

install it via the website...
once you have you can click "Open in Unity"
it'll launch the package manager and already be navigated to the asset..
click Install -> follow prompts..
open Demo scene

wintry quarry
#

you install it the same way you install any unity package. from the package manager

marsh vale
#

so the one unity provides is like just a basic moveset for yourself

#

if they made you change it to none whats the point of them not having it preset to none in the first place

rocky canyon
#

its there so you have a nice starting base-line..
its pretty generic and can fit lots of games right out the gate..
you also have the option to not even use the new input system..
but its there if u need..

polar acorn
#

They didn't make you change it

#

The fact that your tutorial predates the switch made you change it

#

If you were using a different tutorial, you wouldn't have had to

marsh vale
#

no im not watching the same thing i was just watching a video regarding unitys new input system

#

his was already set the none and he just made a whole new inputset for himself

polar acorn
#

The Input System provides tons of ways to go about the same result, not everything is going to be used by every game

marsh vale
#

ic

rocky canyon
#

thats probably just so he can step thru the process, explain things a bit more.. and not just rely on people knowing what they're doing

#

and yea.. theres sooo many ways to use the new input system 😅 its a bit overwhelming

marsh vale
#

it is

rocky canyon
#

it'll get easier the more u use it

marsh vale
#

im gonna try making a 3rd person dude move around tmrw

#

and see if i can use the input system correctly

rocky canyon
#

you'll also find ways that you like doing inputs and ways you dont.. if u experiment enough

#

unity just gives u hella options..

#

and even more 👀 .. lol i haven't even gotten around to using the Input Module.. or the Player Input component

marsh vale
#

did the asset yall sent earlier already have a input system

#

the 3rd person one

#

if it does i think id rather try making one from scratch

#

and just use a bean

rocky canyon
marsh vale
#

ill just make one myself i suppose

rocky canyon
#

thats what the StarterAssets.inputactions is

#

both assets have the inputsystem and action mapsincluded

jolly mist
#

is there a way to play an animation based off of a number going from 0 to 1 like in a blend tree?

rotund tiger
#

this first person thing does not work bro

#

i dragged nestedparentunpack into scene and deleted ui joystick thing and added floor but still nothing

night mural
jolly mist
#

that might help. I'll try that and if not make a post in the code general forum thing

rocky canyon
#

use this one ^

#

or open the Demo scene and rob that one..

#

even if it is sorta all off-center

lime sigil
#

i have a editor plugin and in it there's a button using GUILayout.Button
i don't know how to load a texture from it's package folder tho

doesn't seem to work with relative paths Assets is not ProjectName/Assets but ProjectName/Packages/mypackage/Assets

 if (
    GUILayout.Button(
        image: AssetDatabase.LoadAssetAtPath<Texture>(
            "../Assets/Discord-Symbol-White.png"
        )
    )
)
{
    Application.OpenURL("https://discord.com/invite/********");
}

why would the image not load without error?

rocky canyon
#

Packages/mypackage/Assets/Discord-Symbol-White.png

lime sigil
#

that's what's making it relative or at least it's what i would think so coming from python, the thing is i tried that as well

for the second option i don't think i can use that as it could easlily break if the user adds it to the assets instead of the packages

rocky canyon
#

the reason why u dont get error is b/c it just returns null.

lime sigil
#

ah oops, i thought the button would throw an error if the texture passed to it was null

rocky canyon
#

just a silent kinda whoopsie 😄

#

i remember from doing my editor windows. and sometimes it'd just not draw a texture at all..

#

would break all my formatting and everything.. but no error.. no whitespace with a little X.. nothing to let u know lol

tacit snow
#

i updated my project to unity 6 and cinemachine 3 and now i have some problems:
StarterAssetsDeployMenu.cs(6,7): error CS0246: The type or namespace name 'Cinemachine' could not be found (are you missing a using directive or an assembly reference?)
how do i fix that? thanks!

slender nymph
#

regenerate project files

#

also you can get rid of the line directly above that one if you also remove the first line. you aren't using anything from the System namespace anyway and removing that line will make the using alias for the Object type redundant

tacit snow
slender nymph
#

in the external tools options in Preferences

#

in unity

tacit snow
#

let me check

tacit snow
#

wich one i select?

slender nymph
#

the Regenerate project files button

tacit snow
#

i press it and nothing happens

slender nymph
#

nothing visible happens. restart your code editor and that error should be gone. you'll still need to fix any other errors

tacit snow
#

still not working

#

what should i do @slender nymph ¿

slender nymph
#

ah, so this isn't even in your own code. this is in an asset. the asset likely uses an asmdef and would probably need the reference to cinemachine's assembly

tacit snow
slender nymph
#

the asset likely uses an asmdef and would probably need the reference to cinemachine's assembly

tacit snow
#

idk how to do that

slender nymph
tacit snow
#

okay i will se

#

thanks

slender nymph
sick arrow
#

hello

rich ice
#

howdy.
Not a 'Social Chatroom', so, "hi" and "hello" generally go unanswered.
If you have a Unity question, feel free to !ask

eternal falconBOT
heavy magnet
#

it doesnt work

rich adder
#

whats happening now ? this looks a little sketch

nova kite
#

Anyone knows why when i press play the gun aims at the camera instead of staying to the right, been stuck on this for hours

#

it should follow the mouse while rotating on the z axis which it does but it rotates it 90 degrees on the y axis and snaps it towards the camera

wintry quarry
#

In the first screenshot you have it rotated -90 degrees on the Y axis.

Your code then sets the y rotation to 0, pointing it at the camera

#

Rather than explicitly setting an Euler rotation like that, why not just do like cs transform.rotation = Quaternion.LookRotation(direction);

nova kite
#

i tried changing this line to this:
transform.localRotation = Quaternion.Euler(0f, -90f, angle + 90f + rotationOffset);

wintry quarry
#

Euler angles are cancer, just throw them out imo

timber tide
#

Say no to eulers

spring viper
#

hi

#

im new

short condor
#

Does anyone know programming, it's for this game called mindshow it's abandoned but it would be cool if YOU could make a whole new server, because the servers shut down

short condor
#

A new server for mindshow

spring viper
#

lemi search for ut game

#

is it popular

#

failing

#

or sm?

short condor
#

It used to be popular but now it's shut down

nova kite
polar acorn
#

And if you want to make a custom server, you can always pick up some books and do it yourself

nova kite
#

3 damn hours im never using Euler's again😭

short condor
#

It's on steam

#

But you won't see it

spring viper
short condor
#

K tell me when you get it

spring viper
#

this?

short condor
#

Yes

spring viper
#

WELL THAT LOOKES COOL

timber tide
spring viper
short condor
#

Could you try to get and then make a new server

#

It could maybe bring the game back

mild lake
#

i want to paint a map in a top down unity game, for instance, a grass path with a dirt road going through it. what's a good way to do this? i don't like how angular the tile map is

spring viper
rich ice
timber tide
#

paint it in some 3D program like blender

mild lake
timber tide
#

Actually any painting software cause the uvs arent hard to map anyway

mild lake
#

i specialize in 3d first so it wouldn't be hard, but i don't think the method would work

timber tide
#

well, if you're painting something big then you do a splatmap which is basically a small precision texture that maps your real texture when generating the mesh

polar acorn
rough granite
obtuse knoll
#

notlikethis have you guys created pseudo code for what you want to happen in a game?

teal viper
#

Sometimes.
I sometimes start with a mix of pseudo code and natural language explanations of the implementation in comments.

nova kite
#

if i need to pass a reference to a component to a prefab that gets instantiated how would i do that?

#

i need a reference to the player's transform

#

and it wont let me assign it in the inspector since it's a prefab

rich adder
#

the spawner usually is already in the scene , should already have the reference to the scene component you want

nova kite
#

what is DI?😅

rich adder
#
[serializefield] SomeComponent someComp;
void Spawn(){
var obj = Instantiate(prefab)
obj.SetSomeComponent(someComp)```
rich adder
nova kite
#

oh no it's a gun that instantiate a bullet on mouse down, and when it hits something i want the player to teleport to that location

#

but i need the player's transform so i can change it to the colission location

#

but the bullet is a prefab

rich adder
#

make the bullet reference the player so when it hits you can teleport it from bullet or subscribe to that event from player to bullet so bullet doesnt care about player

nova kite
#

ooo ill try that thank you

rich ice
nova kite
#

it worked! i got player = GameObject.Find("Player").transform; on start

sour fulcrum
#

nope

#

pretty much do not use Find ever

#

if you need help with what nav was explaining feel free to ask

nova kite
#

oh wait is that not what he meant by making a reference to the player?

sour fulcrum
#

it was not no

nova kite
#

then i need more context😅

rich adder
sour fulcrum
#

Your correct in that is a way to get a reference but Find is really bad since it looks through every single gameobject loaded looking for a matching name which is awful for performance, doing stuff via strings/names is also unideal since it's easy to mess up

Ideally you would have your player referenced somewhere via a [SerializeField] public inspector reference, either directly on the Spawner or on something the spawner can access

nova kite
#

the gun, these are all the references it has

nova kite
rich adder
nova kite
#

it's a child of it in the hierarchy

rich adder
#

alr so just make a field for it

#

then on spawn bullet you pass the player

nova kite
#

hmm but all the teleport logic is on a seperate script🥲 like i made a script for the gun a script for the red bullet and a script for the blue bullet, the gun only spawns them while all the bullet logic is in their respective script

#

i have it set up so it calls a teleport function onDestroy

#

so when the blue bullet gets destroyed it will teleport the player

#

unless you are able to use scripts in other scripts maybe

#

ill have to watch a video on that

sour fulcrum
#

give me a sec im writing up a nice response for you 😄

#

In general with these kinds of problems t's more-so thinking about the chain of command here, I like to reference how a business or even like a supermarket/costco type place might operate

The Bullet's job is to teleport the Player when it hits something.
In order for the Bullet to do it's job, it needs to speak to the Player
The Bullet is managed (I say managed as in like a supermarket like job) by the Gun that shot it
The Gun's job is to shoot Bullet's when the Player asks it to shoot
The Gun is managed by the Player that's wielding it

There-for if the Bullet needs to talk to the Player, It should ask the Gun so it goes up the chain of command.

In practice I would suggest the Gun's having a reference to the Player wielding them, and the Bullet's having a reference to the Gun shooting them. This can partially be done via just [SerializeField] references but you can also set up your code to communicate this like

#

(Now I'll preface this code isn't perfect and some people will probably suggest doing slightly different things once your comfortable with it but for now it's fine)

Here's a quick example of what you could do

public class ExamplePlayer : MonoBehaviour
{
    public ExampleGun CurrentGun;

    public void EquipGun(ExampleGun newlySelectedGun)
    {
        CurrentGun = newlySelectedGun;
        CurrentGun.OnEquipped(this);
    }
}
public class ExampleGun : MonoBehaviour
{
    public ExamplePlayer Player;

    public ExampleBullet BulletPrefab;

    public void OnEquipped(ExamplePlayer owner)
    {
        Player = owner;
    }

    public void ShootBullet()
    {
        ExampleBullet bullet = Instantiate(BulletPrefab);
        bullet.SetOwner(this);
    }
}
public class ExampleBullet : MonoBehaviour
{
    public ExampleGun Gun;

    public void SetOwner(ExampleGun gun)
    {
        Gun = gun;
    }

    public void OnHitWallDoTheTelportThing()
    {
        Gun.Player.etc
    }
}
#

@nova kite let me know if you need anything elaborated

nova kite
#

wowww that's so cool! and thank you for putting it in perspective with that analogy that makes it so much clearer, so bascially you make a function that set's the data you need and call that function from the "manager" passing it the data that's so clever

sour fulcrum
#

More or less yeah, it's very unspecific to this example so you can apply the idea of kinda going up and down the chain to a majority of code/systems 😄

nova kite
#

that's sick thank you so much i will try it now

nova kite
#

it works🥹

#

thank you!

little olive
#

heyo, decided to transfer from unity version control to github, and im not very familiar with the process. i downloaded github desktop, and made a repository. then i cut all my project files to the repository folder, and when i try to commit i get this. Any tips on how to move forward ? is the recommended git lfs the way to go ? am i doing something wrong ? any tips would be appreciated : )

slender nymph
#
  1. Make sure you're using the unity .gitignore
  2. Set up git lfs
little olive
#

yep, i did use unity gitignore. so i am guessing it is the way to go with git lfs

#

thanks : )

nova kite
#

Vector3.Dot breaks my brain i should've listened in math lessons😭

naive pawn
#

it's just the sum of component wise multiplication

#

it can represent how much the vectors align

nova kite
#

i'm trying to pass it the normal from a collision point and compare it to a vector3.up from example to see which direction i should offset the player after a teleport to prevent clipping with solids

nova kite
#

i wish there was a visual representation of it haha

#

ohhh i found the formula it's actually pretty straight forward
Vector3.Dot(A, B) = (A.x * B.x) + (A.y * B.y) + (A.z * B.z)

eternal needle
nova kite
#

omg there is! xd thank you!

naive pawn
naive pawn
#

the other representation is a.b = ||a|| ||b|| cosθ

fierce shuttle
little olive
fierce shuttle
#

Git does take time to learn, and a lot of trial and error for sure, im sure youll get used to it and maybe even enjoy using it in the future, the nice thing is you can learn its features "as you need it" instead of trying to understand everything all at once

timber tide
#

even with git lfs I believe you still need to follow the 100 mb file rule

#

also don't push like 10gbs at once, chop it up

little olive
little olive
#

ill update my revelations

timber tide
#

There is some limitation I know for sure cause if I do try to cram everything in a single commit it'll drop it

frigid sequoia
#

This has kept happening btw, not really sure if I should worry about it, but doesn't seem to prevent anything from working anyways, so dunno

timber tide
#

How are you removing the element? In an editor script or something like OnValidate?

naive pawn
frigid sequoia
#

Like on a method that sorts the inventory and what is being equipped

timber tide
#

There's one other scenario I can think of and is editing the prefab instance at the runtime, which shouldnt affect the editor instance but potentially can throw some fake warnings like that

little olive
frigid sequoia
#

Like this is the kind of list I am modifying, but I don't think I am doing anything weird like that tbh

timber tide
#

And you're sure you're instantiating the prefab and not editing the prefab instance you referenced?

frigid sequoia
#

I am not using any prefab on this logic, yet

#

This is meant to run on InventoryItems as prefab, but as of now, I am only testing it with on scene items

#

So.... I don't know how I could even be doing that

timber tide
#

If it's already on the scene then it would be a unique instance so that wouldn't be a problem

#

so I'm going to go with Unity is just being Unity and reset the editor.

frigid sequoia
#

Yeah, like this was happening last night too, so, that why I am asking again

#

I surely must be doing something weird

eternal needle
frigid sequoia
#

Mmmm, I mean, the specific case is kinda complex tbh, I'll have a hard time replicating it

#

Like it's like referencing a item inside a different item and kinda adding and removing itmes from a bunch of list simultanenously, so....

#

Could it have anything to do with deactivating the gameObject?

eternal needle
frigid sequoia
eternal needle
#

then add more to your minimal test case until you can replicate the bug

#

it could be a unity bug related to how you're using the lists. it could be due to the gameObject being inactive. The way you remove uncertainty here is by testing. You dont just stare at the code to fix things
If you feel you cant fix it and theres nothing strange you're doing, then submit a bug report

frigid sequoia
#

Mmmm, yeah, I have a hard time even replicating it now, like it happens SOMETIMES

#

Like for no apparent reason

#

I'll keep note of when exactly happens when it shows

eternal needle
#

even for a bug report you typically wouldnt want to wait for them to fix it though. if you're on a old unity version too then maybe it was already fixed in a later version

#

I do see some similar posts online related to your error but most just link to a unity bug tracker at the end, fixing stuff in the 2021/2022 version

frigid sequoia
#

I think I am on the 22 currently actually

#

So it should be fixed if that's like the same thing

nova kite
#

dk how i passed calc 2

frigid sequoia
#

Ok, so how tf, is passing me variable not assigned on the console when I can call it's name on awake, I know it's there and I am checking the freaking inspector and it is indeeda assigned???

sour fulcrum
#

without code and/or pics no one can help

frigid sequoia
sour fulcrum
#

is that the inspector of the one throwing

frigid sequoia
#

I was checking if it I was just coincidentally using one that was not assigned

#

But it happens on everyone even tho they are all assigned

sour fulcrum
#

when is this code running

twilit glen
#

Can someone help me?
so my unity wont download versions and I don't know why and it happens with every version.

frigid sequoia
sour fulcrum
#

debug pause when the selectedicon is null and look in the inspector

twilit glen
frigid sequoia
#

Oh, ah, wait, I think it's cause I tried to change what method was called with the button with the multiselect, and it's trying to call a method from a different one

#

Mmmm, letting apart that setting it manually is kinda annoying, that still should work I think

twilit glen
sour fulcrum
#

christ

#

its been 2 minutes

twilit glen
#

fine

frigid sequoia
#

Yeah, it keeps returning it null, although it is assigned on the time it's being called

#

Ok, so this is what I am calling with the button. That print does show without miss ref

#

At this point it calls it a missing ref

frigid sequoia
#

This does nothing at all with that parameter, and checked that it is still showing on the inspector, even after the call

frigid sequoia
ivory bobcat
#

So selected icon was null?

frigid sequoia
#

It was null there, but on the print that looks for its parent seems to be alright

sour fulcrum
#

does the SETSELECTEDSLOT change anythhing?

frigid sequoia
#

It's a gameObject btw, not sure if that's relevant

frigid sequoia
ivory bobcat
#

The print whatever likely isn't related to this referenced variable that's throwing null. You need to figure out when you're assigning the variable and how it isn't being assigned a valid reference

frigid sequoia
#

But not change the reference at all

sour fulcrum
#

it shouldn't but does it

#

log before and after

frigid sequoia
frigid sequoia
frigid sequoia
eternal needle
#

am i seeing this wrong ? it seems like for NRE in the print you are using the transform parent while the rest of the code seems to not use it.

#

The parent might be null

ivory bobcat
#

You need to comply with the error and figure out when/where you're removing/destroying it.

frigid sequoia
frigid sequoia
ivory bobcat
#

When your inspector doesn't match the error, it likely is referring to different instances (or race conditions).

frigid sequoia
#

Mmmm, makes sense, but there is no other instance that could be created that I know of

sour fulcrum
frigid sequoia
#

Can I get like the id of the object to be 100% sure?

eternal needle
#

Debug.Log(..., this);

ivory bobcat
#

Before the error line.. log this: cs Debug.Log($"Click this message prior to the error message to highlight the object yellow.", this);

frigid sequoia
#

Is that a thing?

#

That's very usefull

ivory bobcat
#

Basic debugging 101.

frigid sequoia
#

I was just seding prints with the names lol

ivory bobcat
#

Which object is highlighted yellow?

#

Check the inspector for that object and figure out why the field was null when the line had executed.

frigid sequoia
#

OOOOH, I see, it was actually happening on the second loop where it just dissables all other icons throught an event

#

There was an old version of the script I missed to delete lost between objects

sour fulcrum
#

remember

making mistakes: natural
making assumptions: sinful

😄

frigid sequoia
#

Ok, that thing of the Debug is very usefull, thxs

nova kite
#

i forgot about the physics materials and spent 7 hours creating a whole bounce method oh my god💀

#

i learned a lot at least😭 trying to debug why it slides up the wall when i shoot it at a 90 degrees angle i saw on google someone mentioning the bounce material and i felt so dumb hahahah

heavy magnet
#

hii can someone help me? i dont know how to make my character "rotate"

#

[RequireComponent(typeof(Rigidbody))]
public class PlayerMovement : MonoBehaviour
{
    public float walkSpeed = 3f;
    public float runSpeed = 6f;
    public float blendSpeed = 5f; // for smooth interpolation

    Rigidbody rb;
    Animator anim;

    Vector3 input;
    float targetSpeed = 0f;
    float currentSpeed = 0f;

    void Awake()
    {
        rb = GetComponent<Rigidbody>();
        anim = GetComponent<Animator>();
    }

    void Update()
    {
        input = new Vector3(Input.GetAxisRaw("Horizontal"), 0, Input.GetAxisRaw("Vertical")).normalized;

        // Determine target speed
        if (input.magnitude > 0f)
            targetSpeed = Input.GetKey(KeyCode.LeftShift) ? runSpeed : walkSpeed;
        else
            targetSpeed = 0f;

        // Smooth blend between speeds
        currentSpeed = Mathf.Lerp(currentSpeed, targetSpeed, blendSpeed * Time.deltaTime);

        // Update Animator parameter
        float speedNorm = currentSpeed / runSpeed; // normalized 0 to 1
        anim.SetFloat("Speed", speedNorm);
    }

    void FixedUpdate()
    {
        Vector3 movement = input * currentSpeed;
        rb.MovePosition(rb.position + movement * Time.fixedDeltaTime);
    }
}```
eager spindle
heavy magnet
ivory bobcat
ivory bobcat
heavy magnet
ivory bobcat
eager spindle
#

A third person controller requires a good amount of setting up that it makes it hard to teach it to you over discord. you should look at a tutorial for making a third person controller.

heavy magnet
ivory bobcat
heavy magnet
#

wait

ivory bobcat
heavy magnet
#

it gives me differents error for every scripts

ivory bobcat
#

You'd fix the first error in the console window from top to bottom if possible

ivory bobcat
#

member names cannot be the same as their enclosing type

heavy magnet
ivory bobcat
#

Meaning the name of a member in the class cannot be the same as the name of the class.

heavy magnet
#

okayy

#

using UnityEngine;

[RequireComponent(typeof(Rigidbody))]
public class PlayerMovement : MonoBehaviour
{
public float walkSpeed = 3f;
public float runSpeed = 6f;
public float blendSpeed = 5f; // for smooth interpolation

Rigidbody rb;
Animator anim;

Vector3 input;
float targetSpeed = 0f;
float currentSpeed = 0f;

void Awake()
{
    rb = GetComponent<Rigidbody>();
    anim = GetComponent<Animator>();
}

void Update()
{
    input = new Vector3(Input.GetAxisRaw("Horizontal"), 0, Input.GetAxisRaw("Vertical")).normalized;

    // Determine target speed
    if (input.magnitude > 0f)
        targetSpeed = Input.GetKey(KeyCode.LeftShift) ? runSpeed : walkSpeed;
    else
        targetSpeed = 0f;

    // Smooth blend between speeds
    currentSpeed = Mathf.Lerp(currentSpeed, targetSpeed, blendSpeed * Time.deltaTime);

    // Update Animator parameter
    float speedNorm = currentSpeed / runSpeed; // normalized 0 to 1
    anim.SetFloat("Speed", speedNorm);
}

void FixedUpdate()
{
    Vector3 movement = input * currentSpeed;
    rb.MovePosition(rb.position + movement * Time.fixedDeltaTime);
}

public class PlayerMovement : MonoBehaviour {
public float forceAmount = 10f;
private Rigidbody rb;

void Start() {
    rb = GetComponent<Rigidbody>();
}

void FixedUpdate() {
    float x = Input.GetAxis("Horizontal");
    float z = Input.GetAxis("Vertical");
    Vector3 force = new Vector3(x, 0f, z) * forceAmount;
    rb.AddForce(force);
}

}

}

heavy magnet
ivory bobcat
#

|| Character script. Line 47. Character 18.||

#

How to post !code btw so folks can properly help you ought. I won't be here much longer.

eternal falconBOT
ivory bobcat
#

Anything more than a couple of lines should be posted using the Large Code Blocks instruction rather than the inline with respects to others and the server channel.

heavy magnet
#

so do I delete it?

ivory bobcat
#

Folks will need to see the character script to properly be able to help you.
The player movement script above isn't where the error is present.

heavy magnet
#

i deleted it but theres another error

#

ok im tired my character doesnt need to rotate

nova kite
#

question to everyone on here, where did you learn level design? not the actual sprites but like coming up with the ideas for the level

#

this is the hardest part XD

fickle plume
#

@rough sluice This is a code channel, and don't cross-post, please.

rough sluice
fickle plume
#

You've already posted it

rough sluice
river pulsar
#

Hi
Now I used unreal engine

river pulsar
#

I meant to say goodbye because I was using Unity now I'm using Unreal Engine

hexed terrace
#

it's not an airport, your departure does not need announcing - no one cares

dim minnow
#

You're not forced to use just one tool either. I can use multiple engines as the need arises.

wanton socket
#

Not completeley programming related, but I have a shader that can be used to fade an object out that should be used by every entity (for example, when spawning I want entities to fade in)

It has an albedo texture, metallic texture, etc as inputs to basically act like a normal material
However, setting these in the editor changes all objects that use the material

As far as I know my 2 options are to duplicate the material or to create a script to assign the material properties at runtime
My 2 questions are which option is better, and if it's possible for this script to also run once in the editor so I can see how my entities look without having to enter play mode

Thanks

tacit snow
#

hey, i recently updated my project from unity 2022 to unity 6 and Cinemachine 2 to 3, and my third person asset (from unity asset store) is giving an error. In the documentation of cinemachine, they said that you have to change "using Cinemachine" to "using Unity.Cinemachine". But as you can see, it doesnt work. Do you have any idea to fix that issue? This is the link of the asset : https://assetstore.unity.com/packages/essentials/starter-assets-thirdperson-updates-in-new-charactercontroller-pa-196526 . Thanks!

Get the Starter Assets - ThirdPerson | Updates in new CharacterController package package from Unity Technologies and speed up your game development process. Find this & other Essentials options on the Unity Asset Store.

hexed terrace
tacit snow
#

okay im gonna try it, thanks

tacit snow
# hexed terrace Delete the asset from your PC (c:/users/<user>/appdata/roaming/unity/assetstore-...

Get the Starter Assets: Character Controllers | URP package from Unity Technologies and speed up your game development process. Find this & other Essentials options on the Unity Asset Store.

hexed terrace
#

that's a different asset

tacit snow
#

any idea why this looks like that?

#

with that horizontal line

hexed terrace
#

you'll have an idea why it does that if you put your cursor over it and read the tooltip

tacit snow
#

it says to chane "CinemachineVirtualCamera " to "CinemachineCamera" but idk if that will give an error or someting else

naive pawn
dim minnow
tacit snow
#

i think i will let it just "CinemachineVirtualCamera" instead of change aaaaalllll of the declarations

#

is not giving any error so...

#

😄

wanton socket
dim minnow
wanton socket
#

Probably better to do than use a deprecated definition that may later introduce issues

tacit snow
#

let try it

#

hope it doesnt break all the project xd

hexed terrace
#

you should be using version control ..

teal viper
tacit snow
#

i have a copy safe so chill

wanton socket
iron wing
#

essentially i want to add a developer console to my game and intialize any variables everytime my game runs from any scene.
i thought the method OnRuntimeMethodLoad() would work fine. and it does, for my variables. however, i cant actually instansiate anything in that method since it is static. what should i be doing instead?

wanton socket
#

Would also add some extra customisability to certain materials, but most materials just need standard PBR maps so I'm just curious

teal viper
wanton socket
sour fulcrum
#

short answer not really no

#

that sounds more like you'd want a shader

wanton socket
#

I used shadergraph to make the fade material, which essentially just adds some alpha and changes the alpha clip threshold with accordance to a "_Fade" parameter

teal viper
#

I mean it should work with an editor script

wanton socket
#

Is that the right approach?

teal viper
#

The material property block I mean

sour fulcrum
#

oh you might actually want a material variant here

#

i haven't used em so idk

wanton socket
#

Right let me search how that works

#

Oh yeah this looks perfect, tysm

#

It does essentially say this is the right way to inherit from a base material and alter certain properties

sour fulcrum
#

i do be forgetting they exist lol

rough sluice
#

Can someone tell me that why "Player" object is not moving when holding moving buttons?:

using UnityEngine;

public class PlayerConntrolsFunctioning : MonoBehaviour
{
    public float speed = 5f;
    private bool moveLeft, moveRight, moveUp, moveDown;

    void Update()
    {
        Vector3 movement = Vector3.zero;

        if (moveLeft) movement.x -= 1;
        if (moveRight) movement.x += 1;
        if (moveUp) movement.y += 1;
        if (moveDown) movement.y -= 1;

        transform.Translate(movement.normalized * speed * Time.deltaTime);
    }
    public void OnLeftButtonDown() => moveLeft = true;
    public void OnLeftButtonUp() => moveLeft = false;

    public void OnRightButtonDown() => moveRight = true;
    public void OnRightButtonUp() => moveRight = false;

    public void OnUpButtonDown() => moveUp = true;
    public void OnUpButtonUp() => moveUp = false;

    public void OnDownButtonDown() => moveDown = true;
    public void OnDownButtonUp() => moveDown = false;
}
frail hawk
#

not the best way to handle the movement

#

did you make this or find it somewhere

rough sluice
frail hawk
#

can someone confirm that this is bad practise?

hexed terrace
#

I'd never do it this way

rough sluice
naive pawn
#

the bools are the same thing as having numbered variables

hexed terrace
#

are those even magic methods that work?

naive pawn
#

just use a merged structure, specifically a vector2 in this case

naive pawn
#

oh wait that wouldn't work with the release

#

welp 🤷

hexed terrace
#

That might be partly why it's not working.. nothing is calling those methods? 😄

frail hawk
hexed terrace
#

(and actually say what's wrong)

brave tapir
#

Thanks

drowsy flare
#

How can I check if an object reference is None?

keen dew
#

== null

drowsy flare
#

Hmm that's what I've been trying

#

It appears this is not null, even though it doesn't reference an object

keen dew
#

Either you're doing something wrong or checking the wrong object

drowsy flare
#

Hmm, okay thanks

rough granite
naive pawn
rough granite
naive pawn
#

it's a custom type

#

it is specific to their project or perhaps some asset used in the project

sharp abyss
zealous ridge
#

Could someone here actually teach me how to make something nice or atleast working in unity right now I'm being just fed answer and I don't know what the stuff even means

naive pawn
#

there are plenty of resources online for that

#

along with unity !learn

eternal falconBOT
#

:teacher: Unity Learn ↗

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

naive pawn
#

learning kinda starts with you though
if you don't understand something, start googling or asking, instead of just accepting it blindly

zealous ridge
#

Problem with like tutorials and unity learn is if I need to know more about something it isn't gonna answer me it's only teaching what it has or smth like that

#

And it's very hard for me to learn like that for some reason I just need someone to actually teach me or have someone that I can ask questions while reading let's say Unity learn

runic lance
#

well, if you need to know more about something then you should research it
Unity Learn will provide you the basics to start, it's up to you to continue
you can always ask questions here in the Discord server, having a private tutor is a different thing though

zealous ridge
#

Do Unity 6.1 and Unity 6.0 Have a big difference?

hexed terrace
#

not that much .. also this is a code channel, not a general chat about Unity -> #💻┃unity-talk

zealous ridge
hexed terrace
#

"zero" difference in code between the two

#

You'd be better using the same version as the tutorial you're following. 6.0 is also LTS, which means it is long term support, 6.1 is going to lose support at some point this year when 6.2 comes out

tacit snow
#

Hey guys, im following this tutorial series: https://www.youtube.com/watch?v=lGxXQzE5Vu8&t=463s
and using this asset: https://assetstore.unity.com/packages/essentials/starter-assets-character-controllers-urp-267961
The problem is that the second player (the one in the right) is controlled by gamepad but it takes the camera of the first player (keyboard and mouse) to move. Its quite hard to explain but with this asset, the player moves with the camera, depending where do you look you move in the direction. Im doing exactly the same as the tutorial ones, but it doesnt work correctly, any idea to solve that? thanks!

drowsy flare
polar acorn
drowsy flare
keen acorn
#

Hey guys, I'm just a bit confused about rotation, I have this line on an Update loop, but it seems to be setting the rotation rather than constantly rotating the object
transform.rotation = Quaternion.Euler(0, 0, transform.rotation.z + rotationSpeed);

#

I'll multiply rotationSpeed by Time.deltaTime, don't worry

naive pawn
#

transform.rotation is a Quaternion

red igloo
naive pawn
#

unless you have a degree in math you probably don't want to access quaternion components

#

it seems like you were looking for eulerRotation.z

#

or whatever the name is i forget what exactly

keen dew
tacit snow
keen acorn
#

oh my bad

#

lemme read

tacit snow
#

i send the video

keen acorn
#

Okay so, you have two players. Player1 moves with keyboard and mouse while Player2 moves with the gamepad. The problem is that Player2 is using Player1's camera?

tacit snow
#

yes

#

is using his camera to move

keen acorn
#

Hold on, I'm actually not sure if I understand the problem

brazen cedar
#

does any on know how to do athenication in unity like liogin/ Sign up

keen acorn
#

Could you describe it a bit more detailedly?

tacit snow
#

i mean moves in that direction

keen acorn
#

oh

tacit snow
#

import the asset

#

and try it

#

you will understand what happens

keen acorn
#

oh it actually physically moves when you just move your mouse?

tacit snow
#

yes

#

i mean

#

i can move it withou moving the mouse

#

and the joystick moves the camera

#

but the direction to moves depends in the mouse (camera of player1)

keen acorn
#

oooh

#

Okay so

#

The camera rotation of Player1 influences the direction (though not the camera!) of Player2

tacit snow
#

ye

tacit snow
#

and check when i move the camera of player1( left) the player2 rotates while moving

#

and if i move the camera of player2, it ignores it

keen acorn
#

I think, maybe check the ThirdPersonController script

#

there must be some place where the direction of the player is influenced by the direction of the camera

#

there is probably something wrong with that

tacit snow
#

yes

#

but this is the default script from unity xd

#

and i thinks its the asset they use in the video

#

so there is no sense

#

I FIX IT!!!!!!!!!!

#

not finding the main camera object bc we have 2 main cameras

keen acorn
#

lmao nice

granite dagger
#

Can anyone tell me if i should learn C# in general first or learn it directly with unity? (Code Monkey's channel)

keen acorn
#

Because then, every tutorial feels easier

#

and more understandable

granite dagger
keen acorn
#

I personally would recommend the CS50 course, which is free on EdX and features problem sets for you to solve

keen acorn
#

Actually doing stuff can be very very good at teaching you things, and that's why I love game jams

#

But you can't just join a painting competition to learn how to hold your brush

#

You might learn new styles or new techniques, but if you don't even know how to make a stroke on the canvas, then it might not be for you just yet

#

Does that make sense?

granite dagger
keen acorn
#

Awesome, I'm glad to have helped you

eternal needle
red igloo
red igloo
teal viper
red igloo
keen acorn
#

Well, lazy solution might be to not let the R do anything until the camera is fully switched?

#

I'm not too sure how your project works

teal viper
#

To understand more, add logs or breakpoints.

red igloo
#

I'm going to try this to see if it stops the issue

hexed terrace
red igloo
fringe plover
#

i dont get how does multiplying float by Vector3 works

hexed terrace
#

somewhere that you don't see, it'll probably automatically do x * float, y * float, z * float - which would be tedious to have to type out every time

tacit snow
night raptor
fringe plover
#

oh thank you

night raptor
#

Note that there are two overloads, one for each direction to allow both float * Vector3 and Vector3 * float

tacit snow
#

i upgrated cinemachine 2 to 3 and now gives this error:
Can someone told me what i have to put there? thanks

polar acorn
#

What's the IDE say?

tacit snow
polar acorn
#

Well there you go

tacit snow
#

so i put Cinemachinecamera right?

polar acorn
#

The CinemachineFreeLook component no longer exists. It's part of CinemachineCamera now

tacit snow
#

okay fine thanks

polar acorn
tacit snow
#

idk, im new using CM3 and idk how to change the velocity of the Vertical Axes

#

i know i can change the accel time there but idk how to change the speed

polar acorn
red igloo
polar acorn
red igloo
sharp mirage
#

one more question tho, i installed the cinemachine package and followed a guide

#

all the guides seem to have some virtual camera component where u can drag an object onto the follow section

#

but i think those guides are a bit outdated cuz they had a cinemachine version 2

#

and rn its 3.14

oak idol
#

How do I include logic inside of a UI Document that would be a part of it and belong to that specific instance of UI Document when I place it somewhere even if there are multiple instances of it in the same document. This logic should be able to call events and affect UI Document

wise pulsar
#

Does anyone know why this is happening?

  • I created a ImportPreset (First Image)
  • I set in as the default importer and set the filter (Second Image)
  • I deleted the files I had imported before. And imported the files again.
  • Every file is correctly configured in the inspector, and correctly sliced in the Sprite Editor. But every Slice has the same name as the sprite that was used in the ImportPreset. (Image 3 and 4)
fast fern
#

How do you implement a switch, where it takes input as cases? (quick event related stuff)

#

I be throwing it at Update and its all spaghetti

naive pawn
#

gonna need some more context, what are you trying to achieve with the switch/case?

drowsy flare
#

Is there a line of code to pause the game for debugging purposes? Similar to clicking the pause button in the unity editor?

naive pawn
#

no, that's not very similar

naive pawn
drowsy flare
#

Yeah timeScale was correct, but it works awesome, thanks @rough granite

rough granite
#

Fair i guess it only stops a few stuff huh

naive pawn
#

timeScale does not prevent updating. it just factors into deltaTimeand fixedDeltaTime every frame/tick

#

you are still updating every frame (which isn't great if you want to actually freeze stuff to check values)

#

if you want to actually pause, that's an editor/debug thing

#

also of course,timeScale does not affect unscaledDeltaTime/unscaledTime

#

and it messes with whatever other stuff you might be using timeScale for

drowsy flare
drowsy flare
naive pawn
#

i assume it acts like a breakpoint rather than pausing, but a much closer effect than setting time scale

#

(though i haven't used breakpoints, maybe they just work via pausing lol)

wooden hill
#

Can't you debug and put breakpoints in your ide?

drowsy flare
#

I need to debug variables set at an exact time, so Debug.Break(); works exactly like I need it to

naive pawn
#

breakpoints would also work for the same purpose

drowsy flare
fast fern
naive pawn
#

what are you trying to achieve in general?

fast fern
#

I'm trying to make a "input the correct arrow key"

#

basically go through a few rounds of input left or right arrow, and score tells you how well you did

#

(yes switch cases isn't my only problem lol)

tired nebula
#

Hur går man in i servern

naive pawn
#

this is an english-only server

naive pawn
fast fern
#

ooooof

naive pawn
#

think about the logic flow

fast fern
#

what's the best approach for this?

naive pawn
#

there's no best

#

might be something like this (spoilered in case you want to figure it out first)
||quicktimeevent(correct, time): while (elapsedTime < time) if input correct [correct answer] else if input other [incorrect answer] [timeout](where the [correct answer]/[incorrect answer] might return, so they wouldn't hit the timeout branch, or you could have extra logic to make sure timeout doesn't happen after one of the others as it breaks)||

crystal rain
#

Can someone help me learn to use unity and visual studio code

frail hawk
#

we can help you with your questions

crystal rain
#

Ok

#

I just got the app and don’t know how to use it

naive pawn
#

!learn

eternal falconBOT
#

:teacher: Unity Learn ↗

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

drowsy flare
fast fern
trail rapids
#

can anyone help?, im trying to make a cloud system using a particle system

#

for a cloud sprite i have

#

but i have no idea how to make the cloud sprite the particles

#

so i can move it across the screen

frail hawk
#

how is that a coding question?

trail rapids
#

oh yeah mb

#

is ther anoyjer channel for help ?

crystal rain
#

Is there a code system built into unity

polar acorn
#

And, actually, also define "Code system"

crystal rain
#

Do you have to install something completely different to put code into the game or can you code the game in unity

strong wren
crystal rain
#

Oh

#

Alright

cerulean bear
#

I'm trying to read from arduino serial port any idea why this isnt working

using UnityEngine;
using System.IO.Ports;
using System.Collections;

public class SerialLatestLine : MonoBehaviour
{
    SerialPort serialPort;
    public string portName = "COM4";
    public int baudRate = 19200;
    string receivedString;

    void Start()
    {
        serialPort = new SerialPort(portName, baudRate);
        serialPort.Open();
        //serialPort.ReadTimeout = 50;
    }

    void Update()
    {
        receivedString = serialPort.ReadLine();
        Debug.Log("Received: " + receivedString);
    }

    /*void OnApplicationQuit()
    {
        if (serialPort != null && serialPort.IsOpen)
        {
            serialPort.Close();
        }
    }*/
}

arduino script if anyone's intersted:

#include <Arduino.h>

const int trigPin = 9;
const int echoPin = 10;
const int buttonPin = 2;

void setup() {
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
  pinMode(buttonPin, INPUT_PULLUP);
  Serial.begin(19200);
  }

void loop() {
  if (digitalRead(buttonPin) == LOW) {
    long duration, distance;

    // Send trigger pulse
    digitalWrite(trigPin, LOW);
    delayMicroseconds(2);
    digitalWrite(trigPin, HIGH);
    delayMicroseconds(10);
    digitalWrite(trigPin, LOW);

    // Read echo
    duration = pulseIn(echoPin, HIGH);
    distance = duration * 0.034 / 2;

    // Send to PC
    Serial.println(distance);

    delay(200);
  }
}
daring heath
#

how would i add text to an existing TMPro object? for example, i want it to keep the text that's already there and just add an exclamation mark

polar acorn
daring heath
coral crater
#

I'm really scratching my head here. I know I'm not providing a lot of context here and I apologise, but I'll figure it out on my own if it's not obvious to anyone else. but can anyone see why this wouldn't ever execute past "yield return new WaitForSeconds(1);". everything up until that is executing, and then it stops at the yield check, and never resumes. nothing is externally deleting the object this script is on or anything like that either

    {
        int previewBoxesActive = peoplePage.transform.childCount;

        for (int i = 0; i < previewBoxesActive; i++)
        {
            Destroy(peoplePage.transform.GetChild(i).gameObject);
        }

        journalManager.tabAnimationPlaying = true;

        yield return new WaitForSeconds(1); 

        Debug.Log("peoplemanager finished");
        Destroy(gameObject);
    }```
polar acorn
daring heath
daring heath
#

it's code i can't explicitly test rn

#

is there a way to check if a tmpro text already contains a specific character?

polar acorn
#

.Contains

coral crater
crystal rain
#

What does any of this mean

daring heath
crystal rain
#

I don’t understand it

polar acorn
#

(If the script already has an OnDisable function, instead add that log to it instead of making a new one)

coral crater
polar acorn
coral crater
slender nymph
#

Single click not double

polar acorn
coral crater
#

ah right, didn't realise adding 'this' would do that. it doesn't highlight it, no

polar acorn
#

Which would be the reason the yield isn't working

slender nymph
#

Where is the coroutine actually being started from?

coral crater
coral crater
#

well, suspend it

slender nymph
#

Yes, whatever MonoBehaviour you call StartCoroutine on will be the one it's lifetime is attached to

rocky canyon
coral crater
rocky canyon
#

yup, monobehaviour is required to run the routine...
its the one that calls it as box mentioned

coral crater
#

the object that starts it is being killed right here

polar acorn
coral crater
#

thank you all very much for the help and learning moment @slender nymph @polar acorn @rocky canyon

coral crater
rocky canyon
#

👍 i just noticed ur doing embedded work..
PlatformIO in VSCode is the IDE i use for that.. (easier for me to toggle back and forth from each type of project)

#

just my personal opinion tho

coral crater
#

I'll check it out, thanks!

#

teeheemmm all working

rich adder
#

you might also need to set read/write timeout

cerulean bear
rich adder
#

where you create a new SerialPort object

cerulean bear
#

any idea how to implement that?

rich adder
cerulean bear
rich adder
cerulean bear
# rich adder you might also need to set read/write timeout

here is my new code and I'm continuosly getting an operator timeout error

using UnityEngine;
using System.IO.Ports;
using System.Collections;

public class SerialLatestLine : MonoBehaviour
{
    SerialPort serialPort;
    public string portName = "COM4";
    public int baudRate = 9600;
    string receivedString;

    void Start()
    {
        serialPort = new SerialPort(portName, baudRate);
        serialPort.DtrEnable = true;
        serialPort.RtsEnable = true;
        serialPort.Open();
        serialPort.ReadTimeout = 500;
        serialPort.WriteTimeout = 500;
    }

    void Update()
    {
        receivedString = serialPort.ReadLine();
        Debug.Log("Received: " + receivedString);
    }

    /*void OnApplicationQuit()
    {
        if (serialPort != null && serialPort.IsOpen)
        {
            serialPort.Close();
        }
    }*/
}

error:

TimeoutException: The operation has timed out.
System.IO.Ports.WinSerialStream.Read (System.Byte[] buffer, System.Int32 offset, System.Int32 count) (at <ccc5c248f714451b8d635b2be267cc2e>:0)
System.IO.Ports.SerialPort.read_byte () (at <ccc5c248f714451b8d635b2be267cc2e>:0)
System.IO.Ports.SerialPort.ReadTo (System.String value) (at <ccc5c248f714451b8d635b2be267cc2e>:0)
System.IO.Ports.SerialPort.ReadLine () (at <ccc5c248f714451b8d635b2be267cc2e>:0)
(wrapper remoting-invoke-with-check) System.IO.Ports.SerialPort.ReadLine()
SerialLatestLine.Update () (at Assets/Scripts/SerialLatestLine.cs:24)
crystal rain
#

I see your useing C#

#

I think

cerulean bear
#

oh nvm that was on me for not starting the serial logger thx for your time @rich adder

cerulean bear
rich adder
crystal rain
cerulean bear
cerulean bear
rich adder
crystal rain
#

I just need help getting started

cerulean bear
cerulean bear
#

are you fully new

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
#

check the pins as well

cerulean bear
#

I recommend the junior programmer pathway

rich adder
#

this isn't a server for tutoring

crystal rain
rich adder
#

thats what learning is for

cerulean bear
crystal rain
#

I am not at my computer

#

And I need to be on it to start the corse

rich adder
#

okay so what do you want. Do it when you get to a computer

crystal rain
#

You didn’t have to be mean

#

🥲

#

😂

rich adder
#

and you don't have to be obnoxiously spamming the channel 🙂

crystal rain
#

I am not, I just need a little help

rich adder
queen adder
#

Hey so um I'm kinda losing my mind atm over this...
When I load into a scene it for some reason is in the state that it was when I switched off it
Is there a way to reset it?

So
Scene 1 > Scene 2 > Scene 1 again but it is as it was left off before switching to scene 2

polar acorn
crystal rain
#

Also this channel is called code beginner

polar acorn
#

So, learn it when you are

rich adder
queen adder
#

I tried unloading it with UnloadSceneAsync

#

But it doesn't do anything

#
        SceneManager.UnloadSceneAsync("SampleScene");
        SceneManager.LoadScene("MainMenu", LoadSceneMode.Single);```
rich adder
#

wdym "is in the state that it was when I switched off it"

polar acorn
queen adder
#

it doesnt revert to its original state

rich adder
#

are you loading them through code or just double clicking

queen adder
#

code

polar acorn
#

Can you take a screenshot of your Unity editor after loading the scene for the second time? Whole window, and with the console visible

queen adder
#

why?

polar acorn
#

So I can check a whole bunch of stuff at once

queen adder
#

it doesnt show anything about it thats the thing

polar acorn
#

Faster than asking for a screenshot of the console and the hierarchy and the inspector and all of the things individually

#

Showing nothing of interest also means that it eliminates possibilities as well

#

A null result is still a result

queen adder
polar acorn
#

This isn't what I asked for

queen adder
#

the console is just flooded with errors

rough granite
queen adder
#

its all just irrelevant errors

polar acorn
#

This still isn't what I asked for

#

Although it is part of it I guess

rough granite
queen adder
#

I cant show the editor

polar acorn
#

why

rich adder
queen adder
#

for some reason all the gameobjects in my game manager get deleted

#

when i open the scene for a second time

rich adder
#

you realize we don't know your exact setup this is why ALL context is relevant ?

#

not mind readers..

rough granite
#

you are giving the bare minimum for help (minna)

queen adder
#

I just need to know how to properly unload a scene/load a brand new scene

#

Google hasnt helped

wintry quarry
#

What did Google say?

rich adder
#

unloading a scene is only relevant if they are being loaded Additive

queen adder
#

pretty much what nav just said

rich adder
#

when you do LoadScene they automatically unload previous scene

queen adder
#

thats the thing, it doesnt

rough granite
#

this would do just that scenes shouldn't save unless you got all of it in DontDestroyOnLoad

polar acorn
#

So, show the whole window after loading the scene

queen adder
#

and i dont understand why

polar acorn
#

So we can check

wintry quarry
polar acorn
#

I don't know what is or is not relevant. Even if I find nothing, that eliminates possibilities and therefore makes debugging easier

#

so send a screenshot

queen adder
rich adder
#

the only scenes that don't get unloaded by design is DontDestoyOnLoad and anything in it

wintry quarry
queen adder
#

just spheres

#

glowing spheres

wintry quarry
#

With... Scripts?

queen adder
#

ill check if they are somehow instanciated in donotdestroyonload

worn nymph
#

does the read/write flag in import settings cause any overhead if I call UploadMeshData after making changes? Like does just having the option of mesh data on the cpu cause overhead?

queen adder
rough granite
#

why are you so secretive

polar acorn
#

Or.... you could provide the screenshot which would show if anything's in DDOL

rough granite
#

we aren't here to steal your game

polar acorn
bright zodiac
# fringe plover i dont get how does multiplying float by Vector3 works

Most structs used for math in unity are partial structs. In this case, make another partial struct called Vector3 in a separate file (in the same asm) then add this in it ofcourse you need to adjust it, the float here just an example

public static Vector3 operator *(float a, Vector3 b) => new Vector3(a * b.x, a * b.y, a * b.z);
queen adder
#

okay yeah their parent is in donotdestroyonload

#

for some reason

#

oh its a static instance

polar acorn
worn nymph
polar acorn
rich adder
polar acorn
queen adder
#

ill check if someone else has since its a collab project

rich adder
#

its easy to find.. search all scripts that have method DontDestoyOnLoad

queen adder
#

okay yeah i give up

#

this is after i load back into the scene

#

Gameobjects are missing for no reason

polar acorn
queen adder
rough granite
queen adder
polar acorn
queen adder
rough granite
# queen adder yes

well than that's why you need to re-reference any variables like the player if that script is moved from one scene to another and that other object isn't

queen adder
#

yeah but i dont want it to be in dontdestroyonload

#

and i dont understand why it is

rough granite
#

can you share every component that the GameRoot has and the scripts for them (if they aren't a unity component)?

queen adder
#

the only components with scripts in it are just cameras that have this by default

#

ambianceplayer is just an audiosource

polar acorn
# queen adder

Are you using any scripts that are sub-classes of something other than MonoBehaviour? Those parent classes might call DDOL and it wouldn't actually be in your code base

queen adder
#

nope just monobehavior

rough granite
#

is the GameRoot there before runtime or is it called on runtime?

queen adder
#

its just in the scene

#

a gameobject with the script in it

rich adder
# queen adder

did you search entire solution / project btw instead of 1 file

#

oh dam discord just updated lol there is more..

rough granite
# queen adder

If you change the search to be the whole solution instead of just the active document does this change?

rough granite
queen adder
#

oh

#

i did find something

rich adder
#

that certainly is a DDOL

queen adder
#

yep

#

i love collab projects!!! so fun!!!

#

esp when the other person uses chatgpt for all their code

#

thank you

#

ive been trying to fix this for so many hours

#

wasnt really supposed to share anything because weird uni regulations but

#

whatever

rough granite
#

ah makes more sense just gotta hope your uni doesn't stalk these servers

queen adder
#

They probably don't

#

Hopefully

#

ty again tho

inland gazelle
#

Hi! I hope this is the right place to ask for help

#

im trying to build a very simpel shooter game as a final project and navmeshes dont want to cooperate

rich adder
inland gazelle
#

I thought since theres coding involved it would be ok

#

keep getting this error, even though I though i set everything correcetly

rich adder
#

seems your agent isn't on a navmesh

inland gazelle
#

the block in question has a navmesh agent component, and i see the blue nav mesh

#

and the block is intersecting the blue navmesh

rich adder
inland gazelle
#

(if there is a better channel, please let me know

rough granite
inland gazelle
#

I have the agent size here (its a 'titan', so large)

#

this here is the actual scene

polar acorn
#

Are you sure you're calling SetDestination on the object in the scene, and not a prefab?

rich adder
inland gazelle
#

(playerpos is specficically the position of the player's rigidbody)

inland gazelle
rich adder
inland gazelle
#

(apologizes for the rampant restore ups)

valid hearth
#

how do yall learn script cuz the youtube tutorials do not help

inland gazelle
rich adder
rough granite
rich adder
wooden hill
eternal falconBOT
#

:teacher: Unity Learn ↗

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

inland gazelle
rich adder
inland gazelle
#

i see, well i removed it and it does not snap by any means

rich adder
#

ones trying to use physics while the other is snappin onto a plane

rich adder
#

yeah they are two components fighting for moving the transform, not a good result comes out of it (unless you're frozen constraints / kinematic)

rough granite
rich adder
#

you're mixing 2D rb with a 3d navmesh ?

rough granite
#

yup through an asset i found awhile back on github

inland gazelle
#

oh this is new; i tried baking again and now it treats the guy as terrain?

rich adder
inland gazelle
#

h-how do i do that?

rich adder
inland gazelle
#

im assuming im going into areas and making a new thing here?

rich adder
rough granite
rich adder
#

I mean its bruteforcing it lol cause if its not locked its still sketch

inland gazelle
rich adder
inland gazelle
#

i see this stuff

rough granite
rich adder
rough granite
#

change that to not have the enemy layer, no?

inland gazelle
#

haha yeah, sorry. my prof said auto -10% if we dont use his version

inland gazelle
rich adder
#

hmm you should still download the AI package so you can get the proper components and get rid of the global bake

rough granite
#

do you not have a navigation surface? never used version 2022

inland gazelle
#

I went window ai navigation

#

then just went over and hit bake

#

when it opened up a tab next to the inspector

rich adder
#

thats the old global bake they retired

rough granite
#

odd way to do it, i would do what nav said

rich adder
#

its under Object in that case / the dropdown in the navigation static of the gameobject

inland gazelle
#

ahh yes i see it

#

so I do need to add another layer under Areas?

#

but then what number do I put? I dont get that whole system the tutorial made it sound easy....

rich adder
#

I say you should just get the AI package instead of using the old bake
and use navigation surface component

inland gazelle
#

(btw, if it helps, i can vc anywhere

rich adder
#

add package by namecom.unity.ai.navigation unless it shows up in PM already

inland gazelle
#

cause regardless of the bake it still doesnt believe that tgeres ab active agent on the nav mesh

#

which there is so i dont get that

inland gazelle
#

ok, new question (easier i hope)

#

i made this titan into a prefab, and I want it to always track the player, but i cant drop the player into the variable when its a prefab

#

it says Player None but I cant drop the player in the scene in there

rich adder
#

if you have an object that spawns the prefab in the scene you can have that hold the reference to the player then pass the reference that way through a method

#

or its acceptable to do it with FindFirstObjectOfType and find player component in awake, though not as clean as above suggestion

inland gazelle
#

but if im just dragging them into the scene myself, then i just assign the player to all of them individually?

#

yeah ok ill just do it individually

#

im too tired to make this work tbh LMAO

rich adder
#

You could do that sure if they are already in the scene but you cannot assign scene components to a prefab itself

#

once they are plopped into a scene they are technically an Instance of that prefab already

inland gazelle
#

gooot it

rich adder
inland gazelle
#

oh! perfect!

obsidian kite
#

I just switched from pc renderer in urp to mobile renderer since im porting my game to mobile, but i have one problem: my baked shadows now have terrible quality, like worse than realtime shadows. I tried to change numerous settings, but nothing made them better :( please help

obsidian kite
#

alr sorry

sick arrow
#

is anyone good at terrain

rich adder
sick arrow
rich adder
#

ok then don't crosspost..especially in a channel that has 0 relation to terrain..

#

asking about a specific asset no less

crystal rain
#

!learn

eternal falconBOT
#

:teacher: Unity Learn ↗

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

naive plank
#

SteamFriends.ActivateGameOverlay("Friends");, anyone got an idea why it opens the steam overlay AND the friends window of the steam application, using steamworks

inland gazelle
#

hi im trying to get a UI button to work?

#

but the function doesnt pop up ont he button menu

ivory bobcat
inland gazelle
#

uhh idk? i just added the menu script as a component to the button

ivory bobcat
#

You need to drag the object in the scene with the menu component into that runtime only selection field

inland gazelle
#

I think i got it

#

let me test

#

ok it works but now i need scene switching heop

#

LMFAO my correction for 'help' was blocked

rich adder
#

just edit the message instead of sending just 1 message to add a correction

inland gazelle
#

fair enough

#

im getting this

rich adder
#

do as it says

#

error is pretty descriptive on how to fix it

ivory bobcat
naive plank
#

You need to add it in the scene build scene heirarchy

inland gazelle
#

oh is that it? i thought that only worked if you were ctually building it

naive plank
inland gazelle
#

damn my teacher did not explain this well

#

ok ok got it now

#

thanks, ill prob be back

naive plank
#

Okey, I need advice, I have a SceneFade object, an image used for fading the screen when game is started, I cant put I network identity on it since when returning to main menu, the object will be disabled. I also need the sevrer to call clientrpc to fade all connected users screen. How should I do

rich adder
inland gazelle
#

oh yeah i kept forgetting to do that

rich adder
#

get oon it , its pretty useful when coding and will avoid most typo issues

#

also helps locate functions, properties and components/classes

rich adder
#

UI is local client thing

naive plank
#

Yes, it's solely for syncing the fading of the screen when host starts the game. I really dont have an idea how do to it otherwise lol

#

a custom packet with a fade trigger?

rich adder
#

make the server do an RPC to tell all clients to fade their screen in

sour fulcrum
#

the host starting the game is a networked thing

things that aren't networked can react to that happening

#

because it will happen for everyone

rich adder
#

literally the whole point of ClientRPCs

#

"Hey guys, do this"

sour fulcrum
#

a majority of stuff in games does not have to be directly networked if they are built in a way where each client does the exact same thing the exact same way, which usually is chaining off more generic networked stuff

drowsy flare
#

Can I use Dynamic rigidbody2d to block sprites from moving through each other (works now), but not doing the physics like pushing each other around?

naive plank
rich adder
sour fulcrum
#

Ideally you'd probably have some gamemanager/scenemanager esque networkbehaviour as a singleton that has an event that fires when your loading a new scene (a network "synced" event). then your ui stuff can justl isten to that

#

the event invoke is synced therefore anything running off it is synced

naive plank
sour fulcrum
#

you'll wanna do that kinda thing like everywhere

naive plank
#

Though I think it might still cause the same problem for me, unless it's dont destroy on load

rich adder
sour fulcrum
#

For scene related stuff i'd strongly suggest having some "globalmanager" esque thing thats DDOL or in a similar scene yeah

#

its not bad practice or anything

naive plank
#

So you'd suggest a dont destroy on load SceneManager object?

sour fulcrum
#

Semi personal preference but yeah I tend to have a GlobalManager or GameManager networkbehaviour singleton that lives in DDOL that handles broad stuff like scene management then something like a RoundManager (or GameManager if i used GlobalManager naming previously) for managing a given level or session

naive plank
#

Yeah, GameSession, that's something a was thinking of implementing for managing session-wide stuff, like money or thing like that

sour fulcrum
#

since the big benefit to networkobjects/behavours/variables is by default they auto-sync/create for people joining

naive plank
#

yeah, that Im aware of, I'm still fairly new to networking, but I have some understanding of the basic concepts

#

I named my script to SceneManager, got billions of errors lol, forgot it was already the name of the built in lol

inland gazelle
#

hey, whats the easiest way to get a method from one file into another file?

#

I just want something to go to the menu upon death and midnight is rapidly approachin

rich adder
#

Serialized usually the preferred way when possible

sour fulcrum
naive plank
#

you could put a static reference to the script "Instance", thats how I access them easily

rich adder
#

thats not always a good thing to do

#

static is misused a lot because of it

naive plank
inland gazelle
#

GOT IT WOO

rich adder
# naive plank How you mean?

other than singletons, there is a lot of misuse of static because they don't know how to properly DI between objects

inland gazelle
#

now i hvae an hour and 30 mins to get a pause menu and then im done with this semester

rich adder