#πŸ’»β”ƒcode-beginner

1 messages Β· Page 817 of 1

naive pawn
#

is it used on some actual renderer

sour fulcrum
#

Is it used by any renderers

alpine dew
#

yes it's on a mesh

naive pawn
#

your user menu controller isn't rendering the material, is it

alpine dew
#

it shouldn't be

naive pawn
#

it isn't, hence the question

sour fulcrum
#

two things

Have you tried just setting .color?

Have you debug logg the value of the material color before and after you set it?

naive pawn
#

if you modify a score but never put it in the UI it'll never show up - we're basically asking if you've passed it along to the UI

alpine dew
sour fulcrum
alpine dew
#

I see

sour fulcrum
#

Same thing as modifying scriptableobjects, prefabs etc.

queen vale
#

I definitely have more to learn but this worked as I meant to describe

public class Test : MonoBehaviour
{

    int _number;

    private void Start()
    {
        _number = 1;
        int _thing = _number;

        Debug.Log(_number);

        _thing -= 1;
        Debug.Log(_number);
        Debug.Log(_thing);
    }
}
naive pawn
#

conceptually, reference-typed values have an identity, value-typed values do not, hence the difference in behavior here.

alpine dew
#

I swear I looked this up just before getting into it but am I wrong about Awake? Does it not execute even when the object is inactive?

naive pawn
#

it doesn't execute when the object is inactive, yes

alpine dew
#

well therein lies the problem I'm sure

sour fulcrum
#

what does the word awake mean to you πŸ˜›

alpine dew
#

one of these methods I've been trying was the right one

naive pawn
#

ngl i do wish there was like, an OnLoaded thing though

sour fulcrum
#

true

alpine dew
#

well the way the documentation described it, it made it seem like Awake happens "before the game starts" as in like whenever the script instance is first created

#

and I thought that's why OnEnable was its own thing

sour fulcrum
#

Awake only runs once per instance, onenable runs any time it goes from disabled to enabled

naive pawn
#

OnEnable can happen multiple times whereas Awake will only happen once

alpine dew
#

So I most likely just need to run this in a function on an active object

sour fulcrum
#

well no

naive pawn
#

also Awake works on activeInHierarchy whereas OnEnable works on activeInHierarchy && enabled

sour fulcrum
#

You need to run the function period

alpine dew
#

ah right

queen vale
#

πŸ₯² The more I say the less I know

sour fulcrum
#

It be like that

naive pawn
#

Awake works on the gameobject level but OnEnable works on the component level, i guess?

alpine dew
#

I knew something wasn't adding up when I tried to debug log the steps and nothing was output

sour fulcrum
#

Thats why we log asap

alpine dew
#

Thanks you all

rancid tinsel
#

does anyone know why VS isn't throwing a fit over this?

#

it normally does

queen vale
#

if ==

rancid tinsel
#

I know, I'm curious as to why the first screenshot isn't underlined though

#

and why it works and compiles

rancid tinsel
#

AI is saying that means it treats that if as a null check... which makes no sense to me

night raptor
#

oh right, but that evaluates to boolean as all unity objects afaik

#

Let me explain

rancid tinsel
#

I think I get it kind of

#

but I've never seen it as an expression

night raptor
#

it still probably doesn't do what you want

naive pawn
night raptor
#

any assignment in C# also returns the new value. someFloatVariable = 2.0f for example returns 2.0, similarly quest = pinnedQuest returns pinnedQuest which unity evaluates as boolean expression

naive pawn
#

to be pedantic, unity defines that as implicitly convertible to boolean, which c# evaluates

night raptor
#

Probably used the the incorrect terminology, mb

naive pawn
#

in languages with more built-in boolean coersion this is a more common mistake and/or idiom, like in c/c++ or js

rancid tinsel
#

Yeah in hindsight it makes sense, but it's definitely a mistake

#

So if you boil it down, it's basically just "if (pinnedQuest != null)" right?

midnight plover
#

that looks so wrong πŸ˜„

ScriptableObject whatEv = null;

if (whatEv = new ScriptableObject())
    return;
rancid tinsel
naive pawn
#

so it's more like if ((quest = pinnedQuest) != null)

rancid tinsel
#

for the sake of the if statement the quest doesn't matter but yeah important to keep in mind

naive pawn
#

not like it's used much in other languages since it's hard to read lol

errant breach
#

Hello !
Small question about the Invoke, when i put other value as "1" for timeBeforeSpawn, it does not work. Like "Activated()" is never called at all !

Do you have any idea why ? Thank you guys ! The "timeForSpawn" is a parameter

#

And here, only the first 3 are spawned

ivory bobcat
#

Show the logs (uncollapsed)

#

Place a log before invoke and see if it even makes it there

brave token
errant breach
#

Ahah i did

#

im looking on the documentation about "log"

#

But yeah don't hesitate to ping me πŸ‘

#

I understood my error πŸ˜…
I thought that "120" was "120 frame" and so "2 seconds"

#

but it's actually 120 seconds

#

so the error is fixed, thanks πŸ‘

broken bough
#

Hey I need to get some opinions on this character controller, anything to note on this.
using UnityEngine;
using UnityEngine.InputSystem;

public class PlayerController : MonoBehaviour
{
[Tooltip("Forward/back speed (units/sec).")]
public float speed = 1.89f;

[Tooltip("Turn speed (degree/sec).")]
public float rotationSpeed = 89.0f;

private Rigidbody rb;

private void Start ()
{ 
    rb = GetComponent<Rigidbody>();
    if (rb == null) Debug.LogWarning("PlayerController needs a Rigidbody.");
}

private void FixedUpdate()
{
Vector2 moveInput = Vector2.zero;

// Foreward/backward for the player
if (Keyboard.current.wKey.isPressed || Keyboard.current.upArrowKey.isPressed) moveInput.y = 1f;
if (Keyboard.current.sKey.isPressed || Keyboard.current.downArrowKey.isPressed) moveInput.y = -1f;

    // Left/right (rotation) for the player
    if (Keyboard.current.aKey.isPressed || Keyboard.current.leftArrowKey.isPressed) moveInput.x = -1f;
    if (Keyboard.current.dKey.isPressed || Keyboard.current.rightArrowKey.isPressed) moveInput.x = 1f;

    // Move is facing direction for our player
    Vector3 movement = transform.forward * moveInput.y * speed * Time.fixedDeltaTime;
rb.MovePosition(rb.position + movement);

// Y-axis rotation  (invert when going backwards.) For the Y Axis rotation of our player
float turnDirection = moveInput.x;
if (moveInput.y < 0)
    turnDirection = -turnDirection;

float turn = turnDirection * rotationSpeed * Time.fixedDeltaTime;
Quaternion turnRotation = Quaternion.Euler(0f, turn, 0f);
rb.MoveRotation(rb.rotation * turnRotation);
}

}

radiant voidBOT
broken bough
#

That's what I'm trying to do.

midnight plover
#

Clearly you did not. you neither used a paste website nor did you use the ` pattern to paste it here.

broken bough
#

Hold on, I think I did but it just didn't show it.

#

I used one of the sites to do this.

midnight plover
#

then you have to paste the link here, not the code...

broken bough
#

OK I'll send the link

#

I actually tried to follow the instructions of a character controller for my game, and actually tried to write it all down myself.

midnight plover
#

Do you got specific questions about it?

broken bough
#

I'm trying to make a Resident Evil 2 remake-type game. Would there need to be any changes to the character controller for this to happen?

keen dew
#

MovePosition and MoveRotation should only be used with kinematic rigidbodies, which I assume the player is not. It should use forces or set the velocity instead

#

and checking individual keys kinda defeats the point of using the new input system

naive pawn
#

you could use composite axes here to handle the inputs more cleanly yeah

midnight plover
broken bough
naive pawn
midnight plover
naive pawn
#

fair enough

dawn vale
#

Good evening, I need help with a transition. I'm making a small walking simulator game. My question is about the transition between scenes.
In scene 1, the player is in a forest and enters a church (scene 2).
From scene 2, when the player opens the door to exit, he finds himself directly in another forest (scene 3). Is there a way to make the transition between scenes 2 and 3 happen without "teleporting" the player into scene 3? What I mean is, is there a way to load scene 3 IN scene 2 (or vice versa) so that everything looks clean?

naive pawn
#

might be additive scene loading you're after?

wintry quarry
dawn vale
wintry quarry
#

While you're in scene 1 (maybe when you get near the church) you can start asynchronously and addtively loading scene 2.
Once inside, you can async and additively start loading scene 3. You can meanwhile start asynchronously unloading scene 1

#

(assuming the player cannot go back to scene 1)

dawn vale
prisma shard
#

I am officially moving in the direction of getting to advanced C# and wondering if I should stop or not. My current career feels unstable and I think it's time to move on. I find myself liking learning about programming and every 6 hour study session goes by in a breeze and I feel I'm acquiring things fast. But I'm worried that programming will soon be an obsolete skill. Like learning the mechanical engine of a 1940s car. I feel like AI is advancing too fast to really know what industries it will take over and what will be safe. Only best educated guesses like nurses likely being more safe than data analysts. Problem is I have not found one of those "safe" careers that seem interesting yet. Thoughts? Also please don't do cope answers like "Ai still makes script errors, it's safe". It seems like a super short sighted opinion and definitely not something to base a career off of. But also in such modern times, does it even make sense to plan at all......

#

Not sure if this is the right room for the question

hexed terrace
#

If you enjoy it, never stop.
Programming will never go away, but it will continue to evolve. Very few people these days know how to do low level programming.

swift crag
prisma shard
#

If "not yet" is the only counter argument then yea I guess it falls under my definition of a cope answer.

prisma shard
hexed terrace
#

.. yes it is..

naive pawn
hexed terrace
#

I suppose that last bit required too much extra thought to understand.

It used to be that there was only low level programming, then came the next languages and now there are less people who know low level.. programming evolved

real thunder
#

I don't know what "real programming" is but doing things in unity I am just describing the behaviour what I want most of the time instead
I think it's called scripting
That's basically the same as telling LLM what you want isn't it?

#

there was that joke that AI would replace programmers at the point where people who they work for would know what they want

wintry quarry
#

The actual typing of the code part was never the bottleneck in software engineering

#

Well

#

maybe it was in the punchcard days

naive pawn
#

there was a time that our modern "computers" replaced the job of "computers". math skills aren't any less useful today.

prisma shard
naive pawn
#

not sure where you're getting that from

real thunder
#

to think of it maybe not, maybe it's now needed for more complex things

hexed terrace
#

maths skills are less valued? wtf? lol

#

unity coding isn't scripting either btw

real thunder
#

by needed and valued I mean money you get from just doing that

naive pawn
#

you still get money doing math

hexed terrace
#

I'll go tell my account he's charging too much

real thunder
naive pawn
#

lol no

solar hill
#

U mean a calculator?

real thunder
#

like that

naive pawn
#

thinking is faster than writing and reading into a physical device

hexed terrace
#

The abacus really gutted the maths industry

solar hill
#

I was about to say lol

#

The abacus has been around for milenia

real thunder
#

there is also that thing that
accounting apps

hexed terrace
#

and see how that destroyed accounting, definitely a dead industry these days!

polar acorn
naive pawn
#

the point is problem solving, not just raw numbers

real thunder
naive pawn
#

calculator can't save you if you can't even figure out which numbers to use

real thunder
#

I am saying that it's "less valued" not like obsolete

naive pawn
#

and we're telling you it isn't

#

maybe you value it less shrugsinjapanese

polar acorn
#

You're going to need strong mber theory. The ability to fully internalize spatial geometry. Intuit units and conversions, come up with elegant equations to solve practical problems

real thunder
#

you get less money out of same math? I assume that

naive pawn
#

that comparison doesn't really make sense

polar acorn
#

Math is not solving equations.

#

You're on a computer. The device literally named for doing these things

real thunder
#

there is a good chance we talk about different things

polar acorn
#

Game development is going to require a lot of high-level mathematical concepts

#

the kinds where the test says "You can use a calculator, computer, and open-book" and then you end up using none of them because they literally do not help you solve the problems

real thunder
#

like if you could get money from doing annoying job of calculating stuff
less valued now because you can use a device now you should learn something else, more
that still wrong?

errant breach
#

Hello, so i have a very weird issue that suddenly, some prefab of mine seems to be very stretched. I have to put the "scale" value to "0.02 1 1" to fix it but until now everything only ad (1, 1, 1), the root, the folder, the subfolder...

So that's new. Is this a common issue ? And do you know how i can fix it please ? Thanks !

⚠️ NOTHING and i've verified inside the "OrangeDragon" folder have a different scale from "(1, 1, 1)"

swift crag
#

Check its parent objects!

#

your 'lossy scale' is the product of your own scale, plus the scales (and rotations) of all of your parents

polar acorn
swift crag
#

Notably, if you dragged this prefab directly into the hierarchy, its local scale will be untouched (so it'll stay at [1,1,1])

wintry quarry
swift crag
#

it won't rescale itself, even if its parent has some wacky scale

errant breach
swift crag
#

I try to avoid parenting objects to anything with a non-uniform scale

#

It causes headaches

#

So instead I might do this

#
  • Checkpoint
    • Trigger (non uniform scale)
    • Whatever (has a renderer on it)
swift crag
#

it'll skew and deform

real thunder
#

now people do more high level calculations where low level stuff is obsolete, something like that I am trying to say

#

those folks with slide rules

polar acorn
# real thunder wdym there were people doing that?

We've had devices that can handle the rote computation of tasks for a very long time. "Computer" used to be a job rather than a device, and was usually done by low-skill laborers because it was just plugging numbers into devices that did math that were a lot more annoying to use, but just as effective.

real thunder
mental raptor
#

Idk if i am dumb but i am trying to make the cam follow a cube right, Its giving me this error. Code aswell

wintry quarry
#

like it says

wintry quarry
mental raptor
#

Yes

wintry quarry
#

so open it for the object with your script on it

#

and assign the player variable there

mental raptor
wintry quarry
#

You already have the script on your camera, right?

mental raptor
#

sorry i am really new

wintry quarry
#

so select your camera

#

look at the inspector

#

and assign the player variable there

#

Right now it probably says "None (Transform)"

#

you need to assign the player object in that field so it knows what to follow

mental raptor
#

YTea

#

YO

#

LETS F###ING GO

#

THANK YOU SO MUCH

brave token
#

how do i fix this issue in the essential pathway? it was fine till the publishing part

slender nymph
#

this is a code channel

rancid tinsel
#

!ide

radiant voidBOT
rancid tinsel
#

@dense basin

slender nymph
#

inb4 they tel you to shut up because that's what they were telling everyone who was attempting to help with that yesterday
also they were muted earlier

rancid tinsel
#

Crazy what you can do nowadays lol

brave token
rough granite
brave token
#

or am i missing something

naive pawn
#

there's a ping right under the bot message

rough granite
#

they pinged who it was for right under and if you check the persons chat history they had just that problem (ide not being configured)

naive pawn
#

and a lot of times people will also just run bot commands for themselves

rough granite
#

this too

brave token
#

i'm having a problem with opening this one specific door even though it works fine for the other doors

slender nymph
#

use mp4 to embed the video in discord

brave token
#

dang it

slender nymph
#

instead of wiggling your mouse around, you should describe the problem with your words, and share the relevant code correctly

brave token
#

so i use this one script the essential pathway provided me and for some reason, that ONE door won't open

#

even though the trigger box is in the correct place, the script and the box collider is correctly placed

#

no nvm i forgot the animator

#

sorry

uncut kayak
#

Does anyone have any Resources on how to make Tilesets I can interact With?
Like if I press a Button while My Player RigidBody is over a specific Tile set it changes it into something else?

brave token
#

could you be more specific? are you making a 2d or a 3d game? why do you want to add this?

rich adder
brave token
#

finally completed the essential pathway

wintry quarry
rancid tinsel
#

!code

radiant voidBOT
swift crag
#

i tried to do the position math myself for a bit

#

and then i realized that i don't have to!

brave token
#

can someone tell me the best way to learn how to make fps games?

wintry quarry
#

Practice

#

Start with tutorials

#

make sure you understand the concepts and code

brave token
#

yeah but i was asking if you guys have recommended tutorials that i can watch

solar hill
#

!learn

radiant voidBOT
errant breach
#

Hello, im trying to return a list, but it doesn't work. Unity tell me that "Convert Loot into Loot" which i don't really understand..

My goal is to give my enemies a wide variety of possible things to drop on death with each having a % of drop, and return a list that will say "drop all of them !"

Thank for those willing to help

sour fulcrum
#

in the future instead of screenshots share via

#

!code

radiant voidBOT
sour fulcrum
#

these two Type's are not the same

errant breach
#

Ah, it's pretty self explanatory then. Thank you ! Both errors got fixed !

sour fulcrum
#

yes, as the function was expecting to return a list of loot πŸ˜„

errant breach
#

Obviously... I gotta need some sleep πŸ˜…

#

Have a great day/night ! :)

sour fulcrum
#

one second if you dont mind @errant breach

#

What is that return in the first loop intended for?

errant breach
#

That's what im wondering too πŸ˜… does it look like a mistake ?

sour fulcrum
#

It does indeed πŸ˜„
Are you not the one who wrote it? πŸ˜›

errant breach
#

Im actually looking at a tutorial to make a lootTable, but i want my enemies to be able to drop multiple things instead of one (like in the tutorial).
The man in the video told to "add that return if you want to make a list of items to drop" so i did it without actually understanding why xd

#

I know, following tutorials blindly is not the good way to go but.. I gotta learn !

rough granite
errant breach
#

You made me laught anyway πŸ‘

rough granite
#

hmm discord having some problems (forgive me for talking about non code)

errant breach
#

I dont.

#

πŸ’₯πŸ“

rough granite
sour fulcrum
#

Right ok, couple things to say

Firstly, return ends the function (by returning something), as in if that return runs that function is done. this means with that current code your never going to get anything more than 1 loot in that returned list (since you return after adding)

Secondly, that randomly rolled number is being used for every check in your lootList loop, you probably want to roll that per item right?

Thirdly and this isn't a problem or related to problems but just a random tip, in your InstantiateLoot() function, if you have the prefab via a reference to a component (which you do here via your reference to Loot) you can get a reference to the instansiated component directly, eg.


GameObject myInstance = Instansiate(myPrefab);
Loot myLootInstance = myInstance.GetComponent<Loot>();

can just be

Loot myLootInstance = Instansiate(myPrefab);
sharp ridge
#

Hi! So I don't know why but I am trying to make an area in my secene that detects the player and reduces their health but I can't seem to make the area detect collisions. Does anyone know why that could be? 1. First picture is area 2, Second picutre is the player 3. picture is the code

errant breach
#

and i will !

errant breach
grand snow
sharp ridge
#

Yeah, omg, i was breaking my head for like 15 minutes

#

Thankss

grand snow
#

but my comment about design still stands

#

your player health should be read only and you should use a function to apply damage

sharp ridge
#

yeah no fair enough, normally I would do another class that modifies it but I just kind of dont want to do it rn, is for a level design project for class and the programming is not a focus

#

But thank you though

grand snow
#

No your PlayerData class would have the function to modify health

#

It should "own" and manage it

sour fulcrum
#

also thats a unsafe assignment/assumption on the getcomponent, you should use a trygetcomponent eg.


if (other.TryGetComponent(out PlayerData result))
{
  playerData = result;
  StartCoroutine();
}
sharp ridge
#

Thanks! I will have it in mind

sour fulcrum
#

and not to hit you with another one but you probably wanna set damageCoroutine to the coroutine your running, right?

sharp ridge
#

oh huh? I kind of forget how coroutines work

sour fulcrum
#

StartCoroutine() returns a Coroutine. your StopDamage() function won't work because you never assign a Coroutine to damageCoroutine

verbal dome
#

I think if(damageCoroutine != null) is not a good way to check if a coroutine is running anyway. It may have ended but that reference would not magically become null

#

If you add a damageCoroutine = null when stopping it then it makes sense

#

(But yeah none of this matters if you never assign to it, as Batby said above)

errant breach
#

Hello, how can i configure VIsual studio Community Edition 2026 so that the compiler show the error ? Thank you !

grand snow
#

!ide

radiant voidBOT
faint agate
#

Hello im going to try explain this best I can.
I have a script on a weapon that drags another object(an orb) along the x and y axis only, the orb has a tag CanDrag.
I added SmoothDamp which delays the drag when I want no delay
The problem im having is the orb is not being dragged smoothly. I dont want smoothdamp since it causes lag and even with it low, theres still bounce or jitter. I want to drag the orb without it bouncing or jittering left and right
I am so lost any help is appreciated!

https://pastecode.dev/s/70pajo0n

faint agate
naive pawn
#

it seems like you are

#

in which case, you should not be modifying the transform, as that causes physics desyncs - you would move with forces instead

faint agate
keen dew
#

I mean if you don't want to use SmoothDamp then just... don't use it? Replace it with Vector3 newPosition = targetPosition; instead

#

Seems like collision checks are done manually so pure physics based movement might be unnecessary

livid anchor
#

Hey folks, I have a question related to fbx usage.
I had a code to create a sort of blinking effect that worked on my capsule by enabling and disabling the mesh renderer, but when I changed the model for a fbx (from kenney), I had the issue that there is no mesh renderers. The prefab is just a transform and I have no idea how I can have the effect I wanted now

errant breach
#

Hello everyone,

I've created a loot system, and im being hit with errors i don't understand.
Here how it work : I give a list of possible drops to an enemy. When he dies, some items get added to a list, and then instantiated (dropped)

But when my enemy dies and play :

GetComponent<LootBag>().InstantiateLoot(transform.position);

Im getting hitted with the error :

ArgumentException: GetComponent requires that the requested component 'Loot' derives from MonoBehaviour or Component or is an interface.

But it IS a MonoBehaviour right ? So, if anyone can help, i would be glad.
Thank you !

#

And, by the way, the print return :

System.Collections.Generic.List 1[Loot]

So i guess i did something wrong..

keen dew
#

!code as text, not screenshots

radiant voidBOT
keen dew
#

but Loot is not MonoBehaviour, it's a ScriptableObject

#

You have to GetComponent the component that has a reference to the loot scriptableobject

errant breach
#

Aah, i see, with something like :

GetComponent<LootBag>().InstantiateLoot(transform.position);
In that case ?

keen dew
#

I don't know what you're trying to do exactly but uh, maybe?

keen dew
#

Well if you literally put that in then yes what did you expect it to do

errant breach
# keen dew I don't know what you're trying to do exactly but uh, maybe?

So essentially, i create a list with all the object that will drop.
it work by giving every ressources a % percentage, and then taking a random value between 0 and 100. If the value is good then the ressource get added to the droplist

And then, i want to instantiate every ressources that got in the list. By taking the "Loot Object" (which is a GameObject)

Buuuut im struggling to πŸ˜…

#

For the code, here is it :

keen dew
#

Ok, but you already instantiate the prefab with Instantiate(droppedItemPrefab) What is the line after that supposed to do?

midnight plover
errant breach
errant breach
midnight plover
errant breach
#

Okay i did understand : in the tutorial, "LootPrefab" is a placeholder for an image, so i don't even need it here

errant breach
midnight plover
errant breach
#

Yes, it is. So as it is a list, i need to get the GameObject inside the scriptable object LootObject...
But now, im blocked because i don't know how to access the right scriptable object in my list.. πŸ˜…...

So here's what i've done. Am i in the good path ?

#

Or maybe i need a GetComponent..

keen dew
#

item is already the ScriptableObject. Then you can access the lootObject field normally: item.lootObject

errant breach
#

I really lack some logic

keen dew
#

what the

#

Instantiate(item.lootObject);

errant breach
#

Yes i added it πŸ˜… just wanted to show how far i went

#

It does work now ! Thank you guys for the help :) !

livid anchor
#

I have a weird issue... I have a serialized field array, with some values in it, but when I start the game, the array becomes empty... I do not empty it in code mind you

midnight plover
livid anchor
#

I resolved my issue. I just deleted the array values in the inspector and re-added them and it works now. Weird

#

Now I have an issue with items in lists that I want to remove but they aren't removed.... issue is I destroy them so it crashes

#
foreach (SegmentController segment in _instanciatedSegments)
{
    segment.transform.position += Vector3.back * Time.deltaTime * _speed;

    if (segment.transform.position.z < _destroyPositionZ)
    {
        _instanciatedSegments.Remove(segment);
        Destroy(segment.gameObject);
        AddNewSegment();
    }
}

Apparently the item I want to remove stays in the list

keen dew
gaunt walrus
midnight plover
livid anchor
#

I think I'll leave it for tomorrow, I've been working for 5 hours straight and I'm hella hungry

brave token
#

!input

radiant voidBOT
# brave token !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.

brave token
#

hey guys, what's System.Collections ?

subtle mulch
#

why?

brave token
#

i'm watching a tutorial for first person movement and his script is using System.Collections and System.Collections.Generic

subtle mulch
#

those are 2 namespaces

brave token
#

he didn't explain it and reddit is useless nowadays

subtle mulch
#

before watching that tutorial i would suggest you watch a C# language tutorial

brave token
#

i know c#

subtle mulch
#

or well a lesson

naive pawn
subtle mulch
#

you don't

#

if you don't know what namespaces are, then you don't know enough of C#

brave token
naive pawn
#

that's the only result on the first page to me. idk why google's been doing that...

#

but yeah that's already a pretty adequate summary right there

brave token
#

i just want to know what purpose does system.collections serve

subtle mulch
#

it's a namespace

#

it contains more classes inside it

naive pawn
subtle mulch
ivory bobcat
brave token
naive pawn
#

or maybe the tutorial was just using a version of unity that had those namespaces in the default script template

#

occam's razor, man

brave token
naive pawn
#

a lot of scripts won't need to use them

errant breach
#

Hello guys ! Im trying to make a Powerup move toward the player...

  • The print print("tentative d'aller vers le joueur"); is executed, so all the condition are meant !
  • But the gameObject doesn't even move at all !

The Powerup has one transform and one gameObject:
MyTransform is placed in the editor. All the prefab have one (i've checked)
PlayerGameObject is took with a playerGameObject = GameObject.FindGameObjectWithTag("Player");
It work, because it found it.

Do someone have an idea of why it doesn't work ? Thank you guys !

keen dew
#

!code πŸ‘ˆ 😠 πŸ‘‡

radiant voidBOT
errant breach
#

Oh alright πŸ˜… sorry

keen dew
#
  1. the parameters are the wrong way around, you're making it move from the player towards its current position
  2. you have to call MoveTowards every frame, not just once
errant breach
keen dew
#

Seeing the whole thing, it is called every frame but it's moving to the wrong direction and too fast. Try this:

myTransform.transform.position = Vector3.MoveTowards(myTransform.position, playerGameObject.transform.position, 3 * Time.deltaTime);
#

also should be Update instead of FixedUpdate

errant breach
#

You find all the problem thank you ! Completly forgot about deltaTime.
And thank for the suggestion, but wont Update.. Update everything at a unreasonnable speed ? That's what i understood..

naive pawn
errant breach
#

But like all the script will be executed a crazy amount of time per second is that right ?

#

Like the script that check if they are dead, ...

keen dew
#

Yes, but computers are also crazy fast so it doesn't matter

#

And you shouldn't be constantly checking if something is dead, only when something happens that might cause them to die (e.g. taking damage)

errant breach
#

I tried but my player can like shoot 10 bullets at the same time so my ennemies where dying 10 times πŸ˜…

keen dew
#

You did it wrong then

errant breach
#

On trigger enter
Remove health
if health < 0
kill (set "Died" to true and run an animation)

πŸ˜…

errant breach
#

But i do trust you when you tell me that i made it worng

austere crypt
#
using Spell.ECS.Component;
using Unity.Burst;
using Unity.Collections;
using Unity.Entities;
using Unity.Mathematics;
using Unity.Transforms;
namespace Spell.ECS.Systems
{
    [BurstCompile]
    public partial struct ProjectileSpawnSystem : ISystem
    {
        public void OnUpdate(ref SystemState state)
        {
            
            var ecbSingleton = SystemAPI.GetSingleton<BeginSimulationEntityCommandBufferSystem.Singleton>();
            var ecb = ecbSingleton.CreateCommandBuffer(state.WorldUnmanaged);
            
            foreach (var (request, entity)
                in SystemAPI.Query<RefRO<ProjectileSpawnRequest>>()
                    .WithEntityAccess())
            {
                Entity projectile = ecb.CreateEntity();

                ecb.AddComponent(projectile, new LocalTransform
                {
                    Position = request.ValueRO.Position,
                    Rotation = quaternion.identity,
                    Scale = 1f
                });
                
                ecb.Instantiate(projectile);
            }
        }
    }
}
using Common.Singleton;
using Spell.ECS.Component;
using Unity.Entities;
using UnityEngine;

namespace Spell.ECS
{
    public class ProjectileManagerECS : RegulatorSingleton<ProjectileManagerECS>
    {

        public EntityManager entityManager;

        protected override void Awake()
        {
            base.Awake();
            this.entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
        }

        public void SpawnProjectile(SpellContext context)
        {
            if (!context.ShouldSpawnProjectile)
                return;
        
            Entity requestEntity = instance.entityManager.CreateEntity(
                typeof(ProjectileSpawnRequest));

            this.entityManager.SetComponentData(requestEntity,
                context.SpawnRequest);
        }
    }
}

why entity not spawning in world?

lofty vault
#

Can I ask about DOTween here? I'm trying to use DoShake but its 1.0 default strength is too much and any strength value under 0.5 doesn't perform the shake at all.

elder canyon
#

Does anybody seem to have the problem of references breaking while doing a checkout from one branch to another branch (GIT) in Unity?

#

I had this issue on some of my projects. I had this experimental branch, where I made so much progress and was curious to see how the old main branch was and I switched. This broke so many references and introduced a lot of bugs, which was hard to solve.

naive pawn
#

references are stored in scene/asset files and their sources are stored in meta files (as a rule of thumb), make sure you're keeping them consistent

#

moving meta files around along with their corresponding assets

elder canyon
#

I also track the metafiles as well

#

This feels very scary. Like moving from the latest commit to a very old commit 10-20 nodes back and breaking it all.

#

Is there a solution for this?
Maybe worktrees could help?

naive pawn
#

well you'd have to first figure out where the mismatches came from

strong wren
#

Are you looking through what changes are happening?

elder canyon
#

I don't think I'm getting mismatches.
The references in Unity seems to break(most of the public fields) and even if I fix I got few errors, which I don't remember.

strong wren
elder canyon
#

I don't understand what ID changes is.

#

I'll open up the project again, and lyk

strong wren
brave token
#

hey, i'm making a movement script but this error pops up while visual studio says there is no problem

NullReferenceException: Object reference not set to an instance of an object
PlayerInput+OnFootActions.Enable () (at Assets/Input/PlayerInput.cs:1310)
InputManager.OnEnable () (at Assets/Scripts/InputManager.cs:28)

tawny sandal
#

why does my sprite go through the floor sometimes and the hitboxes glitch? what can i do to fix it (the hitboxes of the sprite and floor are correct, and yes i tagged to floor if you want to ask that)

frail hawk
#

you should use physics based movement instead of translate

tawny sandal
#

how?

frail hawk
#

that is up to you, you are using linearvelocity there for your jump mechanism. you could use same for moving the player too

tawny sandal
#

okay ill figure it out ig thanks

rich adder
#

you should probably use Awake or OnEnable itself

verbal dome
tawny sandal
#

with this script, i use lineair velocity but when im in the air and i move left or right i basicly dont have any gravity down anymore and i also cant jump when im moving left or right, i also dont want the movement to fade out, just stop instantly

tawny sandal
rich adder
#

actually yea only apply it to X as osmal said

verbal dome
#

The first two linearVelocity = lines change the Y velocity to zero too

verbal dome
tawny sandal
#

what should i do with the y velocity then?

verbal dome
#

Keep the previous y velocity by not touching it

tawny sandal
#

im confused i dont know what to do anymore

verbal dome
#

You have three lines that modify linearVelocity
The first two should be modifying linearVelocityX (left right)
The third one should modifiy linearVelocityY (up down)

#

And instead of Vector2.left you need to use a single float -1 etc.

rich adder
#

2Drigidbody lets you individually change X or Y

tawny sandal
#

i fixed it but i dont want to have to hold w to jump just want to press it, but when i use getkey the glitch appears and when i do getkeydown it doesnt but i have to hold it

frail hawk
#

how does the new code look like?

#

iΒ΄d use addforce for the jumping, it makes most sense

tawny sandal
rich adder
#

you did none of the changes suggested

#

also don't use screenshots for code

tawny sandal
#

wait i changed it what

#

why did it change back

#

i accedently did ctrl z

#

whoops

#

it still phases through the floor and i still drag to the right or left after i released πŸ™

#

not in the air anymore tho

rich adder
#

thats why its often better to just capture GetAxis("Horizontal") and pass that directly to linearVelocityX

#

without GetKey/LeftRight

tawny sandal
#

im basicly back to the start cuz you said getaxis (did raw cuz better for my thing) but it still phases through the ground and i dont know how to fix it:
void Update()
{
float input = Input.GetAxisRaw("Horizontal");
movement.x = input * speed *Time.deltaTime;
transform.Translate(movement);

if (Input.GetKeyDown(KeyCode.W) && jumpcount > 0)
{
    myRigidbody.linearVelocityY = jumpForce;
    jumpcount -= 1;
}

}

rich adder
#

you can just apply it to velocityX

#

without the deltaTime

tawny sandal
#

i mean i dont know how the code looks like

rich adder
tawny sandal
#

i have NO clue on what to do

charred monolith
#

no front

#

:/

tawny sandal
#

what is front

rich adder
charred monolith
rich adder
charred monolith
rich adder
charred monolith
tawny sandal
tawny sandal
polar acorn
charred monolith
tawny sandal
#

also flags things that arent wrong

rich adder
tawny sandal
charred monolith
charred monolith
polar acorn
tawny sandal
#

ok just tell me how to not phase through the ground guys

rich adder
tawny sandal
#

and maybe on how i do learn how to code

charred monolith
polar acorn
# tawny sandal but how do we

Usually, by reading up on the concepts and putting them together in experimental ways instead of just copying code from a tutorial

midnight tree
#

To think and learn as programmer you must practice as programmer, not search easy ways.

rich adder
#

translate is the first thing to not use because it literally teleports and ignores all colliders so thats first

tawny sandal
#

but how do i do it then?

rich adder
#

you don't just get to a solution right away

polar acorn
rich adder
#

as said you use the rigidbody methods.

rich adder
#

that helps nothing

tawny sandal
#

look how happy he is

rich adder
#

cant even see the colliders n shit

tawny sandal
#

ts the floor btw

rich adder
#

why do you have a trigger

#

at all

tawny sandal
#

to reset jumps

rich adder
#

why do you need a trigger on the floor for that..

queen adder
#

Hello! I'm experienced with code but am new to game development, what are some general important steps/information that I need to know starting out to make my first game?

rich adder
#

it will not scale well at all

radiant voidBOT
tawny sandal
rich adder
#

ok then do it your way

#

best of luck

tawny sandal
#

bro just tell me how to not make stuff phase through other stuff

queen adder
#

Is that a command I can run?

tawny sandal
#

like 20 people told me to use somehting else but i dont know how to use the thing

polar acorn
tawny sandal
#

when i double jump there isnt a frame to touch the ground so it just phases right through the ground

lofty vault
rich adder
midnight tree
tawny sandal
queen adder
tawny sandal
#

now it actually functions 100% like i want

#

nav youre a bit annoying

sour fulcrum
#

the multiple people spending an hour talking to you for free clearly are here to help you

#

don't blame them because your struggling

rich adder
#

who wants to hear "tell me how" every fucking sentence

#

shit gets annoying

#

let "AI" solve whatever, don't come back with broken AI code because you have no idea what kind of abomination it generated & 0 understanding on any of it

solar hill
#

AI

#

because critical thinking is now irrelevant

tawny sandal
rich adder
#

sad but true. People want shortcut to knowledge and it does the opposite effect

solar hill
#

their fault

#

not our concern

tawny sandal
rich adder
#

ah just like you learned the method of rigidbody we been saying to use for the past hour?

#

yes a true learner

tawny sandal
#

yes but the final problem yall didnt help

#

and yes i did use ridgidbody for the problem

#

i had to make a new vector 2 and i didnt know how to

#

or atleast thats what worked

sour fulcrum
#

if this is your first day of c# this conversation is the equivilent of learning french by picking up a french book and asking people what a word on a random page means

you need to actually consume educational resources made for beginners to learn what your actually doing

c# is a whole language that you have to learn, like how you learn english and/or your native language as a kid

rich adder
tawny sandal
rich adder
#

do as you wish, no one is stopping you. As I said we don't help with AI code, when you get stuck again cause you have no idea what the code even does then what

solar hill
sour fulcrum
solar hill
#

I think it is

tawny sandal
solar hill
#

But i also highly doubt you suck at learning

#

more so you dont have the patience for it

tawny sandal
#

yes

solar hill
#

thats a seperate issue

tawny sandal
#

i have had zero patience for my whole life

#

it fucking sucks

rich adder
#

why are you doing something that requires tons of patience

#

makes no sense

sour fulcrum
#

you probably can't make games until you resolve that

rich adder
#

you can't shortcut your way to knowledge no matter how much the AI sloppers tell you

tawny sandal
rich adder
#

experience comes with learning and patience at doing it until it works by your own practice

sour fulcrum
#

no one is born with it

solar hill
#

ive never heard of "impatience" as a medical condition

tawny sandal
#

ive never had patience tho

solar hill
#

its entirely enviromental, and something you have to work on yourself

#

patience isnt a quantifiable thing

tawny sandal
#

im not saying its a medical condition

#

i just say ive never really had a lot of it

sour fulcrum
#

you weren't taught to have patience

tawny sandal
#

hows that my fault

solar hill
#

As harsh as it sounds, its a symptom of immaturity

sour fulcrum
#

who said it was

tawny sandal
#

the reason i suck at patience cuz when i was younger i was smart and could learn a lot in 1 day

#

now i cnat

#

and have to get used to it

sour fulcrum
#

you gotta start to teach yourself patience

solar hill
#

You have litterally the perfect place to start

tawny sandal
solar hill
#

you were given the opprotunity to do

tawny sandal
midnight tree
#

🍿

sour fulcrum
solar hill
#

what do you hope to accomplish in game dev without patience

#

you know what

#

i dont much care

tawny sandal
rich adder
#

eh no need to steer this into offtopic land, let them cook , until the next thing breaks then they realize you can't shortcut through experience and knowledge and give up cause "me no patience" yada yada

tawny sandal
#

im having fun and messing around

sour fulcrum
#

all good

#

just mess around elsewhere

tawny sandal
#

coding is fun tho

solar hill
#

Im sure it is, its not fun trying to help people who dont want to be helped

sour fulcrum
#

not our problem

rich adder
#

coding requires patience.
if you have none, especially to learn. Find another place

solar hill
tawny sandal
#

i just dont like it when i dont know how to do something and people say figure it out

solar hill
#

did that really happen

#

or were you just impatient

tawny sandal
#

yes

#

it happened

rich adder
#

too fucking bad you don't like when are told to "learn more" before doing more..

sour fulcrum
rich adder
#

be a grown up about it and actually take the advice where we all been there but we actually put some effort into starting from building basic knowledge

midnight tree
#

Guys, 3 vs 1
Not fair

Can you calm down?

solar hill
#

Thank you for the input Norman

#

is this why you chose to send a popcorn emoji earlier, so you could high horse us?

verbal dome
#

Nah Norman has a point, dogpiling on someone is not cool. Yall are making the same points

solar hill
#

this is a conversation, if anyone doesnt want to be a part of it, they can leave.

tawny sandal
#

i said i did know how to do it btw

rich adder
#

yes exactly.. code is precise

hexed terrace
#

probably best for all to just drop it and move on to something else

rich adder
#

nothing wrong with taking a moment to think what to type if that offends you too bad..

#

butyeah whatever im movin on.

tawny sandal
#

he doesnt know how

sour fulcrum
#

then the child shouldn't make a rocket

rich adder
tawny sandal
rich adder
#

you don't just start mixing shit and cause an explosion or poison yourself... you learn what each thing does

midnight tree
tawny sandal
#

let me give a better example

#

if a child is learning how to talk

#

you cant say "just talk"

#

you gotta learn how

solar hill
#

But besides, i think this conversation has lost all its value, ages ago

rich adder
tawny sandal
#

nav is just being an asshole and some mfs are siding with him

#

i had 3 problems

#

people thought about 2

#

and those worked

#

the third one nav became an absolute asshole

#

iambatby you count as 1 of the simps btw

#

norman and osmal are the actualy people that know how to help

verbal dome
#

osman and normal

waxen adder
#

What extension is needed for visual studio (not code) for intellisense, auto-complete, etc.

verbal dome
#

!vs

radiant voidBOT
# verbal dome !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)

rich adder
sour fulcrum
verbal dome
#

Lol close enough

tawny sandal
#

nav you could have said either how or the line on how to do it and explain it so i can learn it, that would have helped

#

same with iambatby

solar hill
#

Oh my lord

#

drop it already

tawny sandal
#

im just making a point bro

polar acorn
#

Laides you're both pretty can we move on

tawny sandal
#

im a man

waxen adder
#

If everything is working correctly for intellisense and such, should I expect something like "using UnityEngine.[stuff]" to autocomplete?

solar hill
#

The libraries?

waxen adder
#

Yeah

solar hill
#

Is it not?

twin pivot
#

You should get suggestions when you are writing code

waxen adder
potent portal
#

i do not know why i am getting this error, i can clear it and the game runs fine. should i be worried? it started when i created a script.

solar hill
#

Its en editor error i think

#

you should be fine those happen sometimes

tawny sandal
#

if you guys want me to learn code, how do i genuinely learn it? i dont know how cuz no one told me

solar hill
#

check the pins here for some resources

rich adder
#

look at the pins

radiant voidBOT
potent portal
polar acorn
tawny sandal
solar hill
#

if you want to learn coding directly

#

theres a couple of resources pinned in this channel

potent portal
rich adder
#

the learn lessons assumes you already have some C# knowledge

potent portal
#

ended up reinstalling the whole enigine πŸ˜”

solar hill
twin pivot
potent portal
potent portal
#

6000.0.68f1

verbal dome
#

Could try a newer one

#

(I also wanted to know what version to avoid myself)

rich adder
#

6.0.33f still rock solid πŸ˜†

verbal dome
#

Resetting editor layout and rebuilding library can work for these unity issues

verbal dome
verbal dome
twin pivot
#

Besides tmp sending a few errors once or twice havent encountered any issues on 6.3

potent portal
#

is there a "proper" way to upgrade the engine or do i have to just delete the old version, install a new version and then open my project in that new one?

verbal dome
#

I feel like TMP is always a bit buggy

twin pivot
rich adder
potent portal
#

oh! thanks for telling me about that

rich adder
#

6.3 is not on my radar any time soon

#

I dont need that AI crap

sour fulcrum
twin pivot
potent portal
#

whats version control? 😭

naive pawn
rich adder
solar hill
sour fulcrum
potent portal
solar hill
#

yes

#

that is it

#

github hosts git repos

twin pivot
solar hill
#

a git repo is a form of version control

potent portal
#

ah okay got it

verbal dome
#

The editor has this AI button even if you don't have it installed ✨ πŸš€

naive pawn
# potent portal whats version control? 😭

version control software (vcs) is software to manage multiple versions of your code
versions in this case being different versions in both time and space
in time, as you develop, you have access to previous versions
in space, as you develop separate features, or multiple people work concurrently, you can merge your work together

twin pivot
potent portal
#

i should set it up

solar hill
#

youre not missing out on much with 6.3 tbh

potent portal
solar hill
verbal dome
#

It's obviously gross but not a whole reason to avoid the newer versions IMO :p

sour fulcrum
#

money

rich adder
naive pawn
#

here's an example of the shenanigans you can get up to with vcs (4 people working concurrently)

potent portal
#

what do they even see in AI

solar hill
naive pawn
verbal dome
solar hill
sour fulcrum
#

we can only pray the people responsible lose their jobs πŸ™

potent portal
#

have they not been on the internet in the past year ??

sour fulcrum
naive pawn
solar hill
#

oh really? I always had the extension but i never once looked at it lol

#

what is it just a replacement for github desktop then?

naive pawn
solar hill
#

you just doxxed yourself

#

silly

naive pawn
#

it's another graphical git interface

#

but i still use the cli a lot

solar hill
#

ive been meaning to switch to cli fully

rich adder
naive pawn
twin pivot
naive pawn
#

did you go to my github lmao

potent portal
rich adder
twin pivot
potent portal
#

why cant we just limit AI to be funny chatbots again and not all this crap

sour fulcrum
#

money

rich adder
#

people require benefits, money, sleep, food etc.. machines you know work for free basically

potent portal
#

so what the future is just all machines?

sour fulcrum
#

who knows

rich adder
#

aside from power consumption but thats passed onto regular power consumers anyway

twin pivot
#

Hopefully openai dies in 2027

naive pawn
twin pivot
potent portal
#

why is this happening when its my turn to be an adult 😭 πŸ™ hopefully the bubble bursts by then

naive pawn
#

there's always a chance to get sued into the ground, however little

solar hill
#

openai, owned by a guy named Alt-Man. Kojima you did it again.

twin pivot
rich adder
naive pawn
rich adder
#

isnt java just lesser version of c# πŸ˜‚

twin pivot
sour fulcrum
#

though c# in particular has a lot of really nice conveniences

#

still shocked gdscript doesn't have multi dimensional arrays, i figured that was standard

grand snow
#

haha nice catch

queen adder
#

What are some good kinds of questions to ask here? Should I do some research on a problem before presenting it here, or is it ok to ask first and get a better understanding that way?

twin pivot
rich adder
queen adder
#

Ok thanks!

rich adder
#

most questions, especially ones asked here have been discussed before you will find all sorts of info

queen adder
#

Oh ok I'll keep that in mind

twin pivot
#

I like using the discord search bar for similar issues before asking

naive pawn
# rich adder isnt java just lesser version of c# πŸ˜‚

ime a little less clear cut.
c# has structs, properties, operator overloading, tuples, nice tools/QoL, but java does also have some stuff c# lacks, like enum members, anonymous classes (specifically with inheritance), method references

don't really know what you're missing until you try to use it and it just doesn't exist lmao

naive pawn
rich adder
sour fulcrum
naive pawn
#

stride moment

twin pivot
naive pawn
#

some languages distinguish between arrays of arrays and multidimensional arrays

grand snow
#

An array of arrays is not ideal in c# anyway (array of pointers)

#

but i think this starts to go past beginner stuff

verbal dome
#

1D array treated as 2D array with index conversions = πŸ‘‘

waxen adder
#

Figured out my intellisense issue. In the solution explorer for visual studio (not code), the c# assemblies were marked as unloaded. Handled that.

naive pawn
# twin pivot I mean technically its just an array thats holding a bunch of arrays, no?

this might be clearer in c land

// array of arrays
int row1[3] = { ... };
int row2[3] = { ... };
int row3[3] = { ... };
int* matrix[3] = { row1, row2, row3 };
// ^ this is an array of pointers

// multidimensional array
int matrix[3][3] = { { ... }, { ... }, { ... } };
//  ^ this is 9 consequtive integers. when subscripting the first dimension, you have to multiply by 12 (4 * 3, sizeof(int) * stride)
twin pivot
waxen adder
grand snow
solar hill
#

I think people just dont like using the forum channels

twin pivot
naive pawn
#

well at the L1 caching level sure, i guess

#

and subject to compiler optimization, probably

#

but that's not really the point

#

multidimensional arrays are more complex in their memory representation

twin pivot
#

How is that more advantageous?

naive pawn
#

memory is stored more compact, and stored as it's used

#

and also an array of arrays has potential to have null pointers

#

with a multidimensional array it's just the one pointer

twin pivot
#

So higher efficiency with less moving parts in a nutshell

naive pawn
#

less work for the user (of the language), more work for the developer (of the language)

grand snow
#

cpu like to grab big portions of ram to put into cache, cpu un happy when it have to keep going to ram πŸ™

#

cache fast cpu like only using cache so it can go zoom zoom

#

cpu like making one big shopping trip instead of many

#

ill stop now

errant breach
#

Hello, after working in group, a sudden error appeared :

KeyNotFoundException: The given key '22' was not present in the dictionary. System.Collections.Generic.Dictionary2[TKey,TValue].get_Item (TKey key) (at <73ac12a12f9a4ebca156b41ddce95fbe>:0)`

The thing is that.. I didn't coded anything that uses "Dictionary" !
The error came from "TMP_Font Asset" which is something default i think...?

So.. If anyone know what could be the problem, i would be glad ! Is this a common unity error ? Thanks !

#

The error get send every seconds sadfully..

verbal dome
grand snow
#

I feel like ive seen this before on this server. It may be due to a duplicate font with the same name

verbal dome
errant breach
#

Ah :'(

verbal dome
#

Have you found the font asset that causes it?

errant breach
grand snow
errant breach
#

We only use the default one

grand snow
#

Whats that other one

#

You can try re baking its texture?

errant breach
#

I think reinstalling TMP properly might be a great idea
But i don't know how to do it without destroying everything

errant breach
#

The upper one is the "FallBack"

#

And it got me the error. Okay, that's definitly the one

grand snow
#

That shouldnt be needed unless someone else thought they were smart duplicating it and changing its mode to dynamic

#

Id remove the duplicate and keep the main one. If you need that one can be changed to dynamic to gain new characters as its used

sour fulcrum
#

i haven't used unity's version control, can you not look at the changes in the push and see what tmp related was touched?

errant breach
#

I deleted it, thank πŸ‘ hope it'll fix

grand snow
errant breach
#

Alright πŸ‘ thanks

teal glade
#

can anyone help me, im fairly new to coding and trying to make a low poly buisness game like schedule 1 but cant seem to figure out how to get it all started, also if there is any easier apps for a low poly game please let me know

errant breach
#

Hello, there is something i don't understand...
My player's bullet take the player's PlayerSpeed parameter. From the GameObject Player. But for some reason, the bullet only take the parameter from the Prefab Player, not the active player in the scene...

Here's the code of the PlayerProjectile

public PlayerShoot player;

    void Start()
    {
        // Get the player's values
        transform.Rotate(0, 1 * Time.deltaTime, 0);
        projectileSpeed = player.projectileSpeed;
        projectileDamage = player.projectileDamage;
        lifeSpan = player.projectileLifeSpan;
        print(player.projectileSpeed + player.projectileDamage + player.projectileLifeSpan);

        Invoke(nameof(DestroySelf), lifeSpan);
    }
#

If someone know why instead of taking the parameter of the active player, my bullet take the one from the prefab, it would greatly help. Thank you ! :)

wintry quarry
#

so naturally it comes from the prefab

errant breach
#

I did ! But it will cause issue if i don't ? I always thought it was the good way to do !

wintry quarry
errant breach
#

like if i give the active player and then change scene and put a new player... πŸ€”

wintry quarry
#

Since this is likely a projectile you're instantiating at runtime, you will need to pass the reference to the runtime player object at runtime after you create it.

#

e.g, in the script that spawns projectiles, something like this:

public class Player : MonoBehaviour {
  public Projectile projectilePrefab;

  void Shoow() {
    Projectile spawnedProjectile = Instantiate(projectilePrefab, ...);
    spawnedProjectile.player = this;
  }
}```
teal glade
#

are there any easier apps that i can use to make a low poly buisness themed game like schedule 1

errant breach
chrome shadow
#

how do i control cinemachine virtual camera distance with scroll wheel? i want to zoom in and out

wintry quarry
#

whatever that component is, modify its follow distance in your code

chrome shadow
#

i want to modify camera distance (the bottom value)

faint agate
#

I was trying yesterday but still a little lost, Hello im going to try explain this best I can.
I have a script on a weapon that drags another object(an orb) along the x and y axis only, the orb has a tag CanDrag.
I added SmoothDamp which delays the drag when I want no delay
The problem im having is the orb is not being dragged smoothly. I dont want smoothdamp since it causes lag and even with it low, theres still bounce or jitter. I want to drag the orb without it bouncing or jittering left and right. I think raycast is the problem since I tried with force before this script im sending unless I did it wrong. I also think this since my other weapon raycast are jittery
I am so lost any help is appreciated!

https://pastecode.dev/s/70pajo0n

little context, the orb is the purple circle. Im in unity 3D. I want to drag it to the red(finish line).

wintry quarry
faint agate
#

yes but doesnt need one, Ill go with wtvr fixes the jitter

wintry quarry
faint agate
#

okay

wintry quarry
#

You should never move a Rigidbody by modifying the Transform like this

faint agate
#

okay but I really think its my raycast or camera. I did a debug and the raycast was super jittery over small movement unless its always like that

wintry quarry
#

raycasts themselves are not "jittery" and cannot be "jittery"

#

collider positions do not update except during the physics update though

#

so if you're expecting to move an object and then have raycasts immediately see that movement within the same frame, that won't work

#

but the raycast isn't really relevant to the regular jittery movement right?

#

That's just for detecting walls?

faint agate
#

okay

wintry quarry
#

definitely start by removing the SmoothDamp and just get it working with e.g. MoveTowards to start

#

e.g.

        Vector3 newPosition = Vector3.MoveTowards(
            currentObject.transform.position,
            targetPosition,
            Time.deltaTime * speed
        );```
faint agate
#

im just trying to move the orb in 3d on the x and y axis. when I drag it down slowly it goes left and right really fast

faint agate
#

i cant figure out why though

ivory bobcat
faint agate
teal viper
#

Then you'll see exactly where it went wrong.

ivory bobcat
#

!collab

radiant voidBOT
# ivory bobcat !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**

spare mountain
faint agate
#

how would that work with the drag im a little confused

teal viper
modern lodge
#

still having trouble figuring this out. commented out some stuff i had tried in the past that either errored out or just didnt give the results i wanted.

i also was suggested to use a script to dump component names using scriptable objects but binding.propertyName is just a string...

modern lodge
#

im trying to get a list of all the possible values of binding.propertyName so that my script to copy those individual keyframes, also copies those /modifies them appropriately

sour fulcrum
modern lodge
#

can do

faint agate
#

i tried smooth damp which fixed some things but made others worse

teal viper
faint agate
#

Plane plane = new Plane(Vector3.forward, currentObject.transform.position);
Ray ray = cam.ScreenPointToRay(Input.mousePosition);

    if (plane.Raycast(ray, out float distance)) {
        Vector3 point = ray.GetPoint(distance);
        targetPosition = point + offset;
    }

this is the only things its connected to.

sour fulcrum
#

those aren't logs

faint agate
#

okay
targetPosition = point + offset;
Debug.Log(targetPosition);
i did this and as I drag down the x goes back and forth

sour fulcrum
#

thats one thing, have you logged

currentObject.transform.position
targetPosition
newPosition
point
targetPosition

#

the idea here is seeing which part of the process is giving you trouble

teal viper
#

Also actually add text to your logs to make sure you know what variable you're looking at.

faint agate
#

got you

#

its the raycast. the DrawRay is bouncing

wintry quarry
#

i mean are you excluding the ball itself from all these raycasts?

faint agate
#

i asked if thats what it was yesterday but someone told me no unless something is effecting the raycast

#

i thought that the ball might be messing with it

#

let me see

#

the raycast is smooth and fine but the sphere bounces and freaks out/bounces when I turn the speed up in
Time.deltaTime * speed

faint agate
#

yes

#

but not a rigidbody

rich adder
#

then its affecting the raycast

teal viper
#

Also, moving physical objects should have rigidbodies.

#

Also, you shouldn't mix CharacterControllers with rigidbodies/colliders.

#

Oh, I guess you're not using CC...

faint agate
#

i logged and put text, the x is changing on all of them

#

Debug.Log(("target position") + targetPosition);
Debug.Log(("point") + point);
Debug.Log(("current position") + currentObject.transform.position);
i did this

faint agate
rich adder
#

use layermask

faint agate
#

i do have a candrag tag on the obj(sphere) im dragging

faint agate
sour fulcrum
#

imagine your shooting a gun at someone holding a shield

your tagging the shield

instead with layers you could outright ignore it's existence

rich adder
faint agate
#

i switched it to layer but still bounces.
I also use the raycast to check if crosshair is on sphere itself

faint agate
#

thank you for everyones help ima get some sleep and work on it again tmrw before I fry my brain lol

rich adder
coarse karma
#

Hello !

We are working at two on a project, and this windows recently hopened. I dont want to lose what i've done, my collegue just added one enemy on the scene or something, could someone help me what i need to do in order not to loose all i've done ? Thank you and have a great day !

midnight plover
teal viper
midnight plover
#

You can workaround that with at least using some prefabs so one can work on their prefab while someone else can work on another without breaking the "Main" scene

brisk edge
languid nova
#

Hi! I'm having trouble with layers and raycasting

I have multiple objects I want to be able to click on (the brown cubes) and one object I want to ignore so that I can click on the squares behind it (the yellow rectancle)

#

I've tried setting the yellow rectangle layer to "Ignore Raycast" but that didn't work

#

I still can't click on the brown cubes behind it

#

The cubes all have this script that uses "OnMouseDown", but I've read online that it should still ignore objects with the "Ignore Raycast" Layer

queen vale
# languid nova

If I'm correct (usually not), you've just set that box collider to forcibly include interactions with objects on the ignore raycast layer, regardless of the physics settings for the layer the gameobject itself is set to.

Instead look at the layer of the gameobject itself, above the transform component.

languid nova
#

you're right actually, that was the issue

#

thanks a lot!

night raptor
#

@languid nova Besides the question but note that OnMouseDown only works for the old input system (which you then probably use), for maximum flexibility I prefer doing the same using a custom raycast. I don't know what you are doing but regardless all of those blocks having their own script sounds bit much especially if you are going to have a lot of them. Even them being separate game objects is a lot of objects to renderer. For more optimized approach, you could look into the way minecraft and similar games render blocks and modify them

elfin pike
#

I have scriptableObjects with ids. is there way to generate them unique?

silk night
#

look at Guid

languid nova
elfin pike
silk night
#

On create of a scriptableobject?

#

You can use OnValidate and check if the ID field is empty

#

its executed whenever data is changed, but you just generate a new one if the field is empty

elfin pike
#

works thanks

naive pawn
#

i think that's persistent for assets? not 100% sure though

silk night
elfin pike
naive pawn
elfin pike
#

it worked, dumb mistake by me

silk night
#

Overy Object has that method

#

and basically everything in unity derives from that πŸ˜„

elfin pike
queen vale
#

I'd like to see the script before making any guesses. - Though that may not be relevant....... it's odd that it's only in the build

#

!code

radiant voidBOT
naive pawn
#

shouldn't have deltaTime on mouse delta, btw.

#

it's already per-frame

#

that's also a lot of wrong-lerp fyi

#

not seeing any issues that would affect jumping though

queen vale
#

Mmm could be unrelated but i find it interesting that in the editor you were always moving laterally when you jump, but in build you're not.

real thunder
#

Just checking in in case there is a more elegant solution
Is there a better way to determine if an enemy within melee attack distance height wise (3d) than to subtract half-heights from height difference?
like on pic magnitueds of a red vector minus blue ones
And then check if it's longer than allowed distance

queen vale
#

Does this still occur if you're constantly moving forward/etc throughout the jump, in build?

subtle mulch
#

send the script maybe

queen vale
#

they did

subtle mulch
#

oh

#

where

#

ah found

#

why are you doing your own gravity physics btw

lyric vortex
subtle mulch
#

try to remove the gravity stuff

#

the char controller should already handle it by itself

real thunder
#

it only does that if you move it using a method which does it

#

SimpleMove vs Move

#

iirc if you want it to jump you have to emulate gravity

naive pawn
subtle mulch
#

ah

#

i'm using ECS and Netcode for entities that does it all by itself

#

lol

naive pawn
night raptor
# real thunder Just checking in in case there is a more elegant solution Is there a better way ...

Must depend what information you have easily available. In case you have the min and max coordinates, you could do a 1D intersection test https://eli.thegreenplace.net/2008/08/15/intersection-of-1d-segments. Maybe that way it would be easy to also set up a limited range of coordinates the weapon can reach height-wise, I assume in your case those boxes are the player and the enemy, you might want to limit the range to something much more specific for the weapon specifically and see if the weapon intersects with the enemy

#

Sure, might be an XY issue, physics queries are probably the more common way to do that whole intersection testing

real thunder
#

what can I do with physics?

wintry quarry
#

queries

real thunder
#

I do that check to determine if an enemy should attack or not

queen vale
#

o.O

naive pawn
real thunder
wintry quarry
radiant sentinel
#

hey can anyone help me, im very new and am doing the 2d game kit tutorial, have done most of it with no issue but im stuck on the box problem ive done what it says and it just wont squash the enemy its supposed to

wintry quarry
radiant sentinel
wintry quarry
#

keep going

radiant sentinel
#

step 7

real thunder
wintry quarry
wintry quarry
radiant sentinel
#

it lands on the enemy and he takes it like a champ

naive pawn
radiant sentinel
#

i even changed the dmg from 1 to t10

naive pawn
#

don't worry about perf at this stage. focus on what makes sense

radiant sentinel
#

nothing

wintry quarry
radiant sentinel
#

yeah