#💻┃code-beginner

1 messages · Page 456 of 1

pale ocean
rich adder
#

That won’t work

#

You need it on the object with the collider

pale ocean
#

ah

rich adder
#

Raycast detect colliders

pale ocean
#

mm nope it didn't print it out even with cylinder on the layer of pipe

languid spire
#

but your cylinder is above it's parent

pale ocean
languid spire
#

look at the Y position

pale ocean
#

why is the y position of the child relevant?

languid spire
#

because that is what gets hit first

pale ocean
#

it shouldn't matter anyway as i've changed the layer mask to the child anyway

rich adder
#

Is the collider on the pipe good? That center looks suspicious

languid spire
#

show inspector of Pipe object

pale ocean
languid spire
pale ocean
#

why not?

languid spire
#

it has no collider

rich adder
#

It should hit the child though

pale ocean
#

it shouldnt?

rich adder
#

Select Window- analysis - physics debugger . Go to the queries tab and enable everything , run playmode and check for raycast

languid spire
#

yes, it will hit the child and REPORT the child if it meets the criteria, i.e. the LayerMask

pale ocean
#

i don't see anything

languid spire
rich adder
pale ocean
languid spire
#

but it looks like the Cylinder collider is no where near the cylinder renderer

rich adder
pale ocean
#

is this what you mean by selecting the player?

rich adder
#

Yes I see the red ray. Wait nvm that’s the move tool

#

Click player and press F

#

Also why is he below pipe

pale ocean
languid spire
#

there is no way that collider is in the correct position, screenshot looking down on the cylinder with the cylinder selected

pale ocean
rich adder
#

Why is it now a ball lol

pale ocean
#

its a capsule

rich adder
#

Oh… ur underneath looking up..

pale ocean
#

my bad

#

i've tried moving the collider up

#

does nothing

rich adder
#

Select the player click F in playmode .

#

You have to see where that raycast is first and foremost

pale ocean
#

sorry, but i hide the player to get this screenshot, what's the shortcut to unhide things

languid spire
#

I just realized, those center points are very small (missed the e at the end). Reset them to 0

rich adder
languid spire
pale ocean
#

it's not logging anything

steep rose
#

Are your colliders triggers

pale ocean
pale ocean
rich adder
pale ocean
rich adder
#

Your player is far away from it

#

It’s obvious by the position relative to parent

steep rose
#

Because you used transform.position (zero clue why my phone is not making that a code bracket) and the script is on the parent, it will try to use the parents position. Not the childs

#

Nvm I guess it was making that a bracket

rich adder
#

Indeed. script is basically super far away from player

#

Never put logic and components on child / graphics when possible

#

Always root

pale ocean
#

neat thanks y'all sorry for bothering you, changing the location to 0,0,0 for the parent fixed it

rich adder
#

You mean child ?

pale ocean
#

nope parent

steep rose
#

Also why is your child so far away from parent

pale ocean
#

the parent was way off

rich adder
#

But it’s player that’s far away lol

#

That’s the child

steep rose
#

Now where is your child

#

Then

pale ocean
#

they're on the same position

steep rose
#

How?

rich adder
#

Ok so did you reset the capsule position

steep rose
#

The child moves in respect the parent

rich adder
#

(PlayerVisual)

steep rose
#

Yeah, so the child object

rich adder
#

That’s the one that need 0,0,0, since it’s restive to parent

pale ocean
#

nah nvm the parent is a bit higher

#

in the y direction

#

by 1

rich adder
#

Putting parent at 0,0,0, doesn’t do anything but reset it to world 0 pos

steep rose
#

If you moves the capsule you moved the child

pale ocean
#

i know

rich adder
#

Yeah so the child needs to be 0,0,0 not the parent

pale ocean
#

i said the parent was on 0,1,0

#

and the child is on 0,0,0

rich adder
#

Ok now it’s correct

pale ocean
#

yeah

#

thanks all

rich adder
#

Good UnityChanThumbsUp

steep rose
#

👍

drowsy flare
#

Okay I've scripted an enemy with movement, attacks, health etc. This includes public methods to deal damage to it and so on. This was all done in an EnemyController class in a single file.

It started to feel like it got too big, so I moved the HP-related things to a separate class/file. This would mean that I would need another public method for the EnemyController, to which I send a signal to die.

I'm starting to feel like it might just grows bigger for not very much benefit. Any guru that can guide me in the right direction? I intend for the same script to be used for multiple kinds of enemies, and control behaviour with public variables set in the [SerializeField]

steep rose
#

If you really want to make it super clean you can remove brackets from if statements and push code up next to it (as long as it isn't more that 1 line)

#
If(something)
    // do something
drowsy flare
#

Thanks but what I'm asking is about separating it to different classes which interacts with each other via public methods, and if it's worth it?

#

You know, best practise?

broken nest
#

Hey, I got a sprite that disappears if I zoom in on the scene view, any idea why?

drowsy flare
broken nest
steep rose
#

Check clipping plane

#

Wait I dont think unity has that, you can always press F to focuse on the object and it will adjust the clipping plane

steep rose
#

Also this is 100% personal preference by the way

#

In my opinion you can do it by putting everything in 1 script but I think you should separate health in it's own script then applying that to everything you want it for, you could do the same for damage if you would like.

drowsy flare
#

Damage is already moved to it's weapon

#

Yeah I think I'll separate it all to different classes

#

I instantiate a new weapon for the enemy when it loots a weapon, so I kind of needed that separate

cosmic island
#

Hello, I am a Unity beginner and I tried makin an Idle Game I thought of myself but I struggle with it a lot. I have a concrete idea of what and how I want to make it with rooms for improvment. Is there anyone intrested in making Idle games here? I have troubles with coding and putting it together, I used to work as a project manager so I am good at organizing, making ideas and creating content. The games are different then the classic Clicker games and I would love to talk about them with anyone who is interested in colabing on this. I just wanna be able to play them since I havent find any idle games like the ones I thought of.

pliant sleet
#

Does it have something to do with my animation that changes the camera's rotation that I can't move my camera on the Y axis ? The controller normally allows the camera to move so

eternal falconBOT
#

:loudspeaker: Collaborating and Job Posting

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

cosmic island
#

new guy here and I am a bit lost 😅

languid spire
eternal falconBOT
#

:teacher: Unity Learn ↗

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

cosmic island
#

I did and I also followed tutorials but I get overwhelmed easily so it was too much for me and I am looking for help because of it

sage abyss
#

Hey.

int[] ints = new int[] { 1, 2 };

ints -= 1; //error

How do I subtract arrays like this?

languid spire
#

for loop

jolly temple
#
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerMovement : MonoBehaviour
{
    public CharacterController controller;

    public float speed = 10f;
    public float gravity = -9.81f;
    public float jumpHeight = 5f;

    public Transform groundCheck;
    public float groundDistance = 0.4f;
    public LayerMask groundMask;

    Vector3 velocity;
    bool isGrounded;

    void Update()
    {
        isGrounded = Physics.CheckSphere(groundCheck.position, groundDistance, groundMask);

        Debug.Log(isGrounded);

        if (isGrounded && velocity.y < 0)
        {
            velocity.y = -2f;
        }

        float x = Input.GetAxis("Horizontal");

        Vector3 move = transform.forward * x * speed;

        if(Input.GetButtonDown("Jump") && isGrounded)
        {
            velocity.y = Mathf.Sqrt(jumpHeight * -2f * gravity);
        }

        velocity.y += gravity * Time.deltaTime;

        controller.Move((velocity + move) * Time.deltaTime);
    }
}
steep rose
#

is the ground layermask on the slope?

frank flare
#
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Animations;
using UnityEngine.InputSystem;

public class GrabItems : MonoBehaviour
{
    bool isHolding = false;
    public GameObject objectHolding;
    public Vector3 posToHoldAnObject = new Vector3(0, 0, 10);
    Camera cam;

    void Awake()
    {
        cam = GetComponent<Camera>();
    }

    void FixedUpdate()
    {
        if (Mouse.current.leftButton.wasPressedThisFrame) {
            Debug.Log("clciked");
            var ray = new Ray (cam.transform.position, cam.transform.forward);


            if (Physics.Raycast(ray, out var hit)) {
                var Object = hit.collider.transform;
                Debug.Log(ray);
                Debug.Log(Object);

                isHolding = !isHolding;
                Debug.Log(isHolding);
                objectHolding = hit.collider.gameObject;
            }

            if (isHolding) {
                objectHolding.transform.position = transform.parent.gameObject.transform.position + posToHoldAnObject;
            }
        }
    }
}

Mouse.current.leftButton.wasPressedThisFrame sucks in fixed update what else should I use? it detects like 20% of the time because it's a fixed update

cosmic dagger
frank flare
#

it detects like 20% to somewhere 30% of the time

steep rose
#

Private Void Update()

#

i would recommend looking at unity documentation for this

#

as well

frank flare
jolly temple
steep rose
steep rose
jolly temple
#

when the character go up here, it can't jump

steep rose
#

can you select the slope and take a picture of the inspector

frank flare
steep rose
#

i understand its an input, why couldnt you use if(input.getkeydown(keycode.iforgetwhatthemouseiscalled))

frank flare
steep rose
frank flare
#

anyways I'll do it through update then ig

steep rose
#

🤔

frank flare
#

idk tbh

spiral oak
steep rose
frank flare
spiral oak
lofty palm
spiral oak
frank flare
#

loosing my time over I don't know what I'm doing

spiral oak
#

do they log an error to console?

lofty palm
#

I get a nullreference exception

languid spire
spiral oak
#

oh lol

lofty palm
#

but they are on the gameobject

steep rose
#

if they are on the parent use the getparentcomponent

lofty palm
#

which is the confusing part

languid spire
steep rose
#

if if you are hitting the parent and the components are in one of the children use getchildcomponent

spiral oak
steep rose
#

my mistake

jolly temple
steep rose
lofty palm
steep rose
#

then go in game and adjust

languid spire
lofty palm
languid spire
#

then debug.log the hit object and prove it

lofty palm
languid spire
cosmic dagger
#

this Facts . . .

jolly temple
spiral oak
#

hey, quick question about Unity UI Toolkit
basically i have a GUI composed of createable and deleteable menus (VisualElements), composed by a Visual Tree (which i show in the image below) and a manipulator
would it be worth it to make an object pool just for these VisualElements?

#

is it expensive to load a visual tree?

steep rose
#

make the distance good enough to go up the slope

#

nothing more

primal trench
#

hey! im not an expert on subclasses,
if i have a class, Item
and a subclass WeaponItem
and a list of items, how would i sort by which items are weaponitems?

languid spire
#

you could sort on the Type of the item

primal trench
steep rose
#

so lower it to just enough to go up the slope

languid spire
steep rose
eternal falconBOT
#

:teacher: Unity Learn ↗

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

jolly temple
#

should I try it?

steep rose
marble hemlock
#

Quick question, Vector3.up, forward, etc refer to the game objects position relative to itself rather to the world?

marble hemlock
#

Ah

rich adder
#

transform would be local

marble hemlock
#

Thank you

drowsy flare
#

Is there a builtin method to check if a state exist in an animator?
Like, I wanna check if "death" exists before tring to play it
gameObject.GetComponent<Animator>().Play("death");

drowsy flare
#

Yeah, I was actually looking at browsing through the animations and use IsName to check if it occured, but thought that there has to be an easier way?

#

Hmm I think you lost me

rich adder
drowsy flare
#

Oooh, thanks

rich adder
#

Animation component afaik was deprecated no ?

rich adder
#

whats stateID though ?

drowsy flare
rich adder
languid spire
marble hemlock
#

Hit Lerp on the beginning scripting pathway and it's purpose is to calculate the point between A and B using percentages?

#

This one didn't have a video so there isn't really a demonstration

rich adder
#

has nothing to do with pathways or anything specific though

#

in this case it helps "smooth" out movement or other values, over time if you modify the ratio, but its not the only use case ofc

languid spire
ionic zephyr
#

Should I create a Dropdata component in which I specify variables such as Drop Chance or the Weapon that is necessary to use in order to obtain this drop or should I just add it to ItemData(even though not all Items are going to be obtained by a certain drop)

rich adder
ionic zephyr
#

Imagine a tree that drops different types of Items which have an Item SO which defines their data, should I include the dropRate and the weapon necessary to collect the item (as an enum) in that SO or is it better to create a separate component to include that information?

plucky radish
#

hi

rich adder
#

i like to have specific components handle their specific tasks

#

for drops I just store the SO in array then pick whatever from there based on loot table for example

ionic zephyr
primal trench
rich adder
languid spire
ionic zephyr
primal trench
#

could u link?

rich adder
#

thats "in the past"

#

item was dropped already, it doesnt need to know about the dropper or any of that

languid spire
ionic zephyr
rich adder
#

@brazen escarp ha nice try scammer

#

bot has outsmarted you

ionic zephyr
rich adder
#

okay yeah that sounds fine

ionic zephyr
#

however, the problem here is that the dropRate, for example, should be included in the OverworldItems to choose what drop to pick but, you are right, that doesn´t make any sense because why should a component like that store that information?

rich adder
#

You could have a dropRate chance or something on it , it might be acceptable on ItemData too

#

or you can store it in a dictionary as well tbh (less clutter but more processing each time to access the dictionary just to read a value)

ionic zephyr
rich adder
#

yes then you should have a component for that, if it has that Drop component then read its data such as dropchance etc

#

even item data can have it tbh. You can just check if its Null for example , that can mean the item is not Droppable / obtainable that way

tepid idol
#

You want the whole folder?

ionic zephyr
ionic zephyr
#

thanks for your attention

rich adder
muted wadi
#

does anyone here have experience with coding a tank controller? I need it to react with uneven and slanted surfaces without using a whole separate system for treads joints. I was wondering if anyone knows if that is achievable just using the normals of the slanted surfaces

rich adder
frank flare
#
    void FixedUpdate()
    {
        if (isHolding) {
            objectHolding.transform.position = transform.parent.gameObject.transform.position + posToHoldAnObject;
        }
    }
}

how do I make a player hold an object? objectholding is object that is being holded and the script is attached to MainCamera. This one doesn't do what I want when I rotate my camera it holds an object in the wrong direction

#

I don't want to parent an object that I hold to maincamera cus it will noclip then

#

currently I'm preparing to add rigidbody3d

rich adder
frank flare
rich adder
#

if you are using rigidbody then use the velocity or movePosition

#

then simply do heldpos-rigidbody.position

#

apply direction accordingly to vel

muted wadi
# rich adder wdym by "react with uneven and slanted surfaces "

its kind of hard to see but the terrain here is very rough and jagged. If i use a box collider then it quickly gets out of hand and starts bouncing when moving into slanted edges. This could be fixed by using treads with joints, but coding a system like that takes far too long and is overkill imo.

rich adder
#

then use Project dir or something

muted wadi
frank flare
languid spire
#

why not use wheel colliders like most tank controllers?

frank flare
#

how can I hold in the right direction?

rich adder
frank flare
muted wadi
rich adder
#

freeze the rotation if you dont want it to spin

languid spire
steep rose
#

the tread is there for grip

muted wadi
#

damn

steep rose
#

so yes

frank flare
rich adder
#

regardless of rigidbody

frank flare
languid spire
rich adder
#

objectHolding.transform.MoveTowards( objectHolding.position, objectHolder.position, speed *time.deltaTime)

scarlet hawk
#

Is there a way to deactive the gameobject and when it turns on again it gets reassigned again? or do i have to do the manipulation there manually too?

rich adder
#

reassigned to what exactly tho

carmine lagoon
#

@rich adder may I ask a question? i did this already

CS0120 An object reference is required for the non-static field, method, or property

i kinda understand dot notations now but when I try it it gives me this error

(reference question to the reply)

rich adder
scarlet hawk
# rich adder OnEnable

i have a class who holds reference to the player, when the player gets deactivated it turns null but then when it gets turned on again it stays null

steep rose
#

also look up the error code

#

that will usually tell you

carmine lagoon
#

ohhh so I need to make an instance within the class first then call it out

rich adder
rich adder
#

reference that

#

MB shouldn't be created inside other classes

scarlet hawk
#

and it turns null

rich adder
#

huh..afaik making a gameobject inactive should not break references

#

is the player a new player or something

languid spire
scarlet hawk
scarlet hawk
languid spire
#

then something else must be setting it to null. SetActive will not do that

rich adder
#

check for any GetComponent too

carmine lagoon
rich adder
languid spire
rich adder
#

on that note, the instance in the case of unity MB is when they are on a gameobject

rich adder
#

thats what I said earlier when you are trying to Use the class and not the instance

carmine lagoon
#

okay okayyy

rich adder
#

the class is just a blueprint to an object

#

if its not monobehaviour derived, then its created with new()

#

monobehaviours instances are created by unity though when you run the game

#

so to recap, the script (component) thats on a gameobject is the Instance

#

so when you see Null Reference bla bla "Not set to instance of an object"

#

it doesnt know which instance you want because its not assigned

carmine lagoon
#

so for example with the one that I did. I would make another instance for Target? since just declaring it would be using the turret class directly?

rich adder
#

the script is already on a gameobject

#

that is for example the actual instance

#

click it it leads you to the gameobject

rocky canyon
#

if Target.cs is a class
you could declare it like
Target myTarget;
then u just assign which instance u want that reference to refer to
myTarget = GetComponent<Target>(); or drag and drop a gameobject that has a Target script attached to it into the slot

rich adder
#

when you do [SerializeField] Turret turret
u drag it into the slot
and the code just does
turret.target

rocky canyon
#

for a public Target myTarget for example

#

not reference the actual Apple class.. just an instance of it that exists on the Apple gameObject

carmine lagoon
rocky canyon
#

well ur Target is actually a Transform

#

all gameobjects have a transform

carmine lagoon
rocky canyon
#

ahh i see

carmine lagoon
rocky canyon
#

ya, but u can still access target from Turret

#

Turret yourTurret; <-- if this is assigned to a turret
then it'll have a Target
but currently its private.. so u couldn't access it outside hte class anyway

#

oh u have a public one too

#

my bad im just waking up 😅

carmine lagoon
rocky canyon
#

👍 thnks im lookin for the original quesiton too

rocky canyon
#

well theres this.. if ur trying to access target before ur assigning it the target = hits part it'll be null

rocky canyon
#

could wrap ur code thats using it in a conditional

#

if(target != null) -> run the code

#

else ignore it until its not

#

the code isnt loading btw

carmine lagoon
#

kinda get it now

rocky canyon
#

so im just guessing

#

ohh there it goes!

rocky canyon
#

yea its here.. like navarone was saying.. thast the actual class Turret

carmine lagoon
#

yeaaa

rocky canyon
#

you need to access an instance to it intsead

carmine lagoon
#

so i'll make like target new target?

rich adder
#

no

#

make the reference w variable , and use the variable name

rocky canyon
#
[SerializedField] Turret myTurret;

void Start(){
target = myTurret.target;
}
#

this target = myTurret's target

carmine lagoon
#

ohh so doing it directly would mess up the code that's why when I call Turret.Target in the other game object, it wont work

rocky canyon
#

you cant new() a monobehaviour i dont think

rich adder
#

only difference access the Target uppercase

rich adder
#

unless Target was static (ie it belong to the class itself) you need an instance

#

Turret (uppercase ) is just a class, a blueprint

rocky canyon
#

"This will be this type of variable"

rich adder
#

I need this blueprint to do X and Y.
Which instance(spawned object) of this blueprint do you want?

rocky canyon
#

^ yea think of it like that

#

its like when you use gameObject.transform <-- this will get the transform from the GameObject your script is on.
BUT if u say GameObject.transform its gonna error out just like ur doing now

#

b/c GameObject is a type.. it isn't an actual instance of a gameobject.. which gameObject is

#

same thing w/ ur Turret.. and theTurretReference

rich adder
#

to add to the confusion, if the field/method/prop is Static then it does indeed belong to the class itself

#

such as static methods like GameObject.Find etc.

rocky canyon
#

hell ya! lolo

#

🤫 statics are sleeping.. lets not wake them yet

rich adder
#

damm you static :shakefist

rocky canyon
#

i think i abuse statics

#

im pretty sure i do

rich adder
#

they are very handy when used properly for sure

carmine lagoon
rich adder
#

yes

rocky canyon
#

yes!! EXACTLY

carmine lagoon
#

that's why we made new variables

rocky canyon
#

YES!! exactly

rich adder
#

but in this case Unity makes the instance

#

Vector3 is also a struct(similiar to class) but because its not a component but a regular c# object we use new()

rocky canyon
#

you cook the meal using the recipe.. and eat that instead

rich adder
#

haha good anaolgy , now I'm hungry 😋

rocky canyon
#

steve about to drop some truth bombs

languid spire
carmine lagoon
rich adder
rocky canyon
rich adder
#

Steve surpised you didn't build a personal Rosey to cook

rocky canyon
languid spire
rocky canyon
#

my wife just knows how to use my card to order out

#

I just cant.. lmfao! too early to laugh this hard

rich adder
#

id kick mine out cause I'm the one who makes the fire food lol

frank flare
#

is and operator & or &&?

languid spire
rocky canyon
#

&& is a if conditional. not sure what & is.. i forget

summer stump
rocky canyon
#

& is a bitty bit thing

rich adder
#

the & confusing cause of its usage in bit operations

rocky canyon
#

yea bits i was right! 🙂

#
if (conditionA && conditionB)
{
    // This block will not execute because conditionA is false,
    // so conditionB is never evaluated.
}```
```cs
if (conditionA & conditionB)
{
    // This block will not execute because the overall result is false,
    // but both conditionA and conditionB are evaluated.
}```
carmine lagoon
rich adder
#

we dont know what that means

#

we dont know your game

rocky canyon
#

so Debug.Log(target); prints what?

#

nothing

carmine lagoon
rocky canyon
#

then target hasnt been assigned to anything in the turret when Start() goes off

#

i just put that line in Start() as an example

#

not sure it makes sense in ur context

carmine lagoon
#

wait i think i get it now

#

wait let me try it

rocky canyon
#

if Turret was null you'd get an error when trying to access it

#

but if target was null.. no error b/c ur just assigning a value to null.. nothing technically wrong w/ that

#

so its not a legit error

carmine lagoon
#

yaaay

#

i got it

rocky canyon
#

🥳 whoopwhoop

#

congrats 🎉

carmine lagoon
#

so it just reference the turret during the first frame

#

that's why it didnt work

#

so anything that needs update should be in update

#

makes sense

rich adder
#

only if its local

rocky canyon
#

well, yes and no

rich adder
#

did you only make a local variable?

#

if you assign a field it should persist through the whole class not just within 1 method

rocky canyon
#

show ur newest versions of ur scripts (after u get done tinkering)

carmine lagoon
#

okayyy

rich adder
#

you dont need to assign it every frame

carmine lagoon
rocky canyon
#

its usually ^ yea not advised to do things every frame unless u need to..

rich adder
rocky canyon
#

now if ur Turrets target will be changing thruout the game..

rich adder
#

its correct but not sure why you moved it from start

rocky canyon
#

then i guess it makes sense sorta

carmine lagoon
rich adder
#

once you get a reference type, its the same object

carmine lagoon
#

that's the idea

rocky canyon
#

his Turret script needs time to assign one i think

carmine lagoon
#

yeaa

rocky canyon
#

and if its ever-changing.. then u need to update it

carmine lagoon
#

yeaaa

rocky canyon
#

Events would be how iwould do that..

rich adder
#

oh right target is assigned Update in other script

rocky canyon
#

but not gonna recommend events to them just yet

rich adder
#

yes event would be good

rocky canyon
#

or ur Turret script could (Loop thru all ur antiviruslvl1 scripts) and assign the target once it has it

rich adder
#

btw you can just write this as
public Transform Target => target;
no need to have a public setter on this if you have a backing field setting it

rocky canyon
#

(that way its only being assigned that once for every target change)

carmine lagoon
languid spire
#

tbh you might as well call FindTarget from the property rather than doimg it in Update

carmine lagoon
rich adder
#

yeah you could technically just put it when you get

languid spire
#

that is, after all, the whole point of properties, to execute extra code

rich adder
#

"field with benefits" lol

languid spire
#

absolutely

carmine lagoon
#

I like the idea of how y'all tutoring me like a kid hehe, I learn more with actual people teaching me, quite interactive ig?

#

really thankful for yall advices and teachings

languid spire
carmine lagoon
languid spire
#

It's gotta be fun, I've been doing this for a long, long time and I still find it fun

rocky canyon
#

then for-loop thru them and set the target any time the Master (ur turret) target has changed

#

buts its all relative.. and how you need things to work.. but i feel like ur catching on regardless 👍

celest isle
#

hi, im following a very basic tutorial on c# and i have to write the very basic command Console.Windowheight, but when i do i get this error: This call site is reachable on all platforms. 'Console.WindowHeight.set' is only supported on: 'windows'.
does anyone know a solution?

carmine lagoon
#

without needing to assign them one by one

rocky canyon
#

well in my example my Master which is ur Turret (it has the main Target) knows about all the other scripts that need a target

stone pilot
#

Hello, I was just wondering how can I find good sounds for my game , every time I start polishing my game I don't know how to find sounds

rich adder
rocky canyon
#

so when it gets assigned it runs a loop thru all the other scripts calling

languid spire
celest isle
celest isle
#

welp onto another server

rich adder
eternal falconBOT
rocky canyon
#

it just passing in the transform.. and then it assigns its own target

celest isle
stone pilot
#

Hello, I was just wondering how can I find good sounds for my game , every time I start polishing my game I don't know how to find sounds

rocky canyon
#

sounds are always almost what u need..but never exact

languid spire
#

Gotta love the way that any serious game dev puts a great ammount of effort into sounds for their games and then the first thing most game players do is turn the audio off

rocky canyon
#

(╯°□°)╯︵ ┻━┻

rocky canyon
#

nuance

languid spire
#

absolutely, very, very important for atmosphere

carmine lagoon
languid spire
wide jolt
#

Was wondering if anyone could help with the jittering I see when using velocity tracking? I'm sure it's a setting I'm using but I don't know which
(Brand new to u ity and programming in general)

sweet sierra
wide jolt
autumn lintel
#

Does anyone know what this error entails: GameObject (named 'Euporia') references runtime script in scene file. Fixing! UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

#

The script on the Euporia gameobject is "missing" apprently

tepid idol
#

that's the only thing in the console

rocky canyon
#

read them.. you know ur camera system more than we do.. (are any of these values that say are unused have anything to deal w/ ur camera)

#

just w/ an educated guess imma say that Building.cs doesn't have anything to do w/ the camera

wide jolt
#

anyone know whats going on with the velocity tracking? im sure theres a super simple fix i am just not seeing it....
I want my object to track my hand accurately and collide wth objects
(i want my hands to collide with objects too but that seems harder...)

tepid idol
#

Here's the camera controller

#

I've been trying to figure this out for days and I just can't seem to figure it out

#

Inputs are also set up in Unity

#

I did follow a youtube tutorial about it and his seemed to work but not sure what I did differently. I don't think I did anything differently, I've watched the tutorial multiple times to confirm we wrote the same thing

iron steeple
#

how do i call variable across scripts can yall give me an example?

steep rose
#

just like that this

iron steeple
#

my puny brain cant handle it can i get more simplier one i barely understand english

rich adder
raw token
#

Awak

rich adder
#

opp

raw token
#

The forefathers of the Ewok? 🤔

rich adder
#

oh god lets forget that even existed

raw token
#

It's growing on me

rich adder
#

Awak is a cool char name

#

the Awakis

iron steeple
#
public class test : MonoBehaviour
{
    bool Isgrounded;
    CharacterController CC;
    float verticalspeed;
    float gravity = 9.81f;
    float height = 5;
]

public class GetTestValue : MonoBehaviour
{
    int test verticalspeed;

    public void Start()
    {
      ?????
    }
}
#

i dont get it until this far

raw token
rich adder
#

aka saying "I want something from This script"

iron steeple
rich adder
iron steeple
#

thats what im doing for the pass 15 minutes

rich adder
#

you only "call" methods

#

I showed you how to make a reference

iron steeple
rich adder
umbral rock
#

can someone explain how the viewDir is calculated? i dont rly understand why he uses player.position - ...

rich adder
#

also they need to be public

queen adder
frosty hound
iron steeple
#
public class test : MonoBehaviour
{
    public class GetSpeed()
    {
       float verticalspeed;
    }
    bool Isgrounded;
    CharacterController CC;
    float verticalspeed;
    float gravity = 9.81f;
    float height = 5;
]

public class GetTestValue : MonoBehaviour
{
    int test verticalspeed;

    public void Start()
    {
        verticalspeed.GetSpeed();
    }
}

Like this?

rich adder
#

subtracting two positions will give you direction with magnitude

iron steeple
raw token
#

The reference stuff is just C#

iron steeple
#

wtf

rich adder
#

wait yes

#

you just have piss poor variable names

#

it confused me

iron steeple
umbral rock
rich adder
#

actualy no the more i look it and the worse it gets @iron steeple

#

this is gberish
public class GetSpeed()
{
float verticalspeed;
}

#

compile error

frosty hound
rich adder
#

they are particularly important in a game not much to do with being a good coder tbh

iron steeple
#

now im confused now

summer stump
rocky canyon
#

its more important to know what a thing does than how it does

umbral rock
rocky canyon
#

once u get more advanced its more important to know why it does rather than how it does

rich adder
queen adder
umbral rock
rocky canyon
#

huh?

rich adder
#

vector math has nothing to do with writing code by yourself

iron steeple
rich adder
#

its specific to game development not coding, things that move in a 2d/3d space etc.

summer stump
raw token
# tepid idol It doesn't move at all

Probably unrelated, but you have a bunch of weird namespace imports that I don't think you're using

  using System.Runtime.CompilerServices;
  using Unity.VisualScripting;
  using UnityEditor.Experimental.GraphView;
  using Unity.VisualScripting.Dependencies.Sqlite;

That said, what is the Controls type?

iron steeple
summer stump
rocky canyon
#

alot of good developers still dont know how unity works..

summer stump
#

It was just not understanding c# scopes and method returns

rich adder
#

what you wrote is literally syntax error

#

it wouldnt even compile

queen adder
rocky canyon
#

knowing the Unity api is just icing on the cake..

rich adder
#

once you learn how read 1 api you can pretty much use many other libraries besides unity

iron steeple
#

okay how is that fix my problem with the one currently im facing its like your learning test blindly that has extra questions

rocky canyon
#

a lot of the times i go diggin in Unity's specific classes and methods i feel underwhelmed lol..
"yup, thats what i expected to see" But always expecting it to be some magic sorcery i cant understand lol

iron steeple
#

i dont want to start a fight but

summer stump
rich adder
summer stump
#

If you wrote the same thing OUTSIDE of unity, it would also be wrong

iron steeple
rich adder
#

not at all

rocky canyon
#

unity works off of standard c#.. it just has alot of helper functions along the way.. (thats the way i think of it)..
when i have a coding issue.. its b/c of broken c# code.. not broken unity code

rich adder
#

ontop of the other ones.. this would be another compile error

#

if you knew c# as you claim you'd know why this is wrong

iron steeple
# rich adder

since public void pet() can be deriavie from making method so i made a variable inside of that so the cat.Pet() would transfer the variable over script

polar acorn
queen adder
rich adder
iron steeple
summer stump
rich adder
iron steeple
rocky canyon
polar acorn
rich adder
polar acorn
#

There's nothing in there that says public class FunctionName()

iron steeple
summer stump
iron steeple
rocky canyon
#

i think ur taking offense to a suggestion thats just meant to be helpful, more than anything

summer stump
#

I have almost a decade experience with c# and I just took another refresher

rich adder
#

even if you put void it still logically makes no sense..

iron steeple
#

weird tho i just did a c# refresher like 4 days ago

rich adder
#

its just a local variable now sitting there..

rich adder
modest dust
raw token
iron steeple
summer stump
#

int speed;
This is a declaration. You are creating an int at value 0. It only exists in that method and then you throw it away
GetSpeed literally does nothing at all

Does that make sense?

iron steeple
rich adder
modest dust
iron steeple
bitter tapir
#

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

public class las : MonoBehaviour
{
AudioSource audio66;
// Start is called before the first frame update
void Start()
{
audio66 = GetComponent<AudioSource>();

    StartCoroutine(las_dzwiek_start());
    Debug.Log("1");
    
}

// Update is called once per frame
void Update()
{
    
}
private IEnumerator las_dzwiek_start()
{
    yield return new WaitForSeconds(3f);
    
    Debug.Log("2");
    yield return new WaitForSeconds(1f);
    Destroy(gameObject);
}

}
why delug.log("2"); doest work?

modest dust
summer stump
#

We are trying to help, but you just keep arguing that it is not a c# issue when it is
Please just let us help you

rich adder
iron steeple
summer stump
rich adder
#

i sent you the page, you said it was hard, I made a code example as you asked. what more do you want

summer stump
summer stump
iron steeple
summer stump
#

If you just want to complain and argue, then leave and calm down

grave bluff
iron steeple
summer stump
steel stirrup
#

You're expected to put in some minimal level of effort to educate yourself as well

summer stump
#

You keep ignoring it just to argue

just STOP ARGUING lol

I am done though.
Not gonna explain it again

iron steeple
grave bluff
#

nvm ignore what I said, you posted the pic of it right as I sent my message

iron steeple
steel stirrup
#

Unity editor and your IDE both give you that information

#

nice big red underlines

iron steeple
summer stump
quiet crater
#

Hi All , I have a trouble with this :

 public class A 
 public class AA : A

 public class BAbstract < TA > where TA : A , new( ) 

 public class B  : BAbstract < A > 
 public class BB : BAbstract < AA >

 public class C < TB > where BAbstract< A > 

new C < B > works new C < BB > not 😦

I don't understand why. Someone can explain me ? 🙏

bitter tapir
#

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

public class las : MonoBehaviour
{
AudioSource audio66;
// Start is called before the first frame update
void Start()
{
audio66 = GetComponent<AudioSource>();

    StartCoroutine(las_dzwiek_start());
    Debug.Log("1");

}

// Update is called once per frame
void Update()
{

}
private IEnumerator las_dzwiek_start()
{
    yield return new WaitForSeconds(3f);

    Debug.Log("2");
    yield return new WaitForSeconds(1f);
    Destroy(gameObject);
}

}
why delug.log("2"); doest work?

grave bluff
modest dust
eternal falconBOT
rich adder
#

im no expert but you can probably use a common interface here ? or baseclass?

quiet crater
frigid schooner
#

can you teach me step by step?

steel stirrup
steel stirrup
#

(not to mention if you mess up while coding it there's a non-zero chance of you deleting a chunk of your unity project)

bitter tapir
#

it work

rich adder
#

why would someone even do this..

steel stirrup
#

streamerbait

rich adder
#

just delete the savefile / progress. Just seems kinda stupid if you ask me..

bitter tapir
# bitter tapir it work
using System.Collections.Generic;
using UnityEngine;

public class las : MonoBehaviour
{
    AudioSource audio66;
    // Start is called before the first frame update
    void Start()
    {
        audio66 = GetComponent<AudioSource>();
        
        
        StartCoroutine(las_dzwiek_start());
        Debug.Log("1");
        
    }

    // Update is called once per frame
    void Update()
    {
        
    }
    private IEnumerator las_dzwiek_start()
    {
        Debug.Log("Eapple is my love");
        yield return new WaitForSeconds(3f);
        
        Debug.Log("2");
        yield return new WaitForSeconds(1f);
        Destroy(gameObject);
    }
}
rich adder
#

very inconvenient to the player..

steel stirrup
#

It's idiotic, but definitely a thing

#

There was a russian roulette game that popularized the concept awhile ago

rich adder
#

crazy..ima take it to the ultimate level and just make it so you can only install it once per pc. I had this concept before unity changed their per-install to uniques

#

these devlogs are brain rot.. no wonder some think making a game is just "lulz i paste from stackoverflow until it works"

steel stirrup
quiet crater
bitter tapir
rich adder
queen adder
rich adder
#

or are you destroying / disabling the object

bitter tapir
bitter tapir
rich adder
#

oh wait ur just trying to destroy it?

#

just use the parameter inside the Destroy, it has a float for timer

bitter tapir
steel stirrup
#

Your main issue is going to be it makes level design very """interesting"""

bitter tapir
queen adder
steel stirrup
#

just rotate the sprite

bitter tapir
steel stirrup
#

if you want to get fancy, use a rendertexture of whatever is behind the character at the time and just arrange them under a parent transform then rotate the parent transform such that you get that effect

rich adder
#

if it printed the log in Start its clear is working

bitter tapir
#

WHYYYYYYYYYYYY

rich adder
#

like i said, only thing that can coroutine is stopped without running stopCoroutine, TimeScale is not above 0, object gets disabled at some point, or destroyed

#

idk if Im missing something else

polar acorn
# bitter tapir look

If the 2 never logs, then either:

  1. The object is destroyed or deactivated before 3 seconds are up
  2. You are modifying Time.timeScale somewhere
rich adder
#

How do I know that? the code thats running is saying otherwise

rich adder
storm heath
#

Hello brothers. I am new in programming. I need help.

bitter tapir
# rich adder start printing some logs maybe. `OnDisable() => Debug.Log("Disabled");` `Update...
using System.Collections.Generic;
using UnityEngine;

public class las : MonoBehaviour
{
    AudioSource audio66;
    // Start is called before the first frame update
    void Start()
    {
        audio66 = GetComponent<AudioSource>();
        
        
        StartCoroutine(las_dzwiek_start());
        Debug.Log("1");
        
    }

    // Update is called once per frame
    void Update()
    {
        
        Debug.Log("Timescale: " + Time.timeScale);

    }
    private IEnumerator las_dzwiek_start()
    {
        Debug.Log("Eapple is my love");
        yield return new WaitForSeconds(3f);
        
        Debug.Log("2");
        yield return new WaitForSeconds(10f);
        audio66.Stop();
    }
    void OnDisable()
    {
        Debug.Log("Disabled");
    }

}
rich adder
#

oh nvm that disabled is from stopping play..

storm heath
#

Brothers, Was anyone see my mesegasse? I need help!!!!!!!!!!!

rich adder
raw token
rich adder
#

saying " I have a problem" is redundant in a help channel tbh

bitter tapir
storm heath
rich adder
#

nice lol was going to send the line same, but forgot to hit send

willow scroll
languid spire
eternal falconBOT
#

:teacher: Unity Learn ↗

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

raw token
quiet crater
storm heath
#

Thanks

rich adder
#

yes that Disabled got called when you stopped the game thats why its last
When a scene gets closed / game stops the order is Disabled . Then OnDestroy runs

#

if object was disabled it would stop printing Update as well

willow scroll
quiet crater
tepid idol
# raw token Probably unrelated, but you have a bunch of weird namespace imports that I don't...

I'm still pretty new so this is what I was following: https://youtu.be/kaU11fqe5yE?si=wcv5JT_soMJis-7L

In this video tutorial series I will make a massively multiplayer online real-time strategy (MMORTS) game like clash of clans. I will be using a TCP networking solution that I have already published and also use MySQL database to store players data.

Discord:
https://discord.gg/FWwDgKjcKQ

GitHub Links:
https://github.com/developers-hub-org/unit...

▶ Play video
raw token
steel shell
#

im using this function each frame to detect if my player character is grounded but it is returning true a few frames (sometimes 1 or 2 frames but other times it takes a little longer) after jumping and I can't find why. the player is a capsule object with scale 1.

#

I'm using this to set the vertical speed to 0 if the player is on the ground

rich adder
steel shell
#

yes

rich adder
#

since you're not using layers its more than likely its hitting itself (player collider)

steel shell
#

ahhh that makes sense

rich adder
#

btw you can shorten this whole thing to just be return Physics.Raycast etc..
the else statement is redundant

languid spire
#

more than likely, it's still within the 1.01 range of the ground and so is considered grounded

steel shell
languid spire
rich adder
steel shell
#

im like 2 player heights off the ground when it happens most of the time

#

so I dont think that is the problem

steel shell
rich adder
#

yea put Player in its own Layer then put a serialized Layermask variable in this script then plug that in Raycast function

#

make sure to then only select Default layer or whatever other things you want to be considered ground

steel shell
#

hahah i will have to look up a tutorial for layers first in that case

rich adder
#

think of them like Tags but better and applied across different usecases

steel shell
#

alright thanks :D

#

although its still weird the ray doesnt detect the player every frame in that case

rich adder
steel shell
#

does this work?

#

ye

rich adder
steel shell
#

what delay?

#

oh wait

rich adder
#

you said there is a slight delay when it goes into grounded

steel shell
#

debug.log

rich adder
#

btw * Time.deltaTime never do this on Mouse Inputs
mouse inputs are already framerate independent

steel shell
#

and then just looking at the console after i stopped the thingy mid jump

steel shell
rich adder
#

you should be able to see on top left corner the realtime value

steel shell
#

alright let me try

#

wait how do i use this?

#

I cant put it in the update but also not outside cuz there is no grounded variable there yet

#

nvm i got it somehow but it doesnt turn on grounded permanently

#

its just 1 frame

#

and then it lets the player drop to the actual ground

#

i forgot to say that earlier my bad

rich adder
#

you should probably not be using Translate to move a character. Why are you not using the built in components like Rigidbody or Character Controller?

#

not saying that is the issue but just curious why moving transforms

steel shell
#

I want to make a counter strike surf clone for which I need some more control over physics and stuff so I thought it would be better to write my own stuff. that said I have no idea what the possibilities are in unity/C# so excuse me if my choices are questionable xD

#

the numbers are the vertical speed (deltatime not applied yet) and the hehehehheh is my code putting it to 0 because it is grounded

tepid idol
tepid idol
steel shell
dire flare
#

Hello guys am about to run wild pls can someone teach me or show me a simple way to shoot in unity without using ray cast method am tired of dropping bombs as bullet pls urgent

frank flare
#

how can I check if an object has a rigidbody in it?

polar acorn
rich adder
frank flare
frank flare
polar acorn
frank flare
#

ok

steel shell
eternal falconBOT
#

:teacher: Unity Learn ↗

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

steel shell
rich adder
#

also it wouldnt hurt for you to print the hit.collider.name would it to confirm what its grounded on?

frank flare
steel shell
steel shell
#

which is a terrain

rich adder
frank flare
polar acorn
dire flare
polar acorn
#

It says what it does

steel shell
#

so for now I can just turn the player collider off and when I need it again when i start working on slopes I will make sure to set up layers and all

rich adder
steel shell
#

thanks for the help though

rich adder
steel shell
#

because that is a lot of work i dont need to be doing yet

frank flare
rich adder
#

if the if statement is true (the component was found)

frank flare
#

yep

rich adder
#

do note this only looks for it on the same object you tell it, it doesnt look on all the objects too (child or parent)

rich adder
#

wait till you readup on ref and have a two way value

dire flare
#

Pls I have done three days now looking for one solution pls can someone teach me how to shoot without using ray cast method

rich adder
#

Instantiate

#

AddForce Impulse, crank that speed. bullet go brrrr

warm raptor
dire flare
#

Show me pls

rich adder
dire flare
#

Do what

rich adder
#

start making bullets

warm raptor
# dire flare Show me pls

if you want here is a the part that "shoot" in my fps:

private void Fire()
    {
        MagAmo -= 1;
        MagAmoText.text = $"{MagAmo}";
        Vector3 shootDirection = ShootPoint.up;
        
        // Ajouter une dispersion aléatoire
        shootDirection.x += Random.Range(-dispersionAngle, dispersionAngle) * Mathf.Deg2Rad;
        shootDirection.y += Random.Range(-dispersionAngle, dispersionAngle) * Mathf.Deg2Rad;

        shootDirection.Normalize();

        Quaternion initialRotation = Quaternion.Euler(0, 0, -90);
        GameObject AmoInstance = Instantiate(AmoPrefab, ShootPoint.position, ShootPoint.rotation * initialRotation);
        Rigidbody AmoRigidbody = AmoInstance.GetComponent<Rigidbody>();
        if (AmoRigidbody != null)
        {
            AmoRigidbody.AddForce((shootDirection)*ShootForce, ForceMode.Impulse);
        }
    }
dire flare
#

I have watch many tutorials and they codes never works with mine

rich adder
#

well maybe it isn't the code?

rich adder
#

skips unecessary GetComponent and null check

dire flare
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
#

follow the pathways

dire flare
#

I need something my brain can peocess

rich adder
#

yeah you have to start from the beginning

warm raptor
slender nymph
raw token
#

Instantiation of a projectile is covered in the first couple of units of the Junior Programmer Pathway

dire flare
rich adder
silk night
#

1.5 years till first job, now about 6 years and I still feel like a beginner 😄

rich adder
#

i literally feel like I know nothing lol

dire flare
rich adder
#

self teaching mostly , lots of times spent on google.

#

its good to take courses such as CompScience to just get a bit more RAW knowledge how everything works , things like big O notation etc

warm raptor
rich adder
dire flare
#

I have less than one year to start working in gaming studio so am not going to fall back

rich adder
#

if you want to start you need to start simple

dire flare
#

I only started 6 month ago

rich adder
#

you're jumping right away into wanting to make bullets guns and stuff you will be overwhelmed

steep rose
#

dont jump in to the deep end, keep it shallow until you can learn to swim

warm raptor
rich adder
#

making a box move on your own without tutorials or googling , just the docs maybe, has a different feel

#

its simple but if you do it all on your own, you get that good dopamine rushh

dire flare
#

But does that mean that I have to have full knowledge of programming c#

frosty hound
#

No

rich adder
#

I dont think anyone here has full knowledge of c#

#

there is soo much , and it changes over time

#

You will know what you need to know to do what you want

dire flare
#

Thanks for the advice bro

#

Open eight gate of death I must learn everything I want to

#

That is my ninja way

rich adder
warm raptor
#

I just had a small question, do the bones work like games-objects, if I want the character's arms to rise and fall following the rotation of the arms in the "FPS" view, can I just apply the rotation to the arm bones or will it not work because of the character's animations?

naive raven
#

Hey guys!

I need some help with coding. I have another script that has a public function named TakeDamage and I referenced it in this new script, but it wont reference it. I'm having some trouble.

Basically what I'm trying to do is make it so when the damage happens, it'll play a random sound.

rich adder
naive raven
#

this is the other scriipt

eternal needle
naive raven
wintry quarry
rich adder
#

but also yeah you're using the class instead of instance

wintry quarry
#

Also you are using the class name instead of the variable yeah

warm raptor
naive raven
wintry quarry
#

Huh?

rich adder
wintry quarry
#

None of your code makes sense currently. You should step back and learn some of the basics of C#

naive raven
#

I have, I'm still a beginner at this

wintry quarry
#

You need to learn more because you haven't got a grasp on the basics of objects, types, variables, and functions

#

It will be hard to do anything without that

warm raptor
serene thorn
#

how do i reference the grip button being pressed on the right/left hand controller with xr interaction toolkit?

rich adder
serene thorn
#

alright

rich adder
#

you can also limit the amount of IK based on angle too, ie less weight on IK component when you're hitting "extreme" bend angles

naive raven
#

I reworked it all into the target script

warm raptor
rich adder
#

no one bends their chest like that lmao

warm raptor
#

maybe it's just the upper back and the neck that has to rotate ?!

rich adder
#

yes the upper back / shoulder area

slender sinew
#

upper back bends at slight amount, neck at slightly larger amount, head at even larger amount (just look up in real life and see how you bend)

naive raven
warm raptor
rich adder
# naive raven yeah it works now

I mean its just a bandaid fix you still need to go over the c# material, you had some pretty obvious syntax error along with some fundamentals lack about references

naive raven
#

i guess so

warm raptor
steep rose
#

much better

rich adder
#

i have to fix my hand placement on weapon though lol IK is a pain to deal with sometimes

#

oops we're in code channel. Back to topic..

sage abyss
#

Thx

warm raptor
rich adder
#

anyway lets keep the channel relevant to code, if you have IK questions best ask them in #🏃┃animation

rotund hull
#

what force would be needed to be added to an object to make the net force of gravity and the addiction force being added 0 in 2d

rich adder
rotund hull
#

i tried it with just 9.81 and the same thing happened

slender sinew
#

well if the forces cancel each other out it would be as if you are in zero gravity, which would mean you retain whatever velocity you have forever

rotund hull
woven kraken
#

I need walking codes pls and running pls

rich adder
rocky canyon
#

okay

slender nymph
rocky canyon
#
// Variables
speed = baseWalkSpeed
runMultiplier = 2.0

// Input check
if IsKeyPressed(RunKey)
    speed = baseWalkSpeed * runMultiplier
else
    speed = baseWalkSpeed

// Movement
MoveCharacter(direction * speed * deltaTime)
raw token
#

That'll be $10

rich adder
rocky canyon
slender nymph
#

that's probably too complicated for them. they need something simpler like this:

private void Update()
{
  if(walk)
    Walk();
  if(run)
    Run();
}
rocky canyon
#

thats fix w/e that is

woven kraken
#

Oh ok

rich adder
rocky canyon
#

but anyway.. you never even told us details. like is it a Character Controller.. is it a rigidbody.. is it first person, is it third person? 2d.. or 3d..
these are things you know.. so use those details and find some tutorials related to exactly what u asked

#

but !learn first for ur own sanity

eternal falconBOT
#

:teacher: Unity Learn ↗

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

rich adder
#

if you want out of the box, use the Unity premade characters in starter assets thinksmart

rocky canyon
#

make something move first -> then turn it into a character

rocky canyon
rich adder
rocky canyon
#

if they're out of the box, production ready they bad..
if they're starter kits.. like a Barebones PC build kit.. to work off of.. then they are sufficient and probably pretty good start

rich adder
#

the third person one tbh is more handy cause it already setups the jump animations n stuff for you

rocky canyon
#

i can't remember if they've changed them to use the new input system or they're still polling w/ input class

rocky canyon
rich adder
#

nah ur thinking of Standard Assets maybe?

#

the Starter Assets always came with the new Input System

rich adder
#

yeah these always came with new input sytem

rocky canyon
#

standard assets are broken for me, have been a while..

frank flare
rocky canyon
#

i have an old archive of them on my system for the cool things like particles and whatnot

rich adder
rocky canyon
#
void ModifyHealth(ref int health, int amount)
{ health += amount; }

int playerHealth = 100;
ModifyHealth(ref playerHealth, -20);```  a good example of **ref**
- output `playerHealth = 80`
no need to return the value *and* reassign it. with ref we can directly modify the og variable
**edit: dang, navarone beat me too it.. **