#💻┃code-beginner

1 messages · Page 736 of 1

hidden fossil
#

cuz its not suppose to spam the console with that debug log

winged ridge
#

On principle nothing wrong with it. The connection to exit isn't required you could reroute them back to the idle. But that's the animator component not the State Machine

hidden fossil
#

well

#

i dont what to do rn

#

wait

#

could it be because of this?

hardy wing
#

im also not sure if this should look like this OMEGAROLL

winged ridge
fallen cosmos
#

6000.2.5f1?

hardy wing
winged ridge
#

That second issue is caused by the first set of red errors, if you look it's a GUI issue where it specifies it can't draw text

fallen cosmos
# hardy wing yas

This also started to happen to me after I updated yesterday from the previous "Supported" one

#

So I am not alone I guess

hardy wing
winged ridge
#

I'm still only using 6000.1.2f1

hardy wing
#

be glad

winged ridge
#

I have no reason to go further, I don't need UnityAI

fallen cosmos
hidden fossil
#

im still stuck

#

its still not acckig

hardy wing
#

fun times

fallen cosmos
winged ridge
hardy wing
hidden fossil
#

can someone plz help me the skeleton still wont attack

winged ridge
# hardy wing fun times

Ignoring the awful purple overlay... the issue states there is a method called GetName being called twice and a dictionary having a duplicate Key, it may well be a double script...

winged ridge
hidden fossil
#

oh did i skip a part of the tutorial

#

i didnt see it put in attack logic

#

brb

winged ridge
#

you have to actively tell it "okay now you go to attack state, the state does xyz" etc

hardy wing
fallen cosmos
hardy wing
#

if so, detach your UI document, start game, attach UI document, start game again

#

solved it for me

hardy wing
#

so i always know when i'm in play mode

#

and dont try to do shit in editor while i'm in play mode

fallen cosmos
winged ridge
hardy wing
winged ridge
hardy wing
#

or possibly make a preset

fallen cosmos
winged ridge
hardy wing
hardy wing
winged ridge
#

Generally what I do is
1 prefab then I child prefab and just change the master
So example I have
Master_Item prefab
then for each item I would do
Child_Item_Fish etc

fallen cosmos
#

I dont want to get into the details, but this was done to support mod overriding from asset bundles

hardy wing
fallen cosmos
#

This is the reason why I had to go this route

winged ridge
#

Im sure there must be a better way to do it...

fallen cosmos
#

Like submitting a bug report and hoping it will get fixed soon

#

Thats what I am doing rn

winged ridge
#

yes, lol offload

hardy wing
fallen cosmos
#

Coz as I have mentioned, this started happening with a single incremental update that I did yesterday

winged ridge
fallen cosmos
#

From 6000.2.4f1 to 6000.2.5f1

fallen cosmos
#

This forces me to split UI states into separate filesystem entries (prefabs) for them to be individually overridable by mods that want to do so

hardy wing
#

thanks for the insight

fallen cosmos
#

If I had a single monolith UI prefab this would make it impossible for 2 mods to change something in the hierarchy of the UI

#

Since they will be clashing for the same asset to override

hardy wing
#

oh so only 1 mod could override your UI

winged ridge
#

unless you did the leapfrog using temp variables

fallen cosmos
hardy wing
fallen cosmos
#

One mod can override a console, another settings menu, another main menu, etc

fallen cosmos
#

Pretty much how I am handling this

#

See that square?

#

That does not display an entry count

winged ridge
#

without seeing the ccode...I couldnt much help potentially optimise it

fallen cosmos
#

Thats where those errors are comming from

fallen cosmos
hardy wing
#

glad to see i'm not the only one naming my UI script... UI...

winged ridge
#

talking of optimising, I need to double check some code

winged ridge
hardy wing
#

well i just felt a bit uncreative

fallen cosmos
#

Adding Manager sometimes feels overly verbose

hardy wing
#

UI or UIManager doesnt change much

winged ridge
#

Im just thinking less risk of giving a name thats already been used

hardy wing
#

it is what it is

fallen cosmos
hardy wing
fallen cosmos
#

Readding all states back to the list helped, all errors are gone 🥳

hardy wing
#

glad if i can help even though you guys are all doing so much greater or more interesting stuff than me 😄

vital otter
#

what is this and why does this keep appearing on startup?

winged ridge
hardy wing
#

my biggest problem is not that i don't have the coding skills, more that i do the things i do for the sake of doing it and not with an actual goal in mind

#

right now i'm porting my bezier curve visualizer from godot so that's a start i guess

winged ridge
hardy wing
#

but this time i have the goal in mind to not overcomplicate things, especially in terms of visuals, and just focus on mechanics, then take care of the rest later

winged ridge
hardy wing
winged ridge
#

Jank first, Refinement at the end

  • Get Ideas
  • Plan out a general concept
  • work on simple mechanics
  • create test environments
  • design better mechanics etc
  • design better environments
  • bug fixes
    etc
#

Only times you pause for bug fixing is if it literally blocks you moving forward, if its a "I dont like this but I can move past and circle back" do so

steep sedge
#

hi. any ideas why this Physics.OverlapSphere returns 2 colliders when there's only 1 collider in scene?

winged ridge
steep sedge
#

they are in different layers, does that cause any problems?

winged ridge
#

if it is recognising "Collider" it will check for any and all colliders, regardless of layer usually

hardy wing
#

uhh i dont think it should look like this

#
public class LineRendererInitializer : MonoBehaviour
{
    [SerializeField] private Color[] _colors;
    [SerializeField] private float _width;

    private void Awake()
    {
        for (var i = 0; i < _colors.Length; i++)
        {
            var color = _colors[i];
            var child = transform.GetChild(i);
            var lr = child.GetComponent<LineRenderer>();

            var startColor = new GradientColorKey(color, 0.0f);
            var endColor = new GradientColorKey(color, 1.0f);
            var colorKeys = new[] { startColor, endColor };

            lr.colorGradient.colorKeys = colorKeys;
            lr.widthCurve.keys = new[] { new Keyframe(0.0f, _width) };
        }
    }
}

shouldnt this work?

winged ridge
#
        lineRenderer.material = new Material(Shader.Find("Unlit/Color"));
        lineRenderer.material.color = colour;

I have a material attached based on the standard unlit color material

steep sedge
hardy wing
#

ah right

#

i forgor the material

winged ridge
hardy wing
#

very cool, 6000.2.5f1

steep sedge
winged ridge
#

disable the script on the other object and retest

steep sedge
winged ridge
#

Outside of the method finding 2 colliders
these are the usual suspects:

  • Double script being called
  • flaw in logic
  • Method being called 2 times etc
#

I assume the sword has a collider attached, the sword that is attached to the player with a collider... Try disabling the sword

rough grotto
#

is there a google document for a 2d game guide where it tells you animation simple code and stuff, if not I want to make one of my own for a school project

winged ridge
rough grotto
#

I want to make one thats just 2d games and simple compnents and code, nothing else

steep sedge
steep sedge
winged ridge
# steep sedge

Theres a few, but for now, disable sword. As far as im aware the layermask in that is an optional variable

rough grotto
hardy wing
#

now it happens even when i dont even have an UI document

winged ridge
rough grotto
#

Thanks imma do that

steep sedge
rough grotto
hardy wing
winged ridge
#

As long as it is your own words, and you are not planning on selling a document and or claiming to be the original source, since its for educational use there shouldnt be any issues

rough grotto
#

Thanks

hardy wing
#

not even the width applies

winged ridge
#

But that is a good point ill raise. Anyone who wants to publish anything, few things to remember
If its not your own work/Asset, get written confirmation by the original creator and/or prove without doubt you have attempted on multiple occasions, to contact said person before you go forwards with selling it in your product

winged ridge
hardy wing
#

no

#

its all white

#

which is the default color

#
            lr.colorGradient = new Gradient();
            lr.colorGradient.colorKeys = colorKeys;
            
            lr.widthCurve = new AnimationCurve(widthCurve);
            lr.material = _material;
#

ah

#

with this it works

oak gazelle
#

Does Destroying a game object that includes a particle system cause this error for some reason

Invalid memory pointer was detected in ThreadsafeLinearAllocator::Deallocate!

rocky canyon
#

just make sure ur colors have alpha

#

all of these are set to 0 in the Alpha / Transparency slot

#

u can tell by the Black bar underneath...

hardy wing
#

hello?

#

apparently cant send my image xdd

#

ah now

#

ah right because "uhh" is blacklisted on this server bruh

#

wanted to send the image with "uhh" as text

#

yeah found the issue with color

#

man this 6000.2.5f1 bug is obnoxious

winged ridge
#

welcome to bug fixing, where you solve one and a hundred more pop up in its place

oak gazelle
#

Do I need to stop particles before destroying their parent?

winged ridge
#

if it helps any.. I noticed an issue with my quest system, and thought meh instead of 10 scripts I'll redo it in 4, and got over 20 bugs

hardy wing
#

it's more fighting with engine than fighting with bugs which makes it kinda annoying

hardy wing
#

i dont know why setting colorKeys on a LR doesnt seem to work

winged ridge
#

Foreach loop through the keys, and foreach loop through the colours you want and then take the ones you want and tell each one which colour it is to be

hardy wing
#

well i just set lr.colorKeys which should be fine?

winged ridge
#

Or since it's an array,a nested for loop works too

edgy sinew
#

Guys, would you recommend any 3rd person camera follow-target smoothing techniques?

winged ridge
edgy sinew
#

I’ve done it with Vector3.Lerp and a curve (distance vs max Lerp)

edgy sinew
slender nymph
#

just use cinemachine

edgy sinew
#

I am using Cinemachine. But it is not configured to use it. And I didn’t like it

#

I’ve tried Vector2.SmoothDamp (x-z position, y is instant or separately lagged)

winged ridge
#

Remember, camera updates are LateUpdate

edgy sinew
#

Is that necessary if I manually call cam.UpdateStuff()
After the other every frame stuff

#

I have Cinemachine on manual update too

#

Is that bad for getting an even frame rate? 😅

winged ridge
#

Highly recommended unless you can change how unity handles the frames per second and order the methods get called

edgy sinew
#

I see. But, I have every Update manually bro yeah

ripe shard
#

cinemachine gives you perfectly smooth camera motion, to get the same level of smoothness you need to grind out many edge cases yourself.

edgy sinew
#

I use the De Occluder but I’m on Hard Look At

ripe shard
#

if you mess with cinemachine internals in the wrong places, you will ofc break that smoothness

edgy sinew
#

So calling .ManualUpdate every frame isn’t essentially what Cinemachine does?

ripe shard
winged ridge
#

In effect 1 FPS is 1 frame of action in a second, the second it gets from your computers internal clock. So if it's running at a 60 FPS it is doing 60 frames of an action within a second, so between 1sec and 2sec it will have had to divide 1 by 60 to allocate a frame per. Then send the data back to the program for an update.. mess up your maths in 1 part and it's all gone

summer wren
#

How to do in my game so if a player is wearing a hat, the hair won't show except for coming out of bottom of hat?
Should I draw separately top_hair and bottom_hair sprites and then disable top hair when wearing hat?

winged ridge
summer wren
hardy wing
#

or is it one of the few cases where you can actually see whats going on

winged ridge
#

You can always look, can't edit if I remember

ripe shard
#

its all in your /Packages or /PackagesCache folder

#

cinemachine is fully open source and documented in code.

hardy wing
#
    private void DrawHelperLines(float t)
    {
        var positions = _points.Select(p => p.position).ToList();

        for (int i = 0; i < (_points.Count - 1); i++)
        {
            int n = _points.Count - i;

            var lr = _lineRenderers[i];
            lr.positionCount = n;

            for (int j = 0; j < n - 1; j++)
            {
                DrawLine(j, lr, positions[j], positions[j + 1]);
            }

            for (int j = 0; j < n - 1; j++)
            {
                positions[j] = Lerp(positions[j], positions[j + 1], t);
            }
        }
    }

    private Vector3 LerpBezier(Transform[] points, float t)
    {
        var positions = points.Select(p => p.position).ToList();

        for (int i = 0; i < _points.Count; i++)
        {
            int n = _points.Count - i;

            var lr = _lineRenderers[i];
            lr.positionCount = n;

            for (int j = 0; j < n - 1; j++)
            {
                DrawLine(j, lr, positions[j], positions[j + 1]);
            }

            for (int j = 0; j < n - 1; j++)
            {
                positions[j] = Lerp(positions[j], positions[j + 1], t);
            }
        }

        return positions[0];
    }

How do I get rid off code duplication here ahhhhh 😩

hardy wing
#

extracting what?

ripe shard
#

the bits that are duplicates

hardy wing
#

I've already gotten this far brother

#

I wouldn't ask if the solution was apparent to me

ripe shard
polar acorn
hardy wing
hardy wing
#

the code is wrong

#

LerpBezier is actually not drawing, just calcing

winged ridge
#

in effect, the entire for loop seems to be a dupe, you can extract that as a method and call it

hardy wing
#

yeah the problem is

#

it's effectively the same code except in one case i need to call DrawLine a few times

#

maybe i can re-code it into manipulating the array

#

and then i repeat the array manipulation

hardy wing
winged ridge
#

code usually works out that way, sometimes theres easier paths than ones we make.. hence why I spend so long trying to find the most efficient

#

Just something, if you are thinking you may want to do a call to this method from another script, look at making it public (not required if its internal only)

shell sorrel
#

best to just make it work and readable first, no point trying to go for perf till its regnozined as needed

edgy sinew
#

I meant like an Editor Game view issue. I’ll try building project too!

hardy wing
winged ridge
#

Honestly, I can spend a couple months on a mechanic, writing scripts, testing, ensuring it works with the other components I have already etc

chilly vigil
#

why is my unity codeword vector3 not appearing on vs 2019

winged ridge
#

are you using the using statement? Did you capitalize the V

chilly vigil
#

yeah i am but unity is not reconizing it under vs 2019

cosmic dagger
winged ridge
cosmic dagger
slender nymph
#

are you using the log formula to calculate the decibels? if so, your slider should bottom out at 0.0001

winged ridge
#

Mathf.Log10("stringHere", value) * 20

#

the slider bottoms at 0 and then decibles go back to 0 and carries on lol

#

if it helps any Mixer Group is being used

teal viper
#

!ide

radiant voidBOT
slender nymph
#

then you can just round the display so the user sees 0 but the math will actually be right

winged ridge
#

The user wont see actual values, but graphical representation, the slider at 0.0001 I shall test against now

#

yep that was it, thank you folks.

#

and by visual representation
this is what I meant

cosmic dagger
#

It's usually the log formula . . .

winged ridge
#

it works for now, refinement can come later, I will note that though

winged ridge
cursive sinew
#

Hi, I haven't coded anything in my project yet, but pressing play will freeze the game for a few seconds every single time.

Even when I stop the play before the freeze happens, the editor does the few second freeze, and this loading pop-up comes up saying something "unity synchronization execute tasks."

How can I figure out what's causing this? I'm assuming it's from an asset I imported but I don't know how to find where because the console doesn't really indicate anything to me that would be an infinite loop or something

winged ridge
#

How many assets did you import at one single time?

cursive sinew
#

Quite a lot 😅 Would the best way be to disable them one at a time to see which is causing it?

cursive sinew
#

Gotcha, ty! 😔

winged ridge
#

Generally import assets 1 by 1 ensuring they don't break anything..

willow iron
#

I have two identical statments

        if (!locker && releasekey)
        {
            move.movementEnabled = false;
            transform.position = LockerGameobect.GetComponent<Locker>().enterPoint.position;
            transform.rotation = LockerGameobect.GetComponent<Locker>().enterPoint.rotation;
            locker = true;
        } else if (locker && releasekey)
        {
            move.movementEnabled = true;
            transform.position = LockerGameobect.GetComponent<Locker>().exitPoint.position;
            transform.rotation = LockerGameobect.GetComponent<Locker>().exitPoint.rotation;
            locker = false;
        }

The first if statement works perfectly, teleporting the player to enterpoint and disabling there movement
but the second if statement does not teleport tehm to the exit point. The if statement goes through. i know this because the player movement is unlocked and the locker bool is set to true, but the transform is not changed, they are just dropped where they are

#

(i may go to sleep and re ask this in the morning but if you have any suggestions they would be appreciated!)

ivory bobcat
orchid harness
#

hey everyone total noob to unity here, i was following a guide to making a script for a player char, and unity is not having it but the code at least to me should work am i wrong?

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)

verbal dome
#

The error is caused by the semicolon at the end of your if-statement

#

So the compiler thinks it is an empty statement

orchid harness
#

i was reading something on that as well, so how can i go about fixing it? cuz if i remove the semicolon it also does get upset

#

cuz im assuming changing else to like else if wont do anything since there is no other if statments to look for right?

verbal dome
orchid harness
#

will do thank you, im sure ill be back in a bit xD

orchid harness
#

alright so i looked into it i found the error with a bit of help since i had a semicolon at the end of line 13 and my small sleepy brain slapped that on the end like a dumdum, but i do appreciate the help and the addition to vs it will definitely help me not make such small mistakes

hardy wing
#

ha, already better GamingLove i rolled my project back to 6000.2.4f1 until the UI problem gets fixed

digital stone
#

how can i make dynamic collision boxes and destroy them after a point of time , need it for attacks , will overlay the animations later on top of it

lament halo
#

Okay.... My prof didn't approve of 2D animation game, they wanted 3D but I don't think my laptop can handle development like that

#

I've searched up and saw the term low poly, how does that work?

midnight plover
digital stone
#

how can i make dynamic collision boxes and destroy them after a point of time , need it for attacks , will overlay th

lament halo
#

And are there videos showing how to make them?

digital stone
#

i have

#

only

#

done the input system basics for movement and jump

eternal needle
midnight plover
digital stone
midnight plover
digital stone
#

how do i access the downloaded documentation

midnight plover
digital stone
#

but how do i access the downloaded documentation lol 0-0

digital stone
#

@midnight plover i mean that

digital stone
midnight plover
# digital stone

Never worked with the offline version. you can locate it when you click in unityhub on installs and three dots and reveal in finder/explorer. There should be some contents/documentation folder. I am not on windows, so dunno

hardy wing
verbal dome
#

These are not objects - they are just methods you call to check for colliders in a specific area

digital stone
#

Ohh thanks man , I was pretty much

#

Making my hair fall from the confusion

hardy wing
#

since i couldnt figure out how to make it work with non-UI elements i just detected whatever i click with a regular cam to worldspace raycast

grand snow
#

It should just work. event system + raycaster + matching collider and use of IPointer interfaces

#

make sure the layer mask was not changed on the physics raycaster

pallid forum
#

quick question, not really about scripting itself.
How do game devs scale game objects in unity 2D??
I try to search and search and it just showing about Ui instead.

grand snow
#

You can alter scale on Transform, did you mean something else?

#

initial sprite size is based on the pixels per unit value configured for the sprite/spritesheet asset

pallid forum
grand snow
#

Oh well thats based on the camera orthographic size

#

the size of gameobjects dont change, just the size of the area the camera shows

pallid forum
#

so I have to adjust the camera's size based on the device's resolution?

grand snow
#

ortho size should be consistent for height always regardless of resolution

#

width will show/hide stuff. You can use cinemachine to have a camera auto size to fit some objects

pallid forum
#

Alright, thanks. I'll search up about it.

fallen cosmos
#

Hopefully this will get fixed

hardy wing
#

representative i suppose?

fallen cosmos
#

I went though with proper filing of this yesterday and now we are trying to narrow down the cause

hardy wing
# fallen cosmos ye

is there a form or something or how can you get in contact with somewhat urgent things?

fallen cosmos
#

I just used this thingy

hardy wing
grand snow
#

you can report a bug via that or if you have enterprise then you can use premium support

#

If its an engine bug though making a bug report is the way to go to get it looked at and fixed

hardy wing
grand snow
#

no

#

if you have the license you get that

hardy wing
#

oh nvm you're not withaust KEKW

fallen cosmos
#

That is who you are talking to

hexed terrace
#

its not garuanteed theyll be responsive

fallen cosmos
#

My issue got picked up in 7 hrs

#

So I am fine with those response times :D

midnight plover
#

Yeh, they are usually quite fast. Depends on the problem too I guess

hardy wing
#

plus the entire UI code would just overwhelm me anyways so probably better that way

hardy wing
#

not sure if it's in the way of anything

#

for now just looks annoying

hollow palm
#

Does Unity have a feature to disable or at least give a warning by console to user who try to override MonoBehavior functions like Start(), Awake(), Update(), etc in child class?

public class Parent : MonoBehavior
{
  private void Awake()
  {
    // Do some stuff
  }
}

public class Child : Parent
{
  private void Awake()
  {
    // This actually overrides stuff that Awake() does in parent class
    // I dont want this happen
  }
}
naive pawn
#

(and optionally, explicitly sealed)

eager elm
#

If it is protected in the parent class you get a warning (with most IDEs)

hollow palm
#

that was told by my IDE

naive pawn
#

no

#

it's probably saying that sealed is unnecessary when it's not overriding a virtual member?

#

ah, no, you're right

#

the SO answer i was referencing was slightly vague on that, mb.

hollow palm
#

no worries

naive pawn
#

you don't need sealed, if it were allowed it'd just make the behavior explicit

hollow palm
#

so its not possible then?

naive pawn
#

just make it accessible to the subclass

#

probably just protected would be fine

hollow palm
#

yea amazing, protected defines the warning console, this is not quite I looking for since you cant custom the log, but at least it will tell the users that Awake is currently used by parent

#

ty sir

hardy wing
#

making it virtual also allows you to call base version from derived version

wintry quarry
#

If it's virtual you'll get an error if you don't explicitly override it

hardy wing
#

it just warns iirc

#

because it thinks you're doing private new void Awake() implicitly

#

at least thats what i recall

wintry quarry
hardy wing
hallow acorn
#

hey, i wanna look into procedural dungeon generation in unity, for example with a wave function collapse algorithm, and im wondering what the best way to do that would be. every room as about 50+ props in it and a grid with the floor tiles and im not really sure if its optimal if i have an individual grid/tilemap for every room in the dungeon. is this actually the best way or do you guys have an idea how i should do it? thanks in advance

wintry quarry
#

for example is every "room" like its own scene where the player can't see other rooms (like in Hades?)

#

or something else?

hallow acorn
wintry quarry
#

basically it sounds like the overall "world map" of rooms should be separate from how you store the actual contents of the rooms

hallow acorn
#

pretty early screenshot of a bunch of assets i drew mashed together but i can imagine having a short fade out fadein effect when switching to the next room would work really good actually.

#

i think it would fit the game

wintry quarry
#

also are the rooms themselves randomly generated (like the contents)? Or just the arrangement of the rooms in the dungeon?

hallow acorn
wintry quarry
#

and you can have an algorithm that just generates a dungeon from your library of available rooms

#

but you don't need to actually instantiate the prefabs until the player walks into the room

hallow acorn
tranquil canopy
#

hey lads,
im working on unity6 2D project and i want have bloom/glow effect on specific object not all the objects in the scene
i have tried (2 camera solution, shader solution) but still i cant get
thank you in advance

slender nymph
#

this is a code channel

wintry quarry
#

The only other options are:

  • writing a custom bloom psotproccesor using a stencil shader or something
  • rendering the different objects on different cameras

Also #1390346776804069396

edgy sinew
#

There's some more interesting stuff going on in the DoNonFixedUpdate but it doesn't really seem complicated. Just a few if statements handling different camera modes

#

Far as I can tell, unless you have multiple cameras or some desire for FixedUpdate(), simply calling myCamBrain.ManualUpdate() seems to be equivalent to Smart Update or Late Update 🤷‍♂️

formal wharf
#
using UnityEngine;
using System;
using System.Collections.Generic;

public class CarController : MonoBehaviour
{
    // Start is called once before the first execution of Update after the MonoBehaviour is created


    [SerializeField]
    public enum Axel
    {
        Front,
        Rear
    }
    public struct Wheel
    {
        public GameObject wheelModel;
        public WheelCollider wheelCollider;
        public Axel axel;
    }

    public float maxAcceleration = 30.0f;
    public float brakeAcceleration = 50.0f;

    public List<Wheel> wheels;

    float moveInput;
}

Why does the wheels list and Axel not show up in unity editor?

naive pawn
#

Wheel needs to be marked Serializable, and Axel won't show up anyways, it'll just be the type of any given wheel's axel

#

(btw, it's spelt Axle)

formal wharf
#

oh right thanks

polar acorn
nimble apex
#

it shouldnt show up

#

this is enum

enum Fruit { Apple, Orange ....etc}```

after u declared the class, u will do something like
```cs
Fruit fruit; // = Fruit.Apple```
#

this is called enum variable

slender nymph
#

just fyi, it's an enum not a class

#

the only "enum class" is System.Enum which is not actually an enum

oak gazelle
#

Am I able to destroy a gameobject that has a nested particle system within it?

#

I seem to be getting an error when I do it

#

I keep getting this error right here

Invalid memory pointer was detected in ThreadsafeLinearAllocator::Deallocate!

grand snow
#

should be fine so something weird has happened

oak gazelle
grand snow
oak gazelle
#

Yes,

Invalid memory pointer was detected in ThreadsafeLinearAllocator::Deallocate! 0x00007ffa24f0341e (Unity) StackWalker::ShowCallstack 0x00007ffa24f12d29 (Unity) PlatformStacktrace::GetStacktrace 0x00007ffa261835ce (Unity) Stacktrace::GetStacktrace 0x00007ffa267599cf (Unity) DebugStringToFile 0x00007ffa24690fc4 (Unity) ThreadsafeLinearAllocator<0>::Deallocate 0x00007ffa24693bc1 (Unity) ThreadsafeLinearAllocator<1>::TryDeallocate 0x00007ffa246a31f2 (Unity) MemoryManager::TryDeallocateWithLabel 0x00007ffa246a4c03 (Unity) free_alloc_internal 0x00007ffa2567604f (Unity) ParticleSystem::DeleteClearedFences 0x00007ffa269febe9 (Unity) ParticleSystemGeometryJob::EndFrameCallback 0x00007ffa267e36e2 (Unity) GfxDeviceWorker::RunCommand 0x00007ffa267ed19c (Unity) GfxDeviceWorker::RunExt 0x00007ffa267ed2cf (Unity) GfxDeviceWorker::RunGfxDeviceWorker 0x00007ffa24c28e0e (Unity) Thread::RunThreadWrapper 0x00007ffafe1ee8d7 (KERNEL32) BaseThreadInitThunk 0x00007ffafef28d9c (ntdll) RtlUserThreadStart
hazy tiger
#

hi, so i followed a tutorial on how to add jumping and this is the code

#

it checks if the groundcheck box under the player is touching anything with the ground layer

#

thing is it doesnt work with the tilemap im using

#

regular 2d sprites work

#

and i have no idea where to start fixing

wintry quarry
#

with a tilemap that'd be the TilemapCollider/CompositeCollider2D

#

btw your else if seems wrong - I would guess that's something you want to do only while you're in the air already. But right now it's only happening when grounded, where it's pointless

hazy tiger
#

no its supposed to work when grounded

wintry quarry
#

it's also weird when the veloicty is negative - it'll slow your fall

oak gazelle
#

I'm also getting a ton of these

Internal: JobTempAlloc has allocations that are more than the maximum lifespan of 4 frames old - this is not allowed and likely a leak

hazy tiger
#

so i cant just set the grid's layer to ground and call it a day?

wintry quarry
#

you need to find whichever object that is and make sure the layer is correct

hazy tiger
#

yeah its correct

#

but it wont work

wintry quarry
hazy tiger
#

one sec

wintry quarry
#
  1. What groundLayer is set to
  2. the objects with the colliders
hazy tiger
#

these right?

wintry quarry
hazy tiger
#

just these

wintry quarry
# hazy tiger

looks fine, there's no reason your OverlapBox call wouldn't work with that

#

perhaps you're doing it in the wrong position or something

hazy tiger
#

idk bruh

#

i threw in a regular 2d sprite square and set its layer to the specific one

#

it worked on that square

#

but not this grid

#

the tutorial i followed was made in 2023 so maybe some updates changed something?

wintry quarry
#

show where your ground check is

hazy tiger
#

that small rectangle under is the groundcheck

wintry quarry
wintry quarry
#

I don't think that's valid

hazy tiger
#

it worked

#

WHY DID I HAVE IT NEGATIVE

#

i need to reconsider my life choices

#

thank you though

fickle plume
#

@hazy tiger No off-topic images, please

hazy tiger
pliant coyote
#

Good Morning,

#

Anyone have any tips for movement similiar to warcraft 3 movement? any articles to read?

wintry quarry
pliant coyote
#

really want to get it smoother too in terms of movement and attack

oak gazelle
#

I am currently using a particle system for my fireball prefab. It's a projectile. I am creating a new instance of the prefab on every shot of the projectile. Could this be causing the memory leak?

#

If I just spam fireballs?

wintry quarry
#

"Smoothness" often comes down to high quality animations and transitions

pliant coyote
edgy sinew
wintry quarry
edgy sinew
wintry quarry
edgy sinew
#

Could be really expensive to detect that 'pathway too thin' kind of situation

oak gazelle
# wintry quarry if you never destroy them and/or if you keep a reference to them all forever, it...
    private void OnCollisionEnter(Collision collision)
    {
        Debug.Log(collision.transform.root);
        Debug.Log(owner);
        if (targetHit)
        {
            return;
        }
        if(collision.transform.root == owner)
        {
            return;
        }
        else
        {
            targetHit = true;
        }
        if (gameObject == null)
        {
            return;
        }

        if (collision.gameObject.GetComponent<BasicEnemey>() != null)
        {
            BasicEnemey enemey = collision.gameObject.GetComponent<BasicEnemey>();
            enemey.TakeDamage(damage);
        }
        if (collision.gameObject.GetComponent<PlayerMotor
            >() != null)
        {
            PlayerMotor player = collision.gameObject.GetComponent<PlayerMotor>();
            player.DamagePlayer(damage);
        }

        ContactPoint contact = collision.contacts[0];
        //Instantiate(particleEffect , contact.point, Quaternion.identity);
        DestroySelf();
        
        

    }

I am destroying them when they collide with something. When I remove the particles it seems like everything works smoother but with the particles everything starts to go crazy

wintry quarry
#

and do you ever destroy the particle object?

oak gazelle
#

yes

#
 void Update()
 {
     if(Vector3.Distance(startPos, transform.position) > maxDistance)
     {
         //Instantiate(particleEffect, transform.position, Quaternion.identity);
         DestroySelf();
     }
 }
#

The game started using 8gb of memory, I honestly got no clue what's happening

wintry quarry
#

and they'll automatically get destroyed after that number of seconds

oak gazelle
#

Makes sense, I'll implement that

#

Each of these projectiles have it's own rigidbody and colliders

#

If I spam a bunch at once could that possibly break the game?

wintry quarry
#

i mean everything has limits

#

it really depends on how much "a bunch" is and your hardware

grand snow
#

Many thousands? Entities starts to be a good idea or a single manager to update them all

wintry quarry
#

if you spawn 50,000 at once, that's going to be a problem

oak gazelle
#

I'm definitely not doing that much

#

I'd say there definitely isn't more than 20 that exist at a time since they are also getting destroyed

wintry quarry
#

up to a few hundred is usually fine, depending on your target platform

#

might be rough on mobile but fine on PC

oak gazelle
#

man I honestly might just be better of restarting at this point

wintry quarry
#

you can use the memory profiler to see what's using memory

cursive sinew
oak gazelle
#

@wintry quarry

It doesn't actually tell me what it is. The section that keeps going up is the untracked

wintry quarry
oak gazelle
#

6000.2.5

#

I encounter same issues with 6000.2.3

oak gazelle
# wintry quarry which version of Unity are you using?

I've also gotten this

Invalid memory pointer was detected in ThreadsafeLinearAllocator::Deallocate! 0x00007ffa24f0341e (Unity) StackWalker::ShowCallstack 0x00007ffa24f12d29 (Unity) PlatformStacktrace::GetStacktrace 0x00007ffa261835ce (Unity) Stacktrace::GetStacktrace 0x00007ffa267599cf (Unity) DebugStringToFile 0x00007ffa24690fc4 (Unity) ThreadsafeLinearAllocator<0>::Deallocate 0x00007ffa24693bc1 (Unity) ThreadsafeLinearAllocator<1>::TryDeallocate 0x00007ffa246a31f2 (Unity) MemoryManager::TryDeallocateWithLabel 0x00007ffa246a4c03 (Unity) free_alloc_internal 0x00007ffa2567604f (Unity) ParticleSystem::DeleteClearedFences 0x00007ffa269febe9 (Unity) ParticleSystemGeometryJob::EndFrameCallback 0x00007ffa267e36e2 (Unity) GfxDeviceWorker::RunCommand 0x00007ffa267ed19c (Unity) GfxDeviceWorker::RunExt 0x00007ffa267ed2cf (Unity) GfxDeviceWorker::RunGfxDeviceWorker 0x00007ffa24c28e0e (Unity) Thread::RunThreadWrapper 0x00007ffafe1ee8d7 (KERNEL32) BaseThreadInitThunk 0x00007ffafef28d9c (ntdll) RtlUserThreadStart

wintry quarry
#

Are you using any plugins/assets?

oak gazelle
#

and yeah

wintry quarry
#

hmm maybe a bug in the particle system then

#

what components are on the particle system prefab

oak gazelle
#

Could be, I'm pretty lost

#

RigidBody, Sphere Collider

#

and I have a projectile script

wintry quarry
#

on the particles?

oak gazelle
#

its on the parent that holds the particles

wintry quarry
#

the particles have Rigidbody and collider?

#

Cna you show all the components that are on the partticles object and its children?

oak gazelle
#

I don't have any components on the fireball particle thing itself

#

It's using a material that uses a shader

wintry quarry
#

there's no ParticleSystem component anywhere?

oak gazelle
#

oh yeah hold on

#

sorry do you mean like what I have enabled within the particle system?

wintry quarry
#

I just want to know which components you're using

oak gazelle
#

These are the components on the prefab

vital vault
#

how can i lock mouse pointer in 0 0 so mouseX or mouseY will output movement since last frame?

slender nymph
#

how are you actually checking the input? because with the most common ways that is the default behavior

wintry quarry
#

but uh - yeah it already does that

vital vault
slender nymph
#

but note that locking the cursor has nothing to do with whether the way you query your input is a delta from the previous frame

wintry quarry
#

Indeed, but it's an answer to the first part of the sentence

amber salmon
#

Any good recourses to learn unity?

slender nymph
#

!learn

radiant voidBOT
wintry quarry
vital vault
#

and i want for mouseX and mouseY to become 0 at the end of each frame

vital vault
slender nymph
wintry quarry
#

Are those your own custom variables?

#

If so, then to make them 0 you would assign them to 0 yourself

#

mouseX = 0;

#

or simply don't make them member variables at all

vital vault
wintry quarry
vital vault
#

i mean

#

it reports mouse pos

slender nymph
#

show the code

vital vault
#

so i want to teleport mouse to 0 0 each frame after i read it

slender nymph
#

show the code

wintry quarry
#

show your code indeed

vital vault
#

a small correction fixed that

#

yeah im really dumb

dense eagle
#

hi

#

everyone

tall heart
#

anyone know how to make it so the animation plays fully and i cant play the animation again during it: IEnumerator Shoot()
{
canShoot = false;
animator.Play("M1911_Shoot", -1, 0f);

yield return new WaitForSeconds(animator.GetCurrentAnimatorClipInfo(0)[0].clip.length);

canShoot = true;

}

rich adder
rich adder
dense eagle
#

can someone help me? i am absolutely new at this of unity and an error in the app doesnt me create nothing

tall heart
radiant voidBOT
# rich adder !ask

:thinking: Asking Questions

:mag: Search the internet for your question!
:book: Use the API Scripting Reference and User Manual and this troubleshooting site for commonly posted issues.
:wrench: Attempt to debug your issue.
:thought_balloon: Find an appropriate channel by reading the name and description in #🔎┃find-a-channel
:grey_question: And don't ask to ask, ask a full question illustrating with screenshots if needed.

-# For more posting guidelines, go to #🌱┃start-here

dense eagle
#

i am 15 and i just want to become a programmer

dense eagle
rich adder
dense eagle
#

ok ok, sorry

#

so this is the error

#

when i download unity editor this appears

rich adder
#

most likely you have a permission issue going on with Hub and your pc

#

check logs to confirm

dense eagle
#

i just join to the server looking for an answer

fickle plume
radiant voidBOT
# fickle plume !install - Install into non-system folder, see the checklist. And ask general qu...
When Unity fails to install checklist
  • Make sure you have enough space including on C: drive.
  • Check that it's not being blocked by antivirus/security programs.
  • Look through the logs for a real reason why the setup fails they are pinned [here](#💻┃unity-talk message).

If you still have issues, perform a clean install in another location:

  • Install the Hub and Unity in a non-system drive or a clean new folder in the root of C: drive.
  • Failing that use the recovery Refresh option or reinstall OS entirely then repeat the previous step.
dense goblet
#

Im trying to call an outside script with a variable, is it possible to do something similar to what Im attempting here? ```using UnityEngine;
using UnityEngine.UI;

public class DungeonSpawners : MonoBehaviour
{
[SerializeField] private BoxCollider2D spawnerArea;
public string spawnerName;
[SerializeField] private SpawnManager spawnManager;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
spawnerArea = GetComponent<BoxCollider2D>();
spawnManager = GetComponent<SpawnManager>();
}

// Update is called once per frame
private void OnTriggerEnter2D(Collider2D collision)
{
    Debug.Log("Entered");
    spawnerArea.enabled = false;
    spawnManager.SpawnManagerProper(spawnerName);
}

}

error: ```No overload for method 'SpawnManagerProper' takes 1 arguments```
rich adder
#

what does that even mean

#

scripts don't get called... methods do

dense goblet
polar acorn
polar acorn
dense goblet
grand snow
#

yea it makes more sense when you know about method overloading

#

(you can use the same name with different args/return type)

#

hm? I was just explaining the language feature

hardy wing
#

How would I approach making my own canvas-like component, so a component that I can interact with and make it draw lines, arcs, circles. Whatever it needs. It shall be a generic component since I am doing multiple mathematical projects and plan to use it in all of them. An idea I had was using a LineRenderer but that wouldn't work with discontinuous lines. Say I a canvas where I am able to draw multiple non-connected lines. A solution would be multiple LineRenderer's but then I'd just be spamming Hierarchy with 7000 Line Renderer's which I don't expect to be very performant.

hardy wing
eternal needle
hardy wing
rich adder
eternal needle
rocky canyon
# dense goblet I know, I just needed someone to phrase it differently for it to click

start jotting them down in a notepad or a post-it note on ur wall lol 🙂
you'll come across most typical errors during a project
im sure you're familiar with some of them such as the Null Reference Exceptions but heres a little cheatsheet of Typical Unity Console Errors

  • NullReferenceException → Using something that’s null (not assigned).
  • Type Mismatch / Cannot Convert → Wrong data type (e.g., float into an int).
  • Index Out of Range → Accessed a list/array slot that doesn’t exist.
  • No Overload for Method → Called a method with the wrong number/type of arguments.
  • Name does not exist → Misspelled variable/method or used it out of scope.
  • MissingReferenceException → Object was destroyed but code still tries to use it.

thats all i can think of off-hand that most people run into.. I'll add to it as i think of more

raw shore
#

am I stupid or why doesnt any tutorial about movement work, I tried for unity6 and didnt worked so now I try for unity 2022 LTS and I have some bugs

rich adder
slender nymph
#

be more specific about what is going wrong

rocky canyon
#

they all work but its probably ur Input

#

if ur Active Input Handling is set to New and ur trying to use the old Input. class

raw shore
rocky canyon
#

for example u wouldnt receive inputs... Debugging the values of those variables would let u know

raw shore
#

and ik about the new input

#

with actions and all that stuff

#

right now I am watching for camera looking

rocky canyon
#

ok cool.. just checking cuz when i first installed 6+ it was defaulted to New and none of my older scripts would work

hardy wing
#

although i'm not sure why unity resets the setting when migrating projects

rocky canyon
#

yessir... took me a while to embrace but im finally using it

hardy wing
rocky canyon
#

i just changed the Version in the Hub and re-opened my old project

#

for w/e reason it didn't keep the Active Input setting

raw shore
#

can I swear is the server (not to someone but to a problem)

rocky canyon
#

hell no.

raw shore
#

I mean you used hell

rocky canyon
#

i didn't fucking either 👀

rocky canyon
raw shore
#

k so u can but not explicit

rocky canyon
#

just don't be cussing other people 😄

raw shore
#

cuz WTF is this

ivory bobcat
raw shore
#

😭

rocky canyon
#

that would be a falling rigidbody that doesn't have its Constraints locked on the X and Z

#

guessing

raw shore
#

you mean position no ?

ivory bobcat
raw shore
#

I putted now freeze position

rich adder
#

why would you freeze position..

raw shore
#

idk man I really dont know

#

I want a tutorial for true noobs

rich adder
#

if its rotating forward with AddForce then you lock the rotation

raw shore
#

50% are too fast

#

and other wants you to know a part

rocky canyon
raw shore
ivory bobcat
raw shore
#

does anyone have a good tutorial ?

slender nymph
#

!learn

raw shore
#

that explains slow

radiant voidBOT
raw shore
#

I tried to look and I will say no for now

#

I dont have the time for that

slender nymph
#

then you're only going to find shit tutorials that you don't understand

raw shore
#

ohhh bad

rocky canyon
raw shore
#

I mean is an improvement

#

is moving

edgy sinew
#

godot color theme in unity kekwait

raw shore
#

nope Unity pathway theme

#

I watched that part and I can say the colors are stupid

#

harder to see text

cursive sinew
#

Hi, I've been having this issue where Unity completely freezes for 5 seconds after I press play, even after I stop and resume the editor. There's no console messages for it and the only information I've gotten is this window that only shows if I stop the play before the freeze happens.

I've tried reimporting the entire project's library and also tried deleting absolutely everything in the scene, but the error still happens.

Does anyone have any ideas what I can check next to find out what's causing this problem? I haven't coded anything.
https://cdn.discordapp.com/attachments/497874004401586176/1419551763140444361/image.png?ex=68d2d4da&is=68d1835a&hm=603becd12e6e358ee4ba7e1322077b70f7f001398e980d55850b9b9e2326db51

boreal cloak
#

can i ask for help with unity hub here or is it in a different chat

rocky canyon
rich adder
raw shore
#

so back to the subject how to I make the camera work

rocky canyon
#

whats not working about it?

raw shore
#

I am not in player

#

but I can look

rocky canyon
#

well drop the camera inside the player

#

and the position it where it need to be 🤔

polar acorn
edgy sinew
raw shore
#

it has a cameraHolder

ivory bobcat
rocky canyon
raw shore
#

I made it kinda KINDA work still weird but better

rocky canyon
#

step by step 😉

raw shore
#

k so on full screen it works

#

I still have to problems

#

first is it good if when mouse is moved up the camera to look down ?

#

and the sensitivity is big but I can change that

ivory bobcat
raw shore
#

what is better

ivory bobcat
#

yes

raw shore
#

and one more problem the character is looking up when I press start

#

is it ok or ?

ivory bobcat
raw shore
#

it doesnt happen anymore cuz it takes a while to start and I put in center

#

but ow do I make when the player is moving mouse up to look up

#

right now mouse up means look down

#

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

public class PlayerCam : MonoBehaviour
{
public float sensX;
public float sensY;

public Transform orientation;

float xRotation;
float yRotation;

// Start is called before the first frame update
void Start()
{
    Cursor.lockState = CursorLockMode.Locked;
    Cursor.visible = false;
}

// Update is called once per frame
void Update()
{
    float mouseX = Input.GetAxisRaw("Mouse X") * Time.deltaTime * sensX;
    float mouseY = Input.GetAxisRaw("Mouse Y") * Time.deltaTime * sensY;

    yRotation += mouseX;

    xRotation += mouseY;

    xRotation = Mathf.Clamp(xRotation, -90f, 90f);

    transform.rotation = Quaternion.Euler(xRotation, yRotation, 0);
    orientation.rotation = Quaternion.Euler(0, yRotation, 0);
}

}
this is the script

polar acorn
slender nymph
radiant voidBOT
raw shore
#

k so now no more Time.deltaTime

#

nope it is worst now no more sensitivity now without it

slender nymph
#

please read all of the information presented to you instead of seeing one thing and making that change with no other changes

polar acorn
#

Did you look at the page that was linked

#

It's literally in a big box with a yellow warning sign on it

#

I don't know how it could have been made more easy to spot

raw shore
#

I know that I need to reduce

#

I made it 30 from 170 and it was a lot

#

too fast

slender nymph
slender nymph
raw shore
#

is still kinda fast but WAY better

#

I will try 0.5

#

0.7 is best

#

so now how do invert the look up down

slender nymph
#

think about how you are currently handling rotating up/down. then using basic math, how could you reverse that

raw shore
#

transform.rotation = Quaternion.Euler(xRotation, yRotation, 0);
orientation.rotation = Quaternion.Euler(0, yRotation, 0);

#

this is what I have

#

for rotation

slender nymph
#

that is not the entirety of it

raw shore
#

ik

#

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

public class PlayerCam : MonoBehaviour
{
public float sensX;
public float sensY;

public Transform orientation;

float xRotation;
float yRotation;

// Start is called before the first frame update
void Start()
{
    Cursor.lockState = CursorLockMode.Locked;
    Cursor.visible = false;
}

// Update is called once per frame
void Update()
{
    float mouseX = Input.GetAxisRaw("Mouse X") * sensX;
    float mouseY = Input.GetAxisRaw("Mouse Y") * sensY;

    yRotation += mouseX;

    xRotation += mouseY;

    xRotation = Mathf.Clamp(xRotation, -90f, 90f);

    transform.rotation = Quaternion.Euler(xRotation, yRotation, 0);
    orientation.rotation = Quaternion.Euler(0, yRotation, 0);
}

}

slender nymph
#

here's a little hint for you: that last message was a hint that you need to look before those lines you sent

#

also again share code correctly

#

!code

radiant voidBOT
raw shore
#

oh so that was the command

#

I forgot it thanks

slender nymph
#

it's been less than 10 minutes since i last used it for you

raw shore
#

oh sorry :(((

edgy sinew
raw shore
#

yes

slender nymph
edgy sinew
#

I'd have a variable to turn that on/off... right? some users won't want / need it

#

public float y_invert = -1.0f; usually how i do it

#

Then, in one of your parts.... Multiple by that

#

xRotation += mouseY * y_invert;

raw shore
#

I dont want to hear math right now I had 2 hours at school that burned my braincells

edgy sinew
#

... Brother we're flipping the value...

slender nymph
edgy sinew
#

If it's not that one, multiply it to the other one

rich adder
edgy sinew
#

Trust me, sooner than later, get very literal about what the computer is doing

slender nymph
# raw shore ik :(((

if you're just here to get spoonfed answers, then kindly fuck off. if you want to actually learn what you are doing, then you need to actually engage with the information presented to you.

raw shore
#

finally it worked thanks for all guys

edgy sinew
#

Cheers bro, for homework assignment flip the left/right too 😉

raw shore
edgy sinew
#

Late nights, we are all burning our brains man

raw shore
#

I had 7 hours 😭

edgy sinew
#

You just get used to it, get addicted to it

rocky canyon
#

well, take a break ¯_(ツ)_/¯

slender nymph
edgy sinew
#

How cracked do you wanna be? Drawing diagrams of Update Loops and stuff?

raw shore
#

I try to make 8-10 learn

edgy sinew
#

Matrix math?

raw shore
#

and 9-11 implement

#

9-11 PM

rocky canyon
#

👀 my first year was like 4-5 hrs learning and then the rest of the day implementing.. 1 hr doesn't seem like enough tbh

raw shore
edgy sinew
raw shore
#

and the dumb schedule of goig at 13

rocky canyon
#

lol.. i have job and family.. gotta do what u gotta do

raw shore
#

I like more to go to school from 8

edgy sinew
#

I think what everyone's trying to say, is to develop the skill to break things down and understand them at a more simple level

rocky canyon
#

good luck guy

raw shore
#

I putted -

raw shore
slender nymph
# raw shore I putted -

i mean, that's certainly one way to do it. alternatively you could have changed your += to -=

raw shore
#

so right now I am 15 so I wont go into making games like schedule one but like small games

raw shore
#

k so now movement I need to go into

edgy sinew
#

for example in this case it would be "every frame, the computer adds the difference in mouse position, and moves the camera accordingly"
hence the solution is
"every frame, invert the mouse Y delta value so that up instead goes down"

raw shore
#

after that a collectable pizza with task up

#

or enemy AI

#

with the idle chase shoot

#

so better to do the simpler one

edgy sinew
#

Jason Weimann git-amend

#

They have videos on those things. And they're usually pretty solid in the strategies they use

raw shore
#

and after both of them menu and only need to think about a more complex idea for the game jam

#

its in 17 days so I want to prepare

edgy sinew
#

oh yeah the horror game? thing

raw shore
#

yes

edgy sinew
#

anyway going off-topic here. Wish u luck, make sure to check out those YouTube channels because they'll probably answer 90% of what you need

raw shore
#

subscribed to them

#

so I wont need to search again the names

hardy wing
cursive sinew
# ivory bobcat Have you tried looking up the issue with a search engine (Google)? Maybe provide...

Thanks for the response! Yeah, I saw that result, but I assumed it wasn't something to do with code since I haven't written any yet and it still occurs in brand new scenes with nothing placed. I'm also unsure how to debug where the freeze would be happening since the console doesn't have any information - is there a way I can check what code is being ran on play? Because I do have a bunch of assets imported

misty dagger
#

Hey all, new to Unity.

I’ve recently started learning Unity since the weekend; I’ve started the Unity learn pathways (essentials & junior programmer). I am kinda picking things up but often find myself overwhelmed by the amount I’ve got to learn.

Realistically, where can we somewhat expect to be after the junior programmer course Unity offers for free?

winged ridge
# misty dagger Hey all, new to Unity. I’ve recently started learning Unity since the weekend;...

Great question
So the junior pathway offers you chances to learn the principles of the engine, combine it with the creative core, you will have the basic understanding to make games such as railway surfer, if you do some of their other courses, Tanks a top down 2D strategy game. It also allows you the chance to experience and decide which path of game dev you want to focus on, letting you understand the things you may need to research going forwards.
It does however at the moment miss out on certain aspects of C# programming, but I'm sure there are plans

misty dagger
winged ridge
#

Outside of paying
YouTube or W3Schools

slender nymph
#

there are beginner c# courses pinned in this channel

cursive sinew
misty dagger
#

legends, thank you!

silent obsidian
#

I have two Input System action maps: one for gameplay and one for UI. Both maps have a left click action. Is there a built in way to ensure that clicking on a UI element only triggers the UI action map and not the gameplay action map?

rocky canyon
#

EventSystem's .IsPointerOverGameObject()

rich adder
#

You can also Disable / Enable actionmaps
input.Player.Disable()
input.UI.Enabled()

twilit echo
#

hey anyone know why my unity does this?

#

i just recently reinstalled and it just did this

rocky canyon
#

if the UI ur talkin about is like a Menu or something that u toggle then u can just disable the Game Input when its open #💻┃code-beginner message like nav said

#

but if its something like an overlay thats always on the screen u can check the event system and use a bool or something to early return

rocky canyon
rich adder
twilit echo
twilit echo
#

thanks tho

rocky canyon
#

another thing could be DX11 / 12 issue.. sometimes changing that API will fix it.. but i've never seen that in the Hub only in the actual Editor

rich adder
#

its built on Electron right?

rocky canyon
#

its this but like i said.. only ever seen that affect the Editor and not the hub

rich adder
rocky canyon
#

if so, TIL 🙂

rich adder
#

I knew it was built on JS just not sure whic framework

silent obsidian
twilit echo
#

wait whats the fix cause i cant find it on here

rich adder
twilit echo
#

ohhhh

#

alr

rich adder
#

do you have an nvidia gpu

twilit echo
#

yep

#

i just updated it too

#

so its not a driver issue most likely

#

this has been happening with vs code too for a while

rocky canyon
rich adder
#

meltinnn

rich adder
#

coincidentally vscode also a electron app

rocky canyon
#

lol.. the evidence is mounting

twilit echo
twilit echo
#

i genuinely thought i had malware or something

#

for the first while

twilit echo
#

oh hey thanks

#

ill do that right now

rocky canyon
#

check out that entire thread.. also google unity and vscode visually glitching

#

and also i just noticed we're in code channel.. take it over to #💻┃unity-talk if u need to keep troubleshooting

twilit echo
#

alrighty

hardy wing
#

now i just need to find a way to convert virtual space into world space

misty grotto
#

can someone help me add animations to this model? i downloaded a model from unity asset store and it came with animations but they dont work when i press play, i followed every tutorial i could but it wont work

slender nymph
#

is that question code related? if so, you should consider sharing the code

misty grotto
#

No sorry.

slender nymph
urban condor
#

Hi! I'm wondering if anybody could help me optimize/tidy my code? 🙂

    IEnumerator LoadSession()
    {
        audioMixer.GetFloat("Master", out float mixerVolume);
        animator.SetBool("isActive", false);
        float currentVol = 0;
        float audioFadeStep = 0.025F;

        for (float i = 0F; -79F <= i; Mathf.SmoothStep(0F, -80F, i -= audioFadeStep))
        {
            currentVol = i;
            yield return audioMixer.SetFloat("Master", currentVol);
        }

        int sceneToLoad = UnityEngine.Random.Range(1, SceneManager.sceneCountInBuildSettings);
        yield return new WaitForSeconds(4);
        SceneManager.LoadScene(sceneToLoad);
    }
polar acorn
#

Is there a problem with it

urban condor
#

it's fine, i just want to learn better code practices when it comes to writing code

#

i posted in #🔊┃audio because i was struggling with getting the audio mixer to work in a coroutine but i got it working on my own eventually

#

it just didn't seem appropriate to ask the above question in that channel!

polar acorn
urban condor
polar dust
#

the only thing I can maybe think is why is mixerVolume unused?

eager elm
polar dust
#

overall it looks fine? if you want to save yourself any sort of future struggles, as it works, do not touch the method again until a time in the future when you need to change it

urban condor
#

thank you both!

#

for context i work in the games industry as a tech designer and want to pivot into gameplay engineering, so these are good things to know

#

why does Log10 need to be multiplied by 20 btw?

slender nymph
#

note that with that formula the min value should be 0.0001 so that it's -80, if it goes to 0 it will be negative infinity and unity will just treat it as full volume

eager elm
# urban condor why does Log10 need to be multiplied by 20 btw?

Mathf.Log10(0.0001f) equals -4
-4 * 20 = -80 (the lowest value of the audio mixer)
and that value goes closer towards 0 (full volume)

Why it is that way I don't know. (You should also start you fade in with 0.0001f since starting with 0 might cause problems)

heady smelt
urban condor
#

thanks a lot for explaining all 😄

heady smelt
# eager elm Mathf.Log10(0.0001f) equals -4 -4 * 20 = -80 (the lowest value of the audio mixe...

This sent me on a little bit of a quest to answer this question for myself, so I thought I would share an answer I found on Reddit:

[jayd00b writes]:

The answer to your question involves a bit of history and a bit of mathematics. The decibel was originally used to describe 10 "bels", a unit of measurement that came out of Bell Laboratories in the 1920s. While rarely used on its own, one bell is simply the base-10 logarithm of a ratio of a measured power to a reference power:

1 bel = log10(w / wRef)

Thus a decibel (deci- prefix meaning 10) is 10 times that logarithm:

1 decibel = 10 X log10(w / wRef)

So why do we use 10 X log10(w / wRef) for power ratios and 20 X log10(p / pRef) for amplitude ratios? You can look up a formal derivation, but take my word for it when I say that acoustic intensity (or power) is proportional to pressure squared.

w ~ p2

If we take our decibel equation for a power ratio and substitute in p2 for w, we get:

dB = 10 X log10( p^2 / p^Ref2 ), which using rules of exponents becomes:

dB = 10 X log10( (p / p^Ref)2 )

Using this rule of logarithms: log( A^n ) = n X log(A), we get:

dB = 2 X 10 X log10(p / p^Ref), or more simply put:

dB = 20 X log10(p / p^Ref)

https://www.reddit.com/r/Acoustics/comments/aiqdeo/comment/eeq16k5

tl;dr acoustic power is proportional to the square of the sound's pressure. Rewriting the base10 log of (x^2) gives you a 2 out, and then it's multiplied by 10 because it's literally just "deci"-bels, and so you arrive at the factor of 20.

Reddit

Explore this conversation and more from the Acoustics community

weak trail
#

Do you guys recommend to install the latest version of unity

#

Or the 2022 one

wintry quarry
#

Unless you have some special reason

weak trail
#

is a copy of clash royale

#

in simp,e terms

heady smelt
# weak trail im a complete beginner i have a project in mind

You should probably install the newest version of Unity 6 and then look at some of the "Learning" Projects from within Unity Hub. You'll probably want to learn how to use the AI Navigation Package at some point as well if you have that game in mind as a goal.

edgy sinew
#

Remember this one for later! Where the game resolution options are, there’s a VSync (Game View Only)

weak trail
#

Thank you so much for the help! Im currently downloading the latest version

edgy sinew
#

On desktop platforms, Application.targetFrameRate is unreliable. It’s in the Unity Docs

hardy wing
edgy sinew
#

So for easy VSync to your monitor, definitely use that check box. For built executables it can be configured in project settings or in code QualitySettings.vSyncCount = 1

weak trail
edgy sinew
#

We can analyze that a bit and break down what’s required

weak trail
edgy sinew
#

The camera is uhh… Orthographic I think right? Not isometric tilted, but, no perspective either

edgy sinew
#

Maybe, every character on the field has its own state?

weak trail
#

Can i add you ? Maybe u can give me some feedback if i need to

edgy sinew
#

If it’s moving, waiting, attacking.

#

It’s better to chat here, everyone can gain from the knowledge 🙂

weak trail
#

Bet

#

Yeah so

#

Its basically Tower defense game

edgy sinew
#

As I understand it, there’s some fundamental things to solve there

#

Like, how to “deploy” a new unit right

#

That’s gonna be Object Pooling right there. Unity has its own built in version

weak trail
#

This was made with unity

edgy sinew
#

How does each unit know what to be doing at a certain time? That could be done with State.

#

And there needs to be some Physics checks happening, like for proximity to other units etc

#

Someone else said NavMesh / AI path finding before, that’s another topic to know

#

Are you familiar with OOP? Composition vs Inheritance? Dependency injection? Singletons?

#

Scriptable Objects as shared data containers

weak trail
edgy sinew
#

Polymorphism! Interfaces. Huge one. That’s how any enemy in the game can “take damage” from any source

#

That’s also usually how State works. You’ll see what I mean when you look into State Machines

#

The best advice I can give you, is start collecting knowledge know and keep it organized

#

Folders of screenshots, website bookmarks, your own writing or diagrams

#

Everything I just said ☝️ too

weak trail
edgy sinew
#

Have you programmed in other languages?

#

Web Dev (JS)? Python?

weak trail
edgy sinew
#

Okay. It’s really not bad once you get the main idea of what Unity really does

weak trail
#

U seem very knowledgeable

#

Im gonna have to keep everything organized and learn step by step i already have the idea in mind i just need to figure how to execute it

edgy sinew
#

Probably your first few steps are…

  1. Download some Kenney NL assets and get a level design going, get some character models in
  2. Maybe a bit of lighting research, HDRI perhaps, or free procedural sky asset on UnityAssetStore
  3. Get the models to “spawn in” probably on like a timer, or a coins system whatever (Object Pooling!)
  4. Get the models to walk towards the enemy tower
#

A good while, but in Unity I’m under 1 year. The helpful people on here know way more than me

weak trail
#

There is a lot into it

edgy sinew
weak trail
edgy sinew
#

It’s surprisingly straightforward to make different units do different kind of stuff.

#

But that’s only after you have all the necessary strategies in place.

#

Strategies or technically Game Dev Patterns are basically the “accepted efficient way” to get things done in some problem solving situation

#

Or in some cases, the value of the Coding Pattern is that it makes your code easier to work with, easier to add stuff to.

weak trail
edgy sinew
#

Yes, sharing functionality is essential when building these kinds of games

#

For example you have 2 enemies on the map… Goblin, and Wraith

They can both do a Splash Damage attack, but with totally different parameters

  • Splash Damage Radius
  • Damage Type (instant or over time)
  • Damage Dealt
#

Instead of coding 2 different Splash Damage effects

#

You would have these parameters be set by the unit itself

weak trail
edgy sinew
#

So they all use the same exact code, just configured how each character needs it.

weak trail
#

Because im just gonna copy the abilities of the clash royale cards already existing just make my own characters

#

I want to add also arenas Also a leaderboard badges for top placements i have a lot in mind

wintry quarry
weak trail
edgy sinew
#

Yes write all the knowledge and terms down for later. I g2g, wish you luck on this journey. Be sure to ask us here when things get confusing!

weak trail
edgy sinew
#

Tutorials are wrong sometimes but. I can recommend Jason Weimann and git-amend on YouTube

wintry panther
#

Not sure this is the right place for this, but when i try to open a project in unity hub, the loading screen pops up but then closes and the project doesnt open

#

i also tried to make a new project, but after i made it it didnt show up in the projects view

radiant voidBOT
# teal viper !logs
📝 Logs

Documentation

Editor logs

Windows: %LOCALAPPDATA%\Unity\Editor\Editor.log
MacOS: ~/Library/Logs/Unity/Editor.log
Linux: ~/.config/unity3d/Editor.log

Unity Hub

Windows: %UserProfile%\AppData\Roaming\UnityHub\logs
Mac: ~/Library/Application support/UnityHub/logs
Linux: ~/.config/UnityHub/logs

wintry panther
#

what am i looking for exactly?

teal viper
wintry panther
neon glade
#

Hi, so ive made an enemy that patrols an area but i wanted to make it so that they chase the player if they are seen. this is my coding but it doesnt chase the player. any tips?

slender nymph
#

also !code 👇

radiant voidBOT
neon glade
edgy sinew
# neon glade

“If they are seen” what is the detection method?

#

I’m only seeing that you start a Coroutine… when the program starts ?

neon glade
#

i was thinking raycast?

#

because i copied it based off player interaction mechanic

edgy sinew
#

So.. Where is that code? Or that isn’t written yet

teal viper
# neon glade

That's still not a valid wat to share code... Read the bot message.

edgy sinew
#

This video seems to show some of that kinda stuff.

#

Oh I think I get it. So that Coroutine you start in... Start() - that's the patrol one right? So they start patrolling from the beginning.

#

Well okay good night! and good luck blushie

timber tide
#

way too many raycasts

#

just need a a square then angle check

true fulcrum
#

would this be the channel to ask about help with visual scripting? :o

edgy sinew
#

You suggest a square - would that be placed always at the enemy transform.forward? So it would automatically only detect things in front.

#

I was thinking a sphere trigger collider and the angle check. Theoretically if there's some "max detection range" the sphere collider is shaped such that, well, that works

#

With the front-facing square, it does eliminate the detection of things "not in view" / behind the enemy. But to enforce some max detection range I think Vector3.Distance is inevitable?

timber tide
#

Depends what you're going for, but if you have a max distance then overlapbox with uniform sides. OverlapSphere should work similarly, but a box can give you the full 180 without any extra maths, while you can get 360 with the sphere similarly, but you'd also be doing check behind the character so that may not be needed

edgy sinew
#

I once saw some project that did 1 raycast per frame, with angle shift. So it'd cover a range of let's say 45 degrees total, over 9 frames or something. 9 raycasts, 5 degree difference each frame

#

I wonder, if that yields better performance than overlapbox, overlapsphere, sphere trigger collider, etc

#

Like a, rotating looping Raycast sweep thingy.

timber tide
#

I'd still use a single raycast after doing the angle check, if it passes -> raycast to check if LOS is blocked

edgy sinew
#

Hm. Yeah right? I feel like the Physics detection is more valuable than the raycast

#

It's easier to decide what to do, once nearby [thing] is detected

timber tide
#

basically you get the dot product between the two then I think the cos gives you the angle? Been a second but Unity usually has methods to shortcut it

edgy sinew
#

It may be faster to do it in a math way, but yeah there's like Quaternion.AngleAxis or Vector3.SignedAngle etc

timber tide
#

Ah right SignedAngle would work

edgy sinew
#

gn 💤 🧀

chilly vigil
#

!code

radiant voidBOT
chilly vigil
#

https://paste.mod.gg help me please tryinging to follow code monkey's grid system

teal viper
chilly vigil
#

I am trying to create an text based world system on the grid for the a* pathfinding because I have not figured out the node based a* path yet I am following code monkey a* tutorial that is my goal

teal viper
#

Still not clear what the issue is.

#

A proper way to describe an issue would be:

I want A to happen(the relevant code is on line xyz), but instead B happens.

Adding a screenshot or a video can be helpful too.

chilly vigil
teal viper
#

If it's not an actual issue but a question about implementation, you'd ask:

I want to implement a feature/mechanic/system, where xyz happens. How do I approach it?

Sharing some examples from existing games can be a helpful addition.

true fulcrum
naive pawn
wooden hemlock
#

ok thanks!

hardy wing
#

When I want to enable scrolling, how would I go about that? Could I just set a target camera position and then lerp into it or would that not feel smooth? thonk_rotate

#

No, this scrolling feature is not an UI, it is in world space.