#💻┃code-beginner

1 messages · Page 839 of 1

burnt vapor
#

Side note, consider using Awake methods when grabbing components. Unless you have a reason to use a later method like Start, it is prone to issues as the method might not have run in time.

#

There's also an attribute that you can use of which the name slips my mind, then it just auto assign this. That's also very useful here.

fading marten
#

I've tried using awakes, they didn't seem to work

burnt vapor
#

Try anyway, it should just work. Otherwise that's a problem worth tackling since you can't work around not using awakes

fading marten
#

hang on I tried characterController but I cannot put anything into it

swift crag
#

show me what you've done

fading marten
swift crag
#

drag whatever object has the controller on it into the field

#

unity will grab the correct component from it

fading marten
#

ty

swift crag
#
  • Player <-- has the CharacterController
    • whatever
      • thingy <-- has the Animator and returnRun on it
#

drag Player into the field

#

You can also right click on Player in the hierarchy and open another inspector panel by hitting "Properties"

#

This is useful if the component is ambiguous

#

e.g. you have two of the same component on the object

eager seal
#

hi

#

i need help i cant use unity for some reason

#

im on linux (cachy os, arch based distro) and when im using unity, fonts are very small in unity app

#

i tried 2x scale but its so big

#

how can i scale it 1.5x or else?

frail hawk
#

does not have much to do with coding why post it here

red snow
# eager seal how can i scale it 1.5x or else?

Hi, yes this is a common scaling issue on Linux with Unity. You can set custom scaling like 1.5x instead of only 1x or 2x by forcing UI scale through environment variables or desktop scaling settings. Try launching Unity with this command: GDK_SCALE=2 GDK_DPI_SCALE=0.75 unityhub , This gives something close to 1.5x scaling.

eager seal
#

i raged and uninstalled

#

i will use godot

red snow
eager seal
red snow
eager seal
#

there is so many bugs

#

i cannot choose windows

#

its bloat

polar acorn
keen acorn
#

Quick question, what's BurstDebugInformation and why should it not be shipped?

swift crag
#

the Burst system compiles C# into native code

#

to make this easier to debug, BurstDebugInformation provides extra information about this generated code (e.g. which lines of C# correspond to what parts of the generated code)

#

it's not massively harmful to give this to players, but it's not useful for them

#

(i guess you'd care if you were really, really secretive about your soure code)

rocky aurora
#

is it a good practice to swap input system based on the state of the game?

#

like maybe battle input/menu input, etc.

swift crag
#

that's what input action maps are for!

rocky aurora
#

thank youuu

golden notch
#

is it good idea to group things together in the level design or keep them all separated and under the main root?

frosty hound
#

If it's reused, in its own Level design scene that is loaded with the levels.

fresh wadi
#

Hello, I'm really confused. I'm trying to use a Unity asset in Unity 6, and the official documentation says it should work. It's imported into my project correctly.

slender nymph
#

do you see all of those same errors in the unity console?

#

-# also that new test() part looks like it should be an error no matter what

fresh wadi
slender nymph
#

i said unity console

fresh wadi
#

not sure

slender nymph
#

so the answer is no, not all of those errors show up in unity. this means you need to address the ones that do show up in the unity editor, then regenerate the project files and visual studio should start seeing the package

golden notch
#

ok so i'm planning to make a script that has an entity look at you if you're close by it... and i think the Update function would be too much each tick for all entities to check the posiiton of all players? Or will this be fine?

#

i guess i could have a collider? but for each npc?

slender nymph
#

i would go with something like an overlapsphere (or overlapcircle if in 2d) to check whether a player is nearby, then you can just put that into FixedUpdate so it isn't checking every single frame (which is pointless anyway since physics only automatically updates collider positions on FixedUpdate frames anyway)

#

and if you are concerned about performance, then use the profiler to see if there even is something to be concerned about

fresh wadi
foggy sparrow
#

Hey 👋 , i just installed unity and made a simple 3D project and installed VS 2022 with the unity options but now when i open any mono behavour script from unity i dont have any library loaded or anything present execpt from the script itself

(not sure if this is the place to ask for help but couldn't find the channel ;w;)

grand snow
#

!vs

radiant voidBOT
# grand snow !vs
Visual Studio guide

If your IDE is not underlining errors in red or autocompleting code,
please configure it using the link below:

Visual Studio (Installed via Unity Hub)
Visual Studio (Installed manually)

grand snow
foggy sparrow
# radiant void

everything from the • Visual Studio (Installed manually) is doen correctly

broken nest
#

How do i change the member of a list?
I'm trying to do this OpenTalentTree.instance.unlockedTalent.Find(x => x.Item1 == talentName) = temp;

slender nymph
broken nest
#

ok ty

foggy sparrow
slender nymph
#

no, that's normal

foggy sparrow
#

hm. doesnt seam to work :C

slender nymph
#

then you did not, in fact, complete the steps to configure it

foggy sparrow
slender nymph
#

ah, so by "doesnt seam to work" you mean "didn't follow all of the steps"

foggy sparrow
#

im not missing any chromosome i know how to follow step, unity just needed a project reload

#

not its working thanks

slender nymph
#

i know how to follow step
but you didn't follow the steps that make you restart visual studio

foggy sparrow
#

i restarted my vs, that diesnt work. when i restarted my unity and vs that worked

slender nymph
#

are you certain that the CC is being rotated correctly? this would make it move relative to the forward direction

vernal vortex
#

I'm a dumbass lmao it was feeding into a Vector2 instead of Vector3

slender nymph
half jolt
#

Hello, just wanted some help on an error I'm getting since I upgraded to Unity 6: Library\PackageCache\com.unity.render-pipelines.core@9d79d0cd2cf7\Runtime-PrivateShared\InternalBridge\RenderPipelineEditorUtilityBridge.cs(14,70): error CS0117: 'RenderPipelineEditorUtility' does not contain a definition for 'TryMigrateRenderingLayersToTagManager'

I literally just made a new project and I inmediatly got x2 of that error and I've been trying to fix it for a while but nothing works. Does this happen often?

solar hinge
#

Hi. I'm studying from a textbook, but I've run into a problem because textbook was published six years ago. Could you please explain what I should do in this situation?How can I fix the code and why is this happening?

sour fulcrum
#

you need Log not log

#

but your ide should be telling you that

#

!ide

radiant voidBOT
solar hinge
naive pawn
#

casing matters

solar hinge
fickle plume
#

If you don't have actual Unity question about code, please don't post off-topic here.

quaint reef
#

oh sorry alr

fickle scaffold
#

guys what is superior to start as a beginner?
it could be 2D because its simple but it has animation stress
it could be 3D because it doesnt have tougher animations, but you have to manage a lot of things like performance for instance..

limpid sparrow
#

Since i opened Unity the Canvas keeps disappearing, i didn't change a thing, since the last time i used unity. i also tried, to print out a debug message. The Canvas seems to no even load. The Dialoge Canvas is still working fine

fickle scaffold
#

at console

naive pawn
#

consider what you'll want to make eventually, start learning that

#

if it isn't working out, try the other

naive pawn
naive pawn
fickle scaffold
naive pawn
#

please don't recommend AI to a beginner, they won't have the necessary experience to actually utilize it

#

and it won't help with learning

naive pawn
limpid sparrow
#

The error just disappeared as well, while reaching. The canvas didn't even get load. that's what's causing the nullref error, the object didn't even load. i tried reimport all already.

fickle scaffold
fickle scaffold
bleak hemlock
#

I'm learning 2D starting out, but I wanna learn 3D once I learn how to 3D model lol

limpid sparrow
fickle scaffold
bleak hemlock
#

Spent the past 2 hours fixing my camera, haha

fickle scaffold
fickle scaffold
bleak hemlock
limpid sparrow
#

i duplicated the Canvas, deleted the old one, now everythink works normal again, odd

bleak hemlock
#

I fixed it, but my camera is still too wobbly due to the x, y, and z positions not being neutral

#

tried fixing it, but the z position reverts back to the original position

fickle scaffold
fickle scaffold
bleak hemlock
#

no wonder it was weird

fickle scaffold
#

@bleak hemlock by the way if you dont mind, why dont you showcase your project ?

bleak hemlock
fickle scaffold
bleak hemlock
#

but i can show it

#

a little bit of what ive learned

fickle scaffold
bleak hemlock
#

I'm learning collision, level design, character animation, stuff like that

#

I am learning art so I can use my own assets for my bigger projects

#

I'm doing this all myself, I wanna learn all aspects of development

fickle scaffold
fickle scaffold
fickle scaffold
#

and yeah i agree making your own assets feels like success before success

bleak hemlock
#

My biggest influences include Zelda and Final Fantasy, so I'm trying to do a top-down action rpg thing

fickle scaffold
bleak hemlock
#

My coloring and shading aren't too bad

bleak hemlock
#

I haven't really messed around with 3D development much, so it will be a while before I become confident

fickle scaffold
bleak hemlock
fickle scaffold
bleak hemlock
bleak hemlock
fickle scaffold
bleak hemlock
#

I suck ass at Krita and art in general, so it's been a learning curve

fickle scaffold
fickle scaffold
bleak hemlock
#

I bet you can create something awesome, don't doubt yourself! 👍

fickle scaffold
#

by the way have you learnt complete C# or just the basics like Input.GetAxis, Vector2... etc.? of course there are too many complex things after this ;-;

#

about me, im learning collision

bleak hemlock
#

I understand what they do once I apply them, but I have no programming theory knowledge

fickle scaffold
bleak hemlock
#

so I didn't learn as much as I could've

fickle scaffold
#

yo you can actually go for visual scripting too, thats without writing code... but you have to understand whats happening, i have tried that and yeah, normal coding is much better

bleak hemlock
#

Although, I've probably applied it without realizing it

fickle scaffold
fickle scaffold
bleak hemlock
#

I just wanted to learn game design because I want to make the game I want to play the most

#

and I just learned not to care what people think

fickle scaffold
bleak hemlock
#

I have musical and SFX knowledge from my audio engineering course, so I'm not very worried about that

fickle scaffold
fickle scaffold
bleak hemlock
#

I mean, I didn't have much else going on at that age, haha

bleak hemlock
fickle scaffold
bleak hemlock
#

If I ever get around to it, I may record something like that and send it to you once I clean it up

fickle scaffold
bleak hemlock
fickle scaffold
bleak hemlock
#

I'm basing a lot of my level design on games I love. Mega Man X has been a massive influence on how I approach level design

bleak hemlock
charred pumice
bleak hemlock
#

it's why I'm approaching it all on my own

#

the best way to learn that stuff is to do it yourself

#

with the internet being as big as it is, there is no better time to make games

bleak hemlock
#

Always excited to learn new things

fickle scaffold
solar hill
#

you guys should make a thread

bleak hemlock
#

sorry, am I spamming the channel?

fickle scaffold
bleak hemlock
solar hill
#

i think a thread is better for everyone

bleak hemlock
fickle scaffold
charred pumice
# bleak hemlock I'd love to hear it!
  1. Use [SERIALIZE FIELD] to make a private variable modifiable in the explorer

  2. Try to not use bland numbers in code since it makes it hard to read (it makes it hard to read and isn't open to modification later) unless it's zero

The rest of the notes I took are very specific and its kind of a long list

#

Most of them are from the unity basics video made by the same guy who runs the big unity game jam

fickle plume
charred pumice
fickle plume
#

Video tutorials with rare exceptions are there to gather clicks not to convey large amount of information needed.

#

The more comprehensive the course the less gaps in knowledge you get moving to the next subject.

graceful rapids
#

Yo im kinda New!

#

wnna Be a scripter

#

how d oi find a Group?

fickle plume
radiant voidBOT
fickle plume
graceful rapids
#

ty

karmic cairn
#

!learn

radiant voidBOT
brisk perch
#

how can i hide these attributes if a value is false on the editor?

#

inspector

#

its correct?

grand snow
brisk perch
grand snow
#

EditorAttributes, NaughtyAttributes and Odin all have things for "hiding this if something is true/false"

brisk perch
#

i though would have smth like [visibleif]

#

ok, but might not be neccesary

#

or its?

#

i mean which kind of player will be playing with the editor

#

its hard?

grand snow
#

Odin is the best solution (paid) for inspector customisation

#

BUT all of these solutions will override custom inspectors unless they are changed to inherit from the package base one

#

If not using a custom inspector it just works

lusty osprey
#

does anyone else get that feeling

#

also I dont know how helpful this chapter really is. can someone more experianced dime in for feedback

grand snow
lusty osprey
#

but to me. these chapters in pesudoranom noise is very heavy on theory rather than application. Im asking if u find it useful to understand these chapters in depth

grand snow
#

Learning how to write and implement an algorithm is not the same as learning where it can be used

#

But knowing how you may impement such a technique in future is useful, expecially how to make it performant and efficient (as this can be harder in c#)

lusty osprey
#

have u personally gone through these chapters. AM i taking this apporach correctly with what im doing now?

grand snow
#

I haven't but I already have many years of dev experience

lusty osprey
grand snow
lusty osprey
#

How long did it take u to get comfortable with all of this

#

To me ive been doing it for 3 months now. Feels like Im just studying theory

foggy sparrow
#

Hi, i got some problem with my player controller. im learning on how to handle slopes/stairs and i got a small bug on when im decending the slope im kinda yeeting myself from the point where i was insted of sliding/gliding down of it. Any idee ?

https://pastes.dev/VdHip71DNR

grand snow
radiant voidBOT
foggy sparrow
toxic yacht
# lusty osprey To me ive been doing it for 3 months now. Feels like Im just studying theory

I always always always recommend game jams to new devs, there are game jams specifically for technical art stuff too. If you feel like all you're doing in learning theory, try applying it in a small project. Like you're learning noise generation rn so try applying it to make a little infinite runner game or water shader. You dont need to finish it or release it, just try to make something with what you learned. If you're feeling like learning the underlying algorithms feels pointless, the usefulness of learning these kinds of complicated systems isn't always in actually knowing them. It exercises your brain for programmatic thinking that makes you capable of solving more and more difficult problems. Although for technical art, I'd think knowing perlin noise would be pretty important

lusty osprey
toxic yacht
#

how do you think tiny wings generated its levels

lusty osprey
#

ahhh

#

thanks!!

toxic yacht
#

np

toxic yacht
# foggy sparrow Hi, i got some problem with my player controller. im learning on how to handle s...

for slopes you want to project your movement vector onto the slope's plane (what the drawing shows). When you check for the ground, you can get the actual ground object you're colliding with, and the normal of the collision. Use that normal to then set velocity to the result of Vector3.ProjectOnPlane(orginalVelocity, groundNormal) * originalVelocity.magnitude. I'm not sure of Physics.CheckSphere() will give you a normal since I think its just checks for colliders contained in the sphere rather than doing an actual physics cast, so you might need to change your ground check to a Physics.SphereCast(), and get the normal out of raycastHit.normal.

#

mb i was making it a reply

foggy sparrow
#

i did that, was skeetchy but seams to work now :p

#

i also made a state for when the player is jumping since the slope thing was killing my upward velocity

toxic yacht
# foggy sparrow i did that, was skeetchy but seams to work now :p

as a side note its generally advised not set a rigidbody's velocity directly each update since it can result in some jank behavior. Unity is alreay simulating forces on that rb, so youre basically fighting with it over control of what should happen. But tbh I only start see issues from doing that if Im making a game with a lot of rigidbody interactions.

#

if you start seeing things like your player jittering around when they're pushed, or phasing through walls, that usually means you hit one of those problems. In that case you can use AddForce() with ForceMode.VelocityChange (i think thats the right mode), make a kinematic controller which is a massive pain, or use unity's character controller component (or any other on the asset store).

foggy sparrow
#

Im playing around with making some player interactasble thing like door and some stuff with the animator

mint imp
#

I have a question about manually creating behavior when buttons are clicked

Because im trying to do different stuff based on the state of the object
Ive already done this successfully and it worked great.

I kinda of copied that whole "Menu" and started working on a shop feature instead
now using the ClickedOn() does nothing
dispite working for my other buttons just fine?

rich adder
mint imp
#

interesting I'll see if something is somehow blocking the interaction

rich adder
#

if you're using new input system you can inspect whats being clicked on through inspector of event system

#

old input system would let you see hover events too

foggy sparrow
#

got it working

queen vale
#

Could i borrow someones eyes for a moment?
I'm working on a basic interaction system and when I added a sort of debounce to avoid getting hundreds of interactions I seem to have messed something up. The player can now only interact once, before needing to leave the interactionRadius, and re-entering it. I can see the the 'canInteract' does return to true, but if i remain in the radius, it doesn't allow me to interact again.

toxic yacht
#

Your coroutine will run while canInteract is true. Which means once canInteract is set to false the actual logic for starting the interaction won't run until the coroutine is started again when the player re-enters the trigger

queen vale
#

So i should add a second bool playerInRadius that the coroutine runs from..

toxic yacht
#

Yep that would be the easiest fix

queen vale
toxic yacht
#

Np

faint totem
#

I'm trying to access particle system material type from another object to use in the object I script for. I do have it that script knows which object do I want to read from (other parts of the script interact with that correct game object).
What should I write to get material from target object to the object I'm scripting?
Currently the code I have is as follows:
particlesRenderer.material = currentTarget.GetComponent<ParticleSystem>().material
Here "particlesRenderer" is reference to ParticleSystemRenderer of the object I'm scripting in and "currentTarget" is the target object from which I'm trying to get material. Problem is that it throws out CS1061, where it doesn't recognize ".material" at the end.

real thunder
#

yeah because you need to assign from ParticleSystemRenderer

faint totem
#

oh

#

do i feel dumb

real thunder
#

are you trying to copy material from one system to the other?

faint totem
#

the object i script for shoots raycast at a target and "steals" targets particle system material

real thunder
#

makes sense

desert bronze
#

can somebody help me with the buyoncy of a ship in unity urpl ?

#

i have tried everything but i can t make it work

silver fern
#

can anyone explain what I'm doing wrong here?

naive pawn
silver fern
naive pawn
#

oh, it returns UnitaskVoid, but Action needs to return void

silver fern
#

oh damn

#

it has to be unitaskvoid though, how do I register it as a handler?

naive pawn
silver fern
#

ok

runic thunder
#

with some knowledge etc, is it possible to use the networking unity has, like fishnet + steam api, for a ok 16 online world map?
lowpoly, darker, baked etc, high fps game
but also deal with the desync and all that stuff?

grand snow
#

Async functions usually return a task type hence this not working (if it wants void)

solar hill
runic thunder
#

well i know that, but i never made any multiplayer stuff, just wondering if a game like that, not a huge map/world, 16 players roughly.
easy to keep in sync? or alot of testing etc?

silver fern
grand snow
mint imp
#

Is there any reason i shouldnt use a singleton with ANYTHING that qualifies?
Ive been using it for game manager type objects, but is it okay to use with other scripts as long as i never have more then 1 of them

grand snow
swift crag
#

what does "flexible" mean, though?

#

i think they're very flexible :p

#

Of course, if you realize that the thing isn't a singleton, you've shot yourself in the foot

keen dew
#

It's very difficult to describe why all-singletons type architecture is bad until you run into the issues that it can create. You could look up why global variables are considered harmful in modern programming (C# doesn't even have true global variables) since singletons create similar kind of global access. Basically passing references around is sometimes cumbersome, but that's a good thing because it forces you to think about how to structure the code better and what responsibilites different objects have. If you get an easy access to everything from everywhere, you easily end up with spaghetti code that gets tangled more and more until it becomes unreadable and unmaintainable at worst

grand snow
#

Basically this

#

To me most of the time its "im lazy so static ref easy"

mint imp
grand snow
#

I encountered an issue relating to singleton use recently at my work (was a camera preset system)
Past designs presumed only one would exist at once but a new project changed this and thus started breaking things

#

The solution? Change to direct serialized references + pass a ref.

subtle pelican
#

Does anyone have any advice for someone who is new to game development?

errant ferry
#

i have 1 question. Is there any good tutorials to learn C# where the guy explains well and teaches what the code does without making you repeat the video multiple times just to understand 1 line of code and does stuff in order. Yes im asking for too much but ive learned some luau before starting C# so it feels really weird. I mix stuff up. It feels really hard to get used to this.

mint imp
#

Also my own question unrelated to that
Where does one even begin with "saving data"
the most ive ever done is use playerprefs for setting and saving small stuff for small games.
I just added a shop to my game and i need to save a list of "owned abilities"
where would i start with that

polar acorn
# mint imp Also my own question unrelated to that Where does one even begin with "saving da...

The basic process is "Write a file that says what you have" and "read that file and turn it back into variables"

There's a lot of ways to accomplish that. JSON serialization is the easiest, because you can serialize and deserialize entire objects by just calling a function. Then all you need to do is create an object that serves as your "save data" in game that everything else reads from to know what you have loaded

red ivy
#

my buttons are clickable all over the place

#

why is that?

#

im on the second camera and still being able to click it

wheat coral
red ivy
wintry quarry
shrewd ore
#

I'm doing the essentials pathways tutorial, and I've run into an error with my code, but I can't find what I've placed incorrectly

#

I've redone the section twice, in case I was just missing a mistake, so I think I'm not grasping where I'm supposed to put the line, maybe?

wintry quarry
#

!code

radiant voidBOT
shrewd ore
#

did that work, correctly?

#

and thank you, I realised that was a large chunk of text

shrewd ore
wintry quarry
#

You said "I've run into an error with my code"

shrewd ore
#

thank you, by the way.

wintry quarry
naive pawn
wintry quarry
#

Check Assets_Unity Essentials\Scripts\Collectible.cs

shrewd ore
#

let me see if I can set it off again?

wintry quarry
#

NVM yes it's what Chris said

naive pawn
wintry quarry
#

Yeah are you a Python user by chance?

#

# is not a comment in C#

#

C# uses // for inline comments

naive pawn
wintry quarry
#

Python is the most commonly used tho 😛

shrewd ore
#

ok, let me go over it again

wintry quarry
#

you also didn't finish writing the if statement

#

or rather - you didn't get the brackets exactly right as it mentions you should make sure you do

shrewd ore
#

found it! thank you!

#

I appreciate both the help and the patience. I've noticed not everywhere is kind to newbies

waxen pendant
#

I am using NetCode for multiplayer gameplay. I am spawning the players manually, this is my code that is fired when the player connects

private void HandleClientConnected(ulong clientId)
{
    if (NetworkManager.Singleton.IsServer)
    {
        GameObject playerInstance = Instantiate(playerPrefab);
        GameObject spawner = spawners[currentSpawnerIndex];
        currentSpawnerIndex += 1;
        NetworkObject networkObject = playerInstance.GetComponent<NetworkObject>();
        networkObject.SpawnAsPlayerObject(clientId);
        playerInstance.transform.SetPositionAndRotation(spawner.transform.position, spawner.transform.rotation);
        Debug.Log($"Spawning player for client {clientId} at {playerInstance.transform.position}");
        GameManager.Instance.RegisterPlayer(clientId, playerInstance);
    }
}

but my players are getting spawned at the origin

#

i have removed the pplayer prefab from the networkmanager

solar hill
#

so get the spawner first, instantiate at the spawners position and rotation, and then spawn it across the network

#

try that and see if it works

wintry quarry
still ingot
#

Here is my current code for the player movement I have in FixedUpdate:

                rigidbody2D.AddForce(new Vector2(playerMovement.inputDirection.x * playerMovement.SpeedMultiplier, rigidbody2D.linearVelocityY),ForceMode2D.Force);```
#

This is the force i apply to my player when the jump button is pressed:

    {
        jumpButtonPressed = true;  
        rigidbody2D.AddForce(Vector2.up * playerMovement.jumpSpeed, ForceMode2D.Impulse);
    } ```
keen dew
waxen pendant
# wintry quarry Well for one why not spawn it at the correct position in the first place? Instea...

this fixed that issue. but later in the game i want to teleport the player to a different position, but i am not able to do that

for (int i = 0; i < players.Count; i++)
{
    Debug.Log("Positioning player " + i + " at start position.");
    GameObject player = players[i];
    PlayerController playerController = player.GetComponent<PlayerController>();
    playerController.enabled = false;
    NetworkTransform networkTransform = player.GetComponent<NetworkTransform>();
    networkTransform.Teleport(startPositions[i].transform.position, startPositions[i].transform.rotation, Vector3.one);
    player.transform.SetPositionAndRotation(startPositions[i].transform.position, startPositions[i].transform.rotation);
    playerController.enabled = true;
}

the position of the player doesnt change

wintry quarry
spring stirrup
#

Hello Ppl !!
I have a little problem with a FPS controller. I'm learning level design and I just want a very simple GO to walk around my scene.

I've get a basic FPS controller. It work (the view move with the mouse, WASD work great etc...) BUT, the mouse is not "locked" in center of the screen 😕

in my script, I have :

void RefreshCursor()
    {
        if (!cursorActive)
        {
            Cursor.lockState = CursorLockMode.Locked;
            Cursor.visible = false;
        }
        else
        {
            Cursor.lockState = CursorLockMode.None;
            Cursor.visible = true;
        }
    }

at the start of the Update function, i've put a Debug.Log :
LockState: Locked | cursorActive: False | visible: False

Anyone know why my cursor is "locked" and "visible False" in my engine, but not locked and still visible in the Editor ?
I've try to build the game, and I have the same problem with the build 😕

ver: Unity 6000.4.4f1

thank all for your help 🙂

wintry quarry
#

Are you actually calling it anywhere?

spring stirrup
#

yep, It is call at the end of Initialize, and in a ProcessInput function (called in the Update)

if ( inputKeyDownCursor )
        {
            ToggleLockCursor();
        }
wintry quarry
#

what is inputKeyDownCursor? How does that get set?

#

Maybe just show the full script

spring stirrup
#

I've got this script from a thread on the Unity website (I'm not sure (don't remember ^^')),
But FYI, i've try the "Starter Assets - FirstPerson | URP" on the Asset Store and I have the exactly same problem 😕

ivory bobcat
#

!code

radiant voidBOT
spring stirrup
# ivory bobcat What is input key down cursor? When is it assigned?

the inputKeyDownCursor is :

inputKeyDownCursor = Input.GetKeyDown( keyToggleCursor );
[...]
public KeyCode keyToggleCursor    = KeyCode.BackQuote;

But stop searching haha
I think I've found out the origin : I'm a BrainFarter !

I'm working on a REMOTE machine !
The visible and not locked cursor is on the CURRENT machine....... The remote one seems to be unvisible AND locked '-_-

Sorry for the time '-_-

#

And thanks for help 🙂

golden notch
civic fog
#

my bad for teting in the wrong channel, idk if this is a big ask but is there anyone who can help me code a simple 2D platformer for a school final?

golden notch
#

ok so i am trying to use the ik rig but it's not working

    {
        if (!animator) return;
        if(lookingAt != null)
        {
            animator.SetLookAtWeight(1);
            animator.SetLookAtPosition(lookingAt.transform.position);
        }
        else
        {
            animator.SetLookAtWeight(0);
        }
    }```
floral zealot
#

[SOLVED]
I think I'm misunderstanding Unity's built-in ObjectPool. Here's the important bit of my code: https://pastes.dev/NADWSIUxuh
As far as I know, ObjectPools should prefer to use "actionOnGet" as long as there exists a disabled version of the desired object. And it should certainly do this when the number of objects in the pool is less than the maxSize. But in my experience it seems to continually call "createFunc". I have defaultCapacity and maxSize set arbitrarily low to test this

#

the bullet has no code to destroy or disable itself, all of that is handled by the script that contains the code in the link

#

please @ me with any response 🙏

wintry quarry
#

But generally it will be always calling both createFunc and actionOnGet on newly created bullets

#

and it won't be able to reuse any bullets until some have been returned to the pool

floral zealot
#

I think it ended up being a dumb mistake of me calling my chosen release method instead of the objectpool's release haha, i wish i caught it before sending the question

wintry quarry
#

ah yep - should be pool.Release(bullet)

floral zealot
#

indeed. all works now. thank you for taking a look regardless! i'll keep in mind the bit about needing more detail for future questions

wintry quarry
#

Not code related

serene adder
wintry quarry
serene adder
#

sorry

#

I don't know much English

astral shard
keen bridge
#

hello,

I am currently making a camera zooming script and I noticed a bug whilst in the editor, when I am scrolling down my inspector it now zooms my camera, because Mouse.current.middleButton.isPressed is technically true, even though I am not trying to zoom in the game viewer. How would i go about fixing this?

queen vale
keen bridge
#

okay ty 🙂

weak talon
#

hello
i having problem
im making unity multiplayer game and im using unity transport and got the network manager script and all
i put the port as 7777 and we are using zerotier which my friend is on the network and is authorised and so am i
the address is also the correct address in the zerotier so its not that
we both gave access to the game in our firewall and when we launch i host the game and it works but friend clicks client and it doesnt even do anything
i can host on one instance and join myself on it
my friend can also host on one instance and join himself i just cant join him and he cant join me
we only have one host at a time so its not that i just dont know why this is happening
i tried ai and he said this script should work hostButton and clientBUtton are buttons and their good

using Unity.Netcode;
using Unity.Netcode.Transports.UTP;
using UnityEngine;
using UnityEngine.UI;

public class ConnectUIScript : MonoBehaviour
{
[SerializeField] private Button hostButton;
[SerializeField] private Button clientButton;

private void Start()
{
    hostButton.onClick.AddListener(HostButtonOnClick);
    clientButton.onClick.AddListener(ClientButtonOnClick);
}

private void HostButtonOnClick()
{
    Debug.Log("HOST CLICKED");

    var transport = NetworkManager.Singleton.GetComponent<UnityTransport>();
    transport.SetConnectionData("0.0.0.0", 7777);

    NetworkManager.Singleton.StartHost();
}

private void ClientButtonOnClick()
{
    Debug.Log("CLIENT CLICKED");

    var transport = NetworkManager.Singleton.GetComponent<UnityTransport>();
    transport.SetConnectionData("127.0.0.1", 7777);

    NetworkManager.Singleton.StartClient();
}

}

sour fulcrum
naive pawn
worn nymph
#

how do I disable srgb sampling for my rendertexture? I am storing a packed normal map and srgb is skewing the vectors

grand snow
worn nymph
#

created at runtime. packed via. *0.5 + 0.5 then unpacked with the inverse. therefore 0, 1, 0 gets packed to 0.5, 1, 0,5, skewed by srgb and then unpacked completely wrong

grand snow
#

yea but that doesnt answer the question i asked

#

you can create a plain old texture with your data thats not srgb too

worn nymph
grand snow
worn nymph
#

does srgb only take place when read in a material or do I have to go over the entire project now and change it to linear for any buffer textures too?

maiden hound
#

my Update() function in a script thats on a prefab is not firing whatsoever when its instantiated from a list, regardless if the list is for a GameObject or ScriptableObject, everything is being initialized just fine, but if i drag in the prefab into the scene through the editor or instantiate the object but not from a list, Update() fires just fine.

sour fulcrum
#

post

#

!code

radiant voidBOT
polar acorn
sour fulcrum
maiden hound
#

the script is enabled its in the object, everything except for Update() is running, though i did figure this out and im actively fixing it, hopefully whichever solution i figured out works, as the objects are a child of a manager, and whatever is not selected gets disabled

polar acorn
#

If a parent object is disabled all of its children are also disabled

torn blaze
#

I dunno if its the right channel but how do i make this character appear in the game section? I'm following the tutorial but something dont work lol

#

She has some kind camera on tutorial and i dont know how to spawn it

frosty hound
#

This isn't, no. #💻┃unity-talk

However, this is the classic case where your camera is simply not pointing at your character. Start with setting your character to 0,0,0 so it's at least somewhere useable. Then position your camera at something like 0,0,-10 so it's sharing the same x/y but pulled back a bit so that it can actually see it.

torn blaze
tawny musk
#

I keep getting this error message for my looking around character control script. I can't find the error, can someone maybe see it or help me out?🙏

solar hill
#

(30,6)

naive pawn
#

and if you're not getting compiler errors highlighted in your ide you need to configure it

#

!ide

radiant voidBOT
civic fog
#

is anyone here atm?

#

I'm following a tutorial on how to make a 2D platformer for my final and I'm not sure why the enemy isn't moving

#

heres the code so far

polar acorn
#

!code

radiant voidBOT
civic fog
#

oohhh!! My bad I'm so sorry

frail hawk
#

not the best code bin to choose

polar acorn
#

It is at the top of the list

civic fog
#

I'm too new to this

#

is there a proper bin to use?

frail hawk
#

Debug.Log(isGrounded);

polar acorn
#

Show the inspector for Enemy

frail hawk
#

do this and tell us what it says

civic fog
#

alright alright thank yall

civic fog
polar acorn
civic fog
#

OOOHhhh

#

not sure how to trim in mac since I'm very used to windows '^^

polar acorn
civic fog
#

yeah

polar acorn
#

You're using a 3D Raycast to detect the ground. Does your ground have 3D colliders on it?

naive pawn
frail hawk
#

literally every code bin is better

naive pawn
naive pawn
civic fog
#

it only has 2D which does explain a lot...

polar acorn
frail hawk
#

pasteofcode is neat

naive pawn
#

does it support changing the language, as a viewer?

#

i didn't find that last time i checked

civic fog
#

also where should I put the debug log?

polar acorn
#

Any time after you set it, but using a 2D raycast should solve the problem

frail hawk
#

put it into the Update , ideally right after your isGrounded = code

civic fog
#

also also I sapologize in advance if I sound incompetent to this. I'm an animation major that knows little to nothing about coding 💔

naive pawn
#

we get a lot of those, don't worry lol

polar acorn
#

It's not the easiest to spot, it took me a bit before I noticed. I was expecting the issue to be related to the layering

civic fog
#

wait also does RayCastHit2D not count as a 2D raycast?

#

should i put 2D after all the raycast commands?

polar acorn
#

Physics.Raycast is 3D.

#

Physics2D.Raycast is 2D

#

Your other raycasts are all 2D

civic fog
#

ooohh okie lemme look if Ieft any without the 2D

#

IT WORKS THANK YOUUUU

frail hawk
#

nice catch, the Debug.Log would have solved it too

civic fog
#

I have at last encounted another issue :[

#

I'm very unsure of how I can code animation(how to code the left and right walk cycles since the charcater's left and right profiles are different) I also couldn't get the other animations to work following the Game Code Library's tutorial. Unsure what I did wrong or how I can fix it after looking at neumorous animation tutorials

#

I provided the code link along with the ss of the inspector

naive pawn
#

about the other animations not working (i presume just jump?) make sure you've linked up the transitions and params correctly, try debugging to make sure the params update as expected

civic fog
#

I've managed to get them working but it's still killing me that the walking left animation is walking in the wrong direction

civic fog
naive pawn
civic fog
#

is it oky if we can dm and call?

#

I might need multiple ways of help t complete this game by tmmru

#

also I did along with the player, but I'm still having problems

#

it's okay if you don't want to dm and call. My bad for bringing it up when we just met. I'm panicking because of finals

keen raven
#

Hello, I'm making a game that will have many enemies in it and I want to try to make a spawner object that can assign models and behaviors for enemies so that I dont have to make a million different prefabs for very similar enemies. I heard scriptable objects may be the way to go, but I dont know if the spawner itself should be the scriptable object or the enemies?

I want to assign things like enemy model, bullet type, health, movement angle, etc

waxen pendant
#

i have a raycast that i am drawing using a linerederer with a slight offset from the camera center. but when my player moves the linerederer appears to flicker and somtimes move like infront of the camera for a sec.
i tried moving the drawing code to lateupdate but still getting the same

wintry quarry
naive pawn
twin pivot
keen raven
# twin pivot SOs are just giant stacks of data, youd have a different script that takes the d...

Okay, so I have this stack of data here


public class SpawnerData : ScriptableObject
{
    public int enemyHealth = 1;
    public GameObject enemyType;
    public GameObject bulletType;
    public Transform spawnPoint;
    public float enemySpeed = 2;
    public float movementAngle = 0;
  
}```

How do I take the data from here and assign it to my enemy spawner? This is my attempt at a spawner thus far, but it doesnt seem to work. 

```public class EnemySpawner : MonoBehaviour
{   [SerializeField] private SpawnerData dataList;

    private float enemyInterval = 3f;

    public Enemy enemyType;

    private IEnumerator spawnEnemy(float interval, GameObject enemy)
    {   yield return new WaitForSeconds(interval);
        EnemyTest newEnemy = Instantiate(dataList.enemyType,    dataList.spawnPoint.position, dataList.spawnPoint.rotation);
        newEnemy.enemyHealth = dataList.enemyHealth;
        newEnemy.bulletType = dataList.bulletType;
        newEnemy.enemySpeed = dataList.enemySpeed;
        newEnemy.movementAngle = dataList.movementAngle;
        StartCoroutine(spawnEnemy(interval,newEnemy));
    }
}```
sour fulcrum
#

this is recursion

#

what isn't working

keen raven
#

it says "\EnemySpawner.cs(10,12): error CS0246: The type or namespace name 'Enemy' could not be found (are you missing a using directive or an assembly reference?)"

when I try to change public Enemy to public EnemyType it says "error CS0029: Cannot implicitly convert type 'UnityEngine.GameObject' to 'EnemyTest'"

twin pivot
#

You're trying to store an EnemyTest class as a GameObject ur gonna have to convert it/change the class of newEnemy first

keen raven
#

How would I do that?

twin pivot
keen raven
#
{
    [SerializeField]
    public int enemyHealth;
    public float enemySpeed; 
    public float movementAngle; 
    [SerializeField]
    private EnemyTest configuration;


    private void Start()
    {
     enemyHealth = configuration.enemyHealth;
     enemySpeed = configuration.enemySpeed;
     movementAngle = configuration.movementAngle;
    }

private void OnTriggerEnter(Collider other)
   {
        if (other.CompareTag("PlayerBullet"))
         { enemyHealth -= 1;
           Debug.Log("I got hit by playerbullet");
           if (enemyHealth <=0){
           Destroy(gameObject);
           }
         }

    }

    void Update() {
    transform.Translate(new Vector3(0, 0, 2 * enemySpeed * Time.deltaTime));
    transform.eulerAngles = new Vector3(0f,transform.eulerAngles.y+movementAngle * enemySpeed * Time.deltaTime,0f); 
}

}
``` This is what I have for the enemy so far. I only have the public floats there right now because it'll give me errors that data like movementAngle isnt found
twin pivot
keen raven
#

I dont have one actually... I tried asking someone else how to make this work and they told me I need to use "Enemy" but when I asked why they never responded

#

Im sorry. Im very new.

#

So I need yet another script?

sour fulcrum
#

if you don't have an enemy class you can't reference an enemy class

twin pivot
keen raven
#

Makes sense. Probably a pretty big thing to ask but, how do I make the enemy class script?

twin pivot
#

Also how have u been coding if you dont know how to make your own classes?

keen raven
#

Tutorials mostly. I know, I know, its better to actually get c# knowledge first...

broken nest
#

Hey, is there a way I could use asset in a folder? Like get an image in a folder and set it as sprite?

sour fulcrum
#

you might need to be more specific

keen raven
#

Wait. Isnt my EnemyTest script pretty much that though?

broken nest
#

Like having a png file in persistentdatapath for example

#

and set it as a sprite at runtime

twin pivot
sour fulcrum
#

sure

twin pivot
#

But i recommend trying simpler projects to start

keen raven
# twin pivot Yea but you named the class EnemyTest and not Enemy

I see. Okay so I changed the name and yeah it still says cannot convert to gameobject. I guess I'll google...

This is technically my second project so I thought I could do something a lil more challenging. Once I get this spawner to work my game is basically finished so Im very close

twin pivot
keen raven
#

Thank you

Ah Ive used GetComponents<ComponentType>() before. I dont quite understand how that can be used to change Enemy into a game object though.

sour fulcrum
#

you cannot change something thats one type into another type like that

keen raven
#

How would I do it? Im trying to do it like

SpawnerData newEnemy = (GameObject)Instantiate(dataList.enemyType, dataList.spawnPoint.position, dataList.spawnPoint.rotation);

and

SpawnerData newEnemy = Instantiate(dataList.enemyType, dataList.spawnPoint.position, dataList.spawnPoint.rotation) as GameObject;
but its giving the same error

slender nymph
#

why are you casting to GameObject at all?

keen raven
#

Because unity seems to be upset that its not a gameobject (I guess since Im trying to assign transforms?)

slender nymph
#

Instantiate will return the same type of object you pass as the first parameter, so if dataList.enemyType is a SpawnerData then it will return a SpawnerData which, presumably, cannot be cast to GameObject. if it is a GameObject then it will return a GameObject thus the cast is entirely pointless

slender nymph
keen raven
#

Assets\EnemyScripts\EnemySpawner.cs(17,44): error CS1503: Argument 2: cannot convert from 'Enemy' to 'UnityEngine.GameObject'

Same error when I replace "enemy" with "spawnerdata"

slender nymph
#

i, of course, was referring to without the cast. but it seems that dataList.enemyType is an Enemy, not a SpawnerData

keen raven
#

Yes, I was just trying SpawnerData to see if anything would change 😓 Sorry

broken nest
#

can someone help me with the problem a bit higher?

sour fulcrum
#

have you tried searching online?

#

/ what part of this are you stuck with

broken nest
#

How do I change a sprite at runtime by an image that i have in a folder

#

I know how to change a sprite but how do I reference it

slender nymph
#

is this a sprite on the end-user's machine, in Resources, or just in your assets folder?

sour fulcrum
#

ok so just for the sake of getting answers faster, you can just skip to the getting the reference part

#

since thats the actual thing you don't know

broken nest
#

Like appdata locals where my saves are

sour fulcrum
#

quite a few places to look at here

keen raven
#

This is my general understanding
Scriptable object = where I store the enemy stats
Enemy = What is meant to be the actual enemy object that spawns, is meant to pull data from enemy spawner
EnemySpawner = What Im trying to spawn enemies from and assign them their stats

sour fulcrum
#

you need a class that inherits from scriptableobject

slender nymph
#

fix the types in your code then provide the actual error message you are receiving if you still need help

keen raven
sour fulcrum
#

based on this message i don't think you know what inheritance is

#

this kinda stuff might be a bit too much for you to grasp for where your at c# wise, no disrespect

keen raven
#

Well I'm not going to give up when Im so close to having the game done thats for sure. I'll go take a look at what inheritance is n see if I can get any closer.

polar acorn
keen raven
#

Okay, reading up a bit on inheritance and I'm kinda seeing it. So I make Spawnerdata the parent since thats what Im trying to inherit from, so then I would instead have public class Enemy : MonoBehaviour I would have it be public class Enemy : SpawnerData? Or would I inherit spawnerdata in EnemySpawner?

keen raven
polar acorn
#

If you want it to return a SpawnerData, you need dataList.enemyType to be of type SpawnerData

keen raven
#

Enemy type is meant to be where I determine the prefab 3d model

polar acorn
#

Does the object have a SpawnerData component on it

keen raven
#

SpawnerData is a scriptable object, when I try to use public SpawnerData dataList; on the EnemySpawner nothing seems to be happening

polar acorn
keen raven
#

Maybe scriptable objects isnt the right way to approach this at all?...Im just trying to make a spawner that can assign attributes to the enemies it spawns

twin pivot
sour fulcrum
#

it is potentially a right way but you (again respectfully) don't understand what your doing enough in order to use them

polar acorn
keen raven
#

Im trying to learn, hence why I'm asking for help. I'm sorry.

Heres one enemy type I made. It has the prefab n such in it.

polar acorn
keen raven
polar acorn
keen raven
#

It still says Argument 2: cannot convert from 'Enemy' to 'UnityEngine.GameObject'

keen raven
#

17, 44 on EnemySpawner

StartCoroutine(spawnEnemy(interval,newEnemy));

polar acorn
keen raven
#

I am setting those types I think, with interval set to 3 and newEnemy is set to the Instantiate

sour fulcrum
#

yup

#

because we dont give a fuck about that !

#

this is a help channel

polar acorn
opal plume
#

I asked about that and got there is no where from a Mod no less.

fickle plume
#

@opal plume Don't post off-topic here. If you have a question about moderation, create a mod ticket.

#

@opal plume Also to clarify, this is a server about creating things in Unity not promoting your tools.

sour fulcrum
#

that was a unity announcement i think?

keen raven
polar acorn
slender nymph
slender nymph
keen raven
polar acorn
#

You ought to read the errors, they tell you what the problems are

keen raven
slender nymph
polar acorn
keen raven
sour fulcrum
polar acorn
keen raven
#

I understand its not existing in EnemySpawner, What Im trying to do is getting EnemySpawner to get the data from SpawnerData

opal plume
# fickle plume <@598301335510843401> Also to clarify, this is a server about creating things in...

They are not my tools? Don't assume. I wish you just directed me to the right channel but instead you were aggressive and dismissive which I do not understand when I am genuinely trying to help others. Fine it was the wrong place, so direct me instead of saying there is no channel. You had the opportunity to lead but instead you took the lower road and I am really not sure why as I have never had an issue on this Discord or any Discord. I am just trying to contribute.

polar acorn
#

If I told you to take a flight on my private jet, and you asked me where it was, and I said "Warren Buffet had a private jet" would that in any way answer the question

keen raven
#

No. Im sorry. I know Im lacking some key c# knowledge, I just feel like I'm so so close to getting this to work.

fickle plume
sour fulcrum
#

it wasn't an external service in this case

polar acorn
fickle plume
keen raven
sour fulcrum
polar acorn
keen raven
polar acorn
keen raven
polar acorn
keen raven
#
    {
     enemyHealth = spawnerdata.enemyHealth;
     enemySpeed = spawnerdata.enemySpeed;
     movementAngle = spawnerdata.movementAngle;
    }```
sour fulcrum
#

thats not how c# works

#

you need to know that in order to be doing these kinds of things

polar acorn
#

Code isn't magic. It does what you tell it.

#

If you say Enemy.enemyHealth, you're saying to get the enemyHealth variable from Enemy

#

If Enemy doesn't have a variable called enemyHealth, you can't do that

keen raven
#

So I need to give this enemy script its variables. I want to do that without having to make several different Enemy scripts all with slightly different stats. But I cant seem to attach the Scriptable Objects I made to the Enemy without having to get rid of these errors by giving them their own variables anyway.

#

I'm sorry if Im being a bother.

sour fulcrum
#

It's not that your being a bother persay it's just that it's this weird point in which we aren't really qualified to teach you the big gaps of knowledge you might be needing for this and answering your questions directly isn't getting far because you don't understand what the answers are saying

polar acorn
#

Attaching an object will not solve compile errors. You can't solve these by dragging in an object

#

You have to actually write code that makes sense

#

You have to use variables that exist. You have to give functions the types they require.

keen raven
#

And all of this makes sense. Like. I know. I know a computer can only do what you give to it. I know it wont just fill gaps for me. I feel embarrassed now saying this now but I know quite a lot of C++ and I thought maybe C# wouldn't be all that different but I was very very wrong. I definitely am very lost.

#

I just felt like I was very close and thought maybe a gentle nudge could make this work but theres clearly something very very big Im missing. I'm sorry.

polar acorn
#

It isn't. None of this is C# specific. This is all basic syntax that all languages share

sour fulcrum
#

it's kinda offtopic but if Start() was a constructor the snippet above would work in python right?

polar acorn
#

You can't pass an int to a C++ function that expects a string. You can't get a .name variable from a char

keen raven
#

I know that.

#

I just. I guess it all looks so unfamiliar formatted like this.

twin pivot
#

You might want to restart from the basics

civic fog
#

sorry for budging in the conversation but I've been trying numourous times trying to fix the movements along with the animations with my platformer, but I've had no success

#

is there anyone who could help?

keen raven
#

I'll keep trying to learn on my own. Sorry again. Have a good one anyways.

civic fog
#

I just didn't want to butt in the middle of someones convo

#

https://paste.ofcode.org/Ugs4L3JYWa8Z247LbvkM7Y
I've been trying to get my character to wall jump and slide while also maintaining the animations and their transitions. I've been trying to use shortcuts like yt tutorials but it hasn't been helping at all

magic copper
#

whats wrong with the code like im trying to make raycast door opening and closing but when i hit play its like door itself opens and doesnt even close catcrymic \

burnt vapor
#

Seems to me like it would close too quickly after opening but it's easier if it's known if it enters the code at all

slow roost
#

!share

radiant voidBOT
# slow roost !share
<:error:1413114584763596884> Command not found

There's no command called share.

devout otter
#

i dont get it, why do people use animations to open/close doors? why dont just rotate it in unity?

#

i feel like youre overcomplicating it for no reason + you have easier and better control over the speed, angle, direction, everything is easier and better

keen dew
#

If you already have a workflow for animating everything else in the game then making an exception for doors wouldn't be that great

#

Also I would argue that with proper animating tools you get much more control than with just code

naive pawn
narrow idol
sour fulcrum
keen veldt
#

thanks

#

IAmBatby!

turbid jolt
#

hello is anybody able to help with why this script, it doesn't make the turret of the enemy tank track my player tank which i move around? it also only shoots in one direction and at an angle aimed slightly higher which I am unsure why it's doing it, although glad it is at least shooting it's not quite there

ivory bobcat
#

Log some of the values to see what they are.

#

A common mistake would be referencing a prefab rather than the actual target.

#

Other than that, you'd need to verify if the values are correct.

turbid jolt
#

ngl

stuck parrot
#

How do I use unitys documentation "better"? I was looking for some info about how to use Rigidbody and since many of you tell me to NOT use AI I did it the way everyone tells me to do: googeling stuff and using the documentation. However searching for "Rigidbody" in the unity docs gives me hundreds of results. when I search in the unity manual https://docs.unity3d.com/Manual/30_search.html?q=rigidbody I get 176 results and in the unity scripting API https://docs.unity3d.com/ScriptReference/30_search.html?q=rigidbody i get 436, so even more. Under these circumstances, I would rather use AI to safe time but I do sacrifise reliaibility. Anything I can improve to not be overwhelmed by the docs?

polar acorn
#

If you want to know about rigidbody, you should click on the one that says rigidbody.

#

It conveniently lists every single member function and property of the class in one page (which are the other links you can see)

#

If you want to know how to use AddForce, look up AddForce

#

It's not really that hard. You search for something, then click on that thing

#

It's pretty easy if you're not being willfully obtuse to prove a point

foggy sparrow
#

hey, any good place i can learn how to make a hud, like a proper one ?

#

i have a leads of just making text on a 2D plane and that above everything else

#

and display my stuff there but all the tutorial are like from 2019

#

and i dont really want to use something like ai to learn this

rich adder
cosmic quail
stuck parrot
frosty hound
rocky canyon
#

the manual will be more like an overview..
the api will be more about individual methods/parameters and stuff

i guess it depends on how comfortable u are and what exactly ur wanting to find

frosty hound
stuck parrot
rocky canyon
#

like a big-ole cheat-sheet

#

but that happens to us all

#

at first u just dont know what u dont know..

#

you'll eventually learn what works for u.. what u use the most.. and then that type of thing just becomes muscle memory

stuck parrot
rocky canyon
#

properties are like settings..

#

myRigidbody.isKinematic = true;

#

methods are like the actions..
myRigidbody.Move()

polar acorn
wintry quarry
#

well... properties are technically just syntactic sugar around methods

small nexus
#

hey guys i suck so bad at coding yet i have so many dream games to make, any tips? onne is a fps shooter game with a market, stats and inv with cases in game and the other is similar to my summer car

radiant voidBOT
rocky canyon
#

first tip:

  • get better at coding
wintry quarry
rocky canyon
#

second tip:
scale back ur dream-game like.. by.. a bunch..

#

harsh reality of it

small nexus
rocky canyon
#

without a team.. ur basically ust gonna burn urself out w/ a big project

#

it is very possible..

#

dont get the wrong idea here

small nexus
#

but wasnt like msc made by one person

polar acorn
rocky canyon
#

just depends on what u wanna invest..

#

and is ur time worth it

solar hill
rocky canyon
#

eventually it can and will be

#

regardless of how BAD they are now

#

just takes the drive..

polar acorn
#

You're not going to skip on the "learning" phase by wishing hard enough.

#

Hit the books.

rocky canyon
#

yup.. lol

solar hill
#

it will be possible but the idea of having patience requires a lot of self control

rocky canyon
#

the learning part is kinda mandatory tho

solar hill
#

longer than you think

rocky canyon
#

oh hi Kuzmo 👋

small nexus
rocky canyon
#

u can start making basic games and stuff well in the first year

#

maybe not the best games.. but its a start

#

im pushing my 6th year.. still no published games 😭

#

lol

solar hill
#

theres also no guarantee your dream project will be successful or make any money

small nexus
#

i hope i can atleast make the menu with cases this year

rocky canyon
#

oh yea.. that'd be easy

small nexus
#

one of them atleast

rocky canyon
#

if u have any art background.. UI is pretty easy to start working with

rocky canyon
rocky canyon
# small nexus oh yes

lol.. that was my first gamer nick-name ever.. back in the 1990s i went by "Wrath", eventually became Wraf, then Wraffy or Wrafsicle 😄

wide lotus
#

yooo

small nexus
rocky canyon
wide lotus
#

guys what is the easiest program for designing levels and maps for unity

polar acorn
#

A sheet of graph paper

solar hill
#

a combination of probuilder and blender

#

depends on what you mean by "designing"

#

also how is this a code question

prisma shard
#

I have come across my my most discouraging problem yet. If i grab like (50 units), and put them in a formation that has circles under each tile where a soldier should be. Not only do units like to awkwardly path in efficient vertical lines like they are waiting for a return. Worst of all it takes them too much time to get in formation, it would probably be much easier what no unit collusion but this game has 1 space = 1 space occupied 99% of the time. So they are bumping past each other and trying to find ways to get to the location they want. But i think its doing it wrong. I asked a programmer friend on how to fix this, and he wasnt sure including another programming friend. So then i resorted to AI and AI did not give me a workable solution. What am i missing. Is there some kind of math formula combination im missing. I used to have something more normal but i took a break to do a few weeks of memory management and reduce lag for large amount of units as much as possible. And i think this creeped up on me through the changes

slow roost
#

Hi everyone. Does anybody now how to fix this? i try to install Unity AI

#

also I faced this behavior after install this package. It's just freeze like this.

swift crag
#

ha

polar acorn
#

This is a very non-trivial problem to solve. It might not even be worth trying to solve

swift crag
#

The first thing that comes to mind: how do you assign each unit to a spot in the formation?

#

if each unit wants to travel a long distance, you'll get tons of collisions

#

ideally, each unit should move as little as possible

#

(this is probably one of those intractable NP-complete problems, because everything interesting is...)

ember gate
#

hello so im doing a dash script, im getting back into unity and I got a question, what is the alternative of rigidbody.velocity = ...

wintry quarry
ember gate
#

thank you and um whats the difference between linearVelocity and angularVelocity?

polar acorn
ember gate
#

oh ok makes sense thanks

#

the IEnumerators also changed I see, whats their replacement?

polar acorn
#

They haven't

ember gate
#

am I missing any using directives then?

wintry quarry
ember gate
polar acorn
#

Yeah, probably

wintry quarry
#

the lightbulb should fix

ember gate
#

ok it was System.Collections

ember gate
#

I found that there is a new input system and it gives me an error the way I implemented it, how do i swap the input code?

solar hill
#

!input

radiant voidBOT
# solar hill !input
How to Set Input

To set Active Input Handling, go to:
Project Settings > Player > Active Input Handling

• Input Manager (Old): Use the original Input settings.
• Input System Package (New): Uses the new input system package.
• Both: Use both systems.

slender nymph
somber vortex
#

Hi guys! I'm really stuck with something. I think I'm missing something super simple, but I just can't seem to figure out what it is.

I'm currently working on customizing my inspector a bit, using VisualElements in a PropertyDrawer. Essentially, you have different QuestTypes, and depending on the QuestType I want to show different fields in the inspector.

I'm Adding the right children to the root, and it does work with the initial QuestType picked, but when I change QuestType in the inspector, no children get displayed.

Again, it should be something so simple, yet I can't seem to figure out what I'm doing wrong. Anyone here have any experience with VisualElements?
#↕️┃editor-extensions message

slender nymph
somber vortex
#

Ah thank you, wasn't sure if this was the right channel 🙏

kindred blade
#

so im working on an outline system for a port im making but once i walk up it an object that can be outline, it will outline that object plus all other objects that can be outline

using System.Collections.Generic;
using UnityEngine;
using System.CodeDom;


public class OnHover : MonoBehaviour {

    [SerializeField] public GameObject highlighted;
    

    // Use this for initialization
     void Start () {
        StartCoroutine(timerDelay());
    }
    
    // Update is called once per frame
    void Update () {
        
    }

    [SerializeField]
    private void OnTriggerEnter(Collider other)
    {
          highlighted.SetActive(true);
    }

    [SerializeField]
    private void OnTriggerExit(Collider other)
    {
        highlighted.SetActive(false);
    }

    IEnumerator timerDelay()
    {
        yield return null;
        highlighted.SetActive(false);
    }
}```
im using unity version 2018.2.19f1
kindred blade
#

instead of it js outline the object that im near it outlines all objects that can be outlined

twin pivot
#

Why are you serializing OnTriggerEnter and OntriggerExit and what is timerDelay() supposed to be doing here

kindred blade
#

lwk the serializing was to test what it does but its useless in this case and timerdelay is adding a delay before it removes the highlight bc the highlight was starting on enabled even tho disabled

twin pivot
kindred blade
#

wym

twin pivot
#

You didnt add a delay so there is no delay

kindred blade
#

i added the delay in start

#

oh oh

twin pivot
#

The code is run on start, theres no delay

kindred blade
#

its skiping the first frame bc the outline was getting enabled before the code initalizes so i added a delay

#

it works

grand snow
#

yield return null causes a single frame delay

twin pivot
#

Ah thats what u ment nvm

twin pivot
kindred blade
#

its lwk. not

wintry quarry
#

e.g.

    private void OnTriggerEnter(Collider other)
    {
          Debug.Log($"Highlighting {highlighted.name} from script attached to {this.name}");
          highlighted.SetActive(true);
    }```
#

Also yes SerializeField doesn't make any sense here at all.

#

And:

    private void OnTriggerExit(Collider other)
    {
        Debug.Log($"Un-Highlighting {highlighted.name} from script attached to {this.name}");
        highlighted.SetActive(false);
    }```
crystal hazel
#

why doesnt my animation play?

wintry quarry
crystal hazel
#

the armature_walk

wintry quarry
frigid marsh
#

why my tree are pink

verbal dome
#

Not a code question though

frigid marsh
#

But it's not because I made the project high 3D, right?

prisma shard
#

i finally got overwhelmed with coding AI (Game AI) that i bent the knee. I think about something i dont really understand and suggest using a hungarian algorithm to solve it. This is a complete shot in the dark and I highly doubt thats correct. Yet AI tells me its a great idea and tries to implement my super hard problem with something I just casually floated to them. The fact that Sam Altman and these morons have coding AI of all things just agree with the users is so unbelievably dumb. I cannot believe people code this way

frigid marsh
#

I also use AI

prisma shard
#

I dont understand how people do it. Im gritting my teeth in frustration the whole time

#

Not even about the AI solutions but the way it relates to you and toxic positivty

frigid marsh
#

He helps me; so far there has been no problem, only with the trees

twin pivot
#

i dont use ai and i recommend everyone to do the same

prisma shard
#

I would love a discord room in here specifically for that, because ive hit multiple walls using AI when i lose all hope in fixing something myself. And yet many people say they do entire projects in it. I dont understand how thats possible

frigid marsh
#

One must know what one is asking him

prisma shard
#

I guess if i was trying to ship some buggy piece of trash then it would work. But if u truly want a mastercraft ud expect from a triple AAA studio i dont know how u could use AI

twin pivot
#

AAA games are made with hundreds of thousands of dollar at minimum and highly experienced devs, not ai

twin pivot
marble hemlock
#

is there a way to find a game object by name in a scene but not using GameObject.Find

that only works for items that are currently active in the scene

#

i cant use Find.GameObjectsByTag(s) since the game objects already have a tag that allow me to interact with them

#

ive been trying to figure this out because every time the player goes to a new area, this script would then lose the reference, so i need them to regain the reference when i reenter the scene

wintry quarry
#

Maybe if you explain your situation in more detail a better approach can be suggested

#

For example what do you mean by "the player goes to a new area"? And what script is this that is "losing tje reference"? Scripts don't just randomly "lose" references.

night cedar
#

is the red thing on the bottom normal?
just begining to use unity

wintry quarry
wintry quarry
#

and the package manager for the package updates

marble hemlock
#

basically this is a game object that does not get destroyed on load, a sort of master script that tracks the player's overall progress

#

my new problem is that i dont know how to get it to keep track of the player's last position in a specific area

#

for example, lets say this is sort of a hub location and they press on statues to leave
i wanted it so that when they did eventually come back to this hub, it would immediately teleport them back to their last location, basically on the same frame they returned

my system was to have it be part of the script that was sending them to other scenes, that it would take the current transform of the player, store it, and then when we got back to the correct scene, it would use that transform's position and relocate the player

#

unfortunately, this falls apart nearly immediately, because what it does is take the current transform, stores it, and then the moment they get to a new scene it completely voids it

wintry quarry
#

You definitely don't want to store a Transform

marble hemlock
#

i did and it lost the transform

wintry quarry
#

A Transform is a component on a GameObject

marble hemlock
#

i need something else me thinks

wintry quarry
#

as soon as you unload the scene it gets destroyed

#

Store the position

#

Vector3 or Vector2

marble hemlock
#

ah okay vector3 then
thank ye 🫡

wintry quarry
#

and the rotation if you wish

marble hemlock
#

i kinda forget vector 3 is a thing until its time to

#

raycasts, actually

wintry quarry
#

It's... it's really hard to do anything in a game engine without Vectors...

marble hemlock
#

im simply very determined

#

i think i used vector2 a bit back to check how much of an enemy was on screen but its not necessarily my go to i must admit

prisma shard
#

Anyone know how much it would cost a dev to observe a 40k code base and fix AI from having crap pathfinding. I think I am too mentally cooked. Its been ruining my sleep. Its been making me not go outside

#

Idk who would want to do game dev but it has to be up there as a horrible hobby/career

#

this worthless crap is apparently not enough to solve something as seemingly simple as multi agent pathfinding

polar acorn
#

Starcraft 2 only barely got it right and I'm pretty sure it's still the highest budget RTS game ever made

#

You might just have to accept a bit of suck, or put in some fail safes like temporarily disabling colliders if they spend too long without going anywhere

heavy mortar
#

haha

keen bridge
#

Hello. I am currently getting the error below, despite me having installed the unity transport package. Would anybody be able to point out what the issue is?

The type or namespace name 'Netcode' does not exist in the namespace 'Unity' (are you missing an assembly reference?)
slender nymph
#

that's the transport package, not the netcode package. do you have the netcode package installed?

keen bridge
#

thank you, I do not. It looks like this package is in preview. What are people currently recommending for games using dedicated servers?

slender nymph
#

what netcode package are you looking at that's in preview? because it's been fully released for a while now

keen bridge
#

oh... the link that came up on google sent me to an old version (0.0.4-preview), it looks like there is a 6.6 now. My bad 😅

slender nymph
#

are you using ECS? if not, you should be using Netcode for GameObjects

keen bridge
#

okay, thank you so much 🙂

keen bridge
#

how do I test my multiplayer functionality on another instance? What i've been doing so far is using build profiles and clicking "build and run", but this doesn't support hot reloading and it is also very tedius to manually rebuild it after every small change.

slender nymph
#

#1390346492019212368
but if you are on a version that supports the package, unity has a Multiplayer Play Mode package that allows you to do that. otherwise there are third party assets like ParrelSync

keen dew
keen bridge
#

thanks guys 🙂

fickle plume
#

!collab

radiant voidBOT
# fickle plume !collab

: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**

crystal agate
#

Currently trying to make a movement system with acceleration, and made this Mathf.Lerp function to gradually interpolate the moveSpeed to the maxSpeed/0 by accel/decel. It seems to be working, but the problem is that the acceleration/friction is so fast that even setting the numbers to 0.1, it pretty much accel/decels instantly and acts like there was none in the first place. How can I fix this?

#

update: setting the numbers super super low gets the accel working but the object still stops instantly. I suspect this is because "direction" goes to 0 instantly when I let go, even if the current moveSpeed isn't 0 it still stops

#

not quite sure how to fix this though

keen dew
#

Lerp is the wrong method for that. Use MoveTowards instead

crystal agate
keen dew
#

Mathf.MoveTowards, not the vector version

#

Use it to change the moveSpeed value instead of lerp

crystal agate
#

thank you! this is a better way of doing things

#

that said it still stops instantly when I let go of the button - the direction still instantly goes to 0 when I let go, which makes the velocity 0

#

is there any way to make it so the object gradually decelerates instead of stopping instantly?

#

Current code.
Deceleration works now, but I'm trying to make it so that moving the opposite direction decelerates to 0, then moves it that way, while what's currently happening is that changing directions is instant

#

would AddForce be better?

keen dew
#

If you let go of the controls, the direction will be 0, 0 so it doesn't matter what the speed value is

#

If you want to set the velocity manually you'll have to manage everything like this so in that sense using forces would be easier

crystal agate
#

I've solved that one by saving the old direction before letting go, my current issue is that I'm trying to make it so changing directions doesn't just turn instantly with the same speed

slow spire
#

Hi, is this the right place to ask for help with some code problem I'm having?

ivory bobcat
slow spire
#

I thought so, just wanted to make sure.

Im having an issue when my player is constantly being set to 0,0,0.

It first happened yesterday morning altering working on it Thursday afternoon time, I saved it and it was all working well, put it on diversion repo, and when I opened it yesterday it was like that, like in the video.

I did a bit of research and supposedly it could have been a problem with the file itself.

So I remade the project yesterday but when I came to it today it was the same as it was.

ivory bobcat
#

Position relatie to z would be locked

wintry quarry
#

I'm like 96% sure it's their scripts and not that

slow spire
wintry quarry
#

This is also X axis motion based on the videos

ivory bobcat
#

Yeah, most definitely

radiant voidBOT
slow spire
slow spire
ivory bobcat
#

The quality is quite terrible but certainly some script is modifying the position of the object.

slow spire
#

These are the two scripts attached to the player character

wintry quarry
#

What other components are in your game? Do you have a camera script?

slow spire
#

Yea, I'm using cinemacine though so it's not a script. There are 4 scripts for the projectiles with them all being almost the same, I can send them over if that helps?

wintry quarry
#

Doesn't that answer the question directly about what's responsible for it?

slow spire
#

Yea, that's right

wintry quarry
#

So that's it then

slow spire
#

Yea, i got that, but my character needs rigid body to move, I'm wondering if there's a way to fix it or if i need to use something else for movement

wintry quarry
#

I'm kinda failing to see what needs to be fixed here

ivory bobcat
# ivory bobcat Something to consider

After removing the rb component, were there any errors? Show the console window. Something may be referencing the object and moving the object using the rb component.

wintry quarry
#

Why do you need to be able to drag it around by the move tool at runtime? And if you really need to, you can just make it kinematic

slow spire
slow spire
wintry quarry
ivory bobcat
#

For instance, this would have thrown a missing reference exception if you hadn't disabled it.

wintry quarry
#

Again I'm failing to understand why it matters that you can't drag the object's position in scene view at runtime

#

Also there were definitely errors, I saw them in the video you just didn't have the console open

slow spire
#

Oh, my mistake.

ivory bobcat
#

I'm under the assumption that they're illustrating that the object simply cannot be move by any means (as though something is reseting it's position) and had illustrated it through physically dragging the object in the scene view.

#

I'm only partially here so I may be wrong.

wintry quarry
#

I don't think it was shown that it can't be moved "by any means". Presumably it can be moved by the script.

slow spire
wintry quarry
#

That being said there's actually nothing in your movement script that's actually moving the object aside from the Dashing logic

#

I think you just forgot to put the main movement code in

#

The Move function only does two things right now: rotate the character, and dash

#

Oh and jumping

#

Also both left and right dash seem to be listening for q

#

A does nothing

#

Look at line 100 and 106

#

Both are doing GetKeyDown "q"

slow spire
#

Forgive me, but I dont know how to explain how it works right, but the movement does work, the line float xValue = Input.GetAxis("Horizontal") is what's getting the a/d. And it was working for the movement when I left it, I have it working in other projects too.

wintry quarry
#

Right ok so then it's all working

#

And yes if you have code setting the velocity to 0 every frame, then yes the Rigidbody is going to force your object to not be able to move externally

#

And your code is indeed doing that when the input is 0

#

You basically have the universe's most powerful brakes engaged with that code

slow spire
#

Yea, which is the idea for when the player stops moving, and it was working when last played, when I can I'll try send a video how it should work.

wintry quarry
#

"how it should work" is exactly the thing that's missing from your explanation here. Because right now I can't figure out what you're actually expecting this to do that it isn't doing right now

ivory bobcat
#

You can probably quickly verify if input is producing your unexpected behavior by simply setting linear velocity to an expected value:```cs
void Movement()
{
float xValue = Input.GetAxis("Horizontal");

    Vector3 velocity = rb.linearVelocity;
    velocity.x = xValue * playerSpeedHorizontal;

    rb.linearVelocity = Vector3.left * playerSpeedHorizontal;//velocity;
}```
keen acorn
#

Guys, I've been trying to install unity for a friend of mine, but Visual Studio isn't suggesting the keywords.

  • Unity version is 2022.3 LTS

  • Visual Studio version is 2026 (18.5.1)

  • In the unity preferences, the External Script Editor is set as Visual Studio [18.5.11716] (only vesion installed)

  • Visual Studio has the Unity module installed (and no other)

We have:

  • Reinstalled Visual Studio
  • Reinstalled the unity module in Visual Studio
  • Read the installing guide and watched a few videos

Is there anything we've missed?

keen dew
radiant voidBOT
ivory bobcat
# keen acorn Guys, I've been trying to install unity for a friend of mine, but Visual Studio ...

If you aren't getting Intellisense, you've likely missed a step in the installation process. The common mistake would be missing the Game development with Unity workload during the Visual Studio installation process. You can run the VS installer again to simply add the workload without having to uninstall/reinstall the application. Basically #3 in the installation configuration process (it isn't applied by default thus why folks often miss it - VS IDE isn't solely for development with Unity so the workload isn't selected by default).

celest depot
#

hello guys, im trying to simulate a RCS thruster activation on a spaceship. when i press the key to move the ship, the thruster will play and when i release the key, reverse-thruster will be played to simulate auto-stabilization system. yet, in my code, the thruster activation are buggy. i dont know which line are problematic

keen dew
#

Buggy in what way?

celest depot
#

Shot explanation : I press key w(forward), forward thruster on. After release w key, backward thruster did not play, sometime play. Press s key(backward), backward thruster on. After release s key, forward thruster did not play at all.

verbal dome
#

Update: Read inputs and update particle systems
FixedUpdate: Add continuous forces

#

That's how you should do it

celest depot
#

oh, alright. i will fix it

#

thanks

crystal agate
#

Help, how do I recover an unsaved scene? My engine crashed just before I coiuld

#

there's no _Recovery folder in Assets

#

I already reopened the engine

polar acorn
#

You only have a recovery scene until you reopen the editor

#

If you've already reopened, it's already been cleared

crystal agate
#

dang okay i didnt even know it was unsaved until i reopened the engine and my progress was gone

#

any way to stop future crashes?

polar acorn
#

Don't code in any infinite loops? Hard to tell without knowing what crashed it

crystal agate
#

I don't even have a single .cs file in this yet 😭 i was setting up UI

frosty hound
#

!collab

radiant voidBOT
# frosty hound !collab

: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**

solar hill
#

and save frequently

#

but i guess those 2 are related concepts.

fleet void
# crystal agate any way to stop future crashes?

Unfortunately, engine crashes are version-dependent and sometimes even hardware dependent. But like someone else mentioned, it can also be your own fault sometimes if you code an infinite loop (among other things). If you have your debugger active you can always an infinite loop and force execution outside the look though lol (if thats indeed the problem).

You should look into using version control, even if its just you. A GitHub repo that you simply push to will go a long way 🙂

mystic slate
solar hill
ebon ice
#

Does LookAt() not effect children? I've got a gun and it can rotate fine with LookAt() but the empty firing point child isn't effected by this

solar hill
#

the firing point is a child of the gun?

rich adder
wintry quarry
ebon ice
#

So I've figured out it's not that actually, I put a sphere on the fire point and it's moving with the gun, so it looks like it's the instantiating, which doesn't make sense to me

#

Because this should work right?

wintry quarry
#

It will take firing_point.rotation, whatever that is

ebon ice
#

but the shells aren't moving away from the initial position of the firing point

wintry quarry
#

Either that or the object you instantiated has a script that's moving it unexpectedly

polar acorn
rich adder
ebon ice
#

So the issue is this is the enemy, this works fine for the player

wintry quarry
#

What's going wrong exactly?

ebon ice
#

Hang on I'll get a clip

wintry quarry
#

The place it spawns? The rotation it spawns at? Or the motion after it spawns?

ebon ice
#

The gun is rotating but the shells are still spawning from the same place even after rotating the gun

wintry quarry
#

Whatever object you assigned to firing_point is not the correct one