#💻┃code-beginner

1 messages · Page 808 of 1

tired python
#

that ends up changing the shape of the spline...

swift crag
#

Get them oriented correctly first, then rotate things as needed

tired python
swift crag
#

You want them to look like this in the 2D view

#

Select all of the knots at once and then give them a rotation of :

0, 0, 270

#

That will get them oriented reasonably. You can then adjust the handles.

dreamy lance
#

how do i do the code block thin in discord ?

swift crag
#

!code

radiant voidBOT
swift crag
#

```cs
like so
```

swift crag
#

which is probably what you want

#

the "Broken" mode allows for the handles to be positioned arbitrarily

dreamy lance
#
public class GoblinUnit : EnemyUnitParent
{
    // Start is called once before the first execution of Update after the MonoBehaviour is created
    void Awake()
    {
        maxHealth = 2;
        currnetHealth = maxHealth;
    }

   

}
using UnityEngine;

public class EnemyUnitParent : MonoBehaviour
{
    public float maxHealth;
    public float currnetHealth;
    public float attackSpeed;
    public float attackDamage;
    public float moveSpeed;
    public float resistance;


    public void Death()
    {
        if (currnetHealth <= 0)
        {
            Destroy(gameObject);
        }
    }
    public void TakeDamage()
    {
       if (Input.GetKey("t"))
        {
            currnetHealth -= 1;
            Debug.Log(currnetHealth);
            Death();
            
        }
    }
    public void Attack()
    {

    }


    void Update()
    {
        TakeDamage();
        
    }

}

any idea as to why my enemy isnt dieing when i hit "T"... im stuggling... to me the logic makes sence
if i put the death in update it insta kils them tho

swift crag
#

I'm not sure if GetKey accepts a lowcase letter like that

#

Try using KeyCode.T instead of a string

solar hill
#

i think it does

#

nvm, it should be capital T

swift crag
desert loom
#

It's not exactly code, but has anyone worked with VFX graph and Shader Graph together? Im having trouble making my VFX Tile properly. Even though its showing up in all the previews as it should

swift crag
#

(and show an example of the problem)

desert loom
swift crag
#

(if you want to go the extra mile, export a .unitypackage with your VFX graph and shader graph assets)

dreamy lance
verbal berry
#

anyone know how to get svg files to import into a project to e used as a sprite?

verbal berry
#

in pm it says i have vectorgraphics installed is that what i need

wintry quarry
#

yes

verbal berry
#

any idea why it doesnt work then?

wintry quarry
#

wdym by it doesn't work?

#

How are you expecting it to work and what's happening instead?

verbal berry
#

i assumed youd need to assign the svg to a game object before using it yet that still doesnt work

wintry quarry
#

svg files are asset files

#

unity creates assets from asset files - in this case it will create textures from them

#

you can use those textures or sprites in SpriteRenderers or other renderering components

verbal berry
#

alright

wintry quarry
#

You'd have to show exactly how you tried to do it and I can point out what you might be doing wrong

verbal berry
#

in the inspector i should set the generated asset tyupe to texture 2d im assuming

wintry quarry
#

Not if you want to use it with a sprite renderer

#

How do you want to use it?

#

In a SpriteRenderer?
As an albedo texture in a material?
In the UI?

verbal berry
#

in a sprite renderer yes i just want to be able to use it as a sprites texture not for a material or anything

swift crag
#

okay, so you need the importer to produce Sprite assets

wintry quarry
#

if it's not showing you sprite as an import option

#

In the package manager do "Add package by name" under the + sign and enter com.unity.vectorgraphics

#

Then you should see all these options

verbal berry
#

i have that in my built in pm and it says its installed

#

com.unity.modules.vectorgraphics

wintry quarry
#

do what I wrote above

#

that module only gives you ui toolkit and texture2d capabilities

#

you need this one for sprites

#

About this package

For Unity 6.3 and later, this package works on top of the built-in Vector Graphics module to provide additional import types:

Sprite Import: Import SVG files as Unity Sprites for use with Sprite Renderer.
uGUI Import: Import SVG files as UI Images for Unity's uGUI system.
verbal berry
#

tysm man

#

are all packages installed through unity safe i can see this one is just for future use

verbal berry
#

as in could have malware in

#

or are they all official

solar hill
#

The Registry packages are official

verbal berry
#

nice

wintry quarry
verbal berry
#

alright thanks for the help

cunning bramble
oak remnant
#

Hello, how do you make a Monster fly and attack smoothly, like in hollow spirit, can i post a video to explain what i need?

frail hawk
#

go ahead

#

@oak remnant

#

but i doubt anyone will give you the working code for that

#

you might want to ask for something particular instead

oak remnant
#

i dont want to know the working code, but to know if they have any idea how to do it, in the sense of what command to use, not exactly the exact algorythme but some clue maybe i dunno

#

Are you unsure of in Hollow Knight Silksong how to beat bird boss in Greymoor or how to navigate Craw Lake in Hollow Knight Silksong? This Hollow Knight Silksong Greymoor bird boss fight guide will exemplify in Hollow Knight Silksong how to beat the bird boss in Greymoor. Follow along for a brief Hollow Knight Silksong Craw Lake guide as well.

...

▶ Play video
#

it is the way the flying monster moves around smoothly

golden canopy
#

guys im so confused with the new input system

#

i cant understand a single video for touch controls

hexed terrace
fossil axle
#

where should i go to ask for help with optimization? i have a script that causes a massive use of memory and im trying to fix it

sour fulcrum
#

Here is fine

eternal needle
fossil axle
eternal needle
wintry quarry
#

if it's obvious, someone will tell you what's wrong

#

if it's not obvious, someone will show you how to use the profiler

vapid egret
#

Hello everyone. Can someone explain the difference between world direction and local directin?

ivory bobcat
vapid egret
#

ty

wintry quarry
vapid egret
ivory bobcat
#

If the object isn't a child of anything, moving relative to world or local would produce the same result.

wintry quarry
vapid egret
#

Yeah I'm seeing that now that I'm trying it. I guess I should get the player's input to cancel sprinting

wintry quarry
#

It's not clear to me exactly what you are trying to do

#

We don't even know what kind of game this is exactly so it's hard to visualize anything you're talking about

vapid egret
#

Action RPG. Third Person Camera with first person controls. Rotation is restricted to Look(mouse delta / right stick). Movement is WASD and left stick. holding sprint will increase the player character's speed. I want sprint to cancel if the player moves backward (S / left stick down).

wintry quarry
fresh fern
#

Hey, i am having a bit of trouble, so i figured i should ask (maybe wrong channel, not sure): how do they make it in pixel art games so that all the characters flip around seamlessly? I am trying to make one and the pivot points are just messed up, if i set them in the middle, when i use flipX on the characters they look SO weird

#

Almost like they are taking a step backwards

spare mountain
#

but yes, wrong channel

fresh fern
#

Oh

#

Thought it should be fixed with code

spare mountain
#

ehh I wouldn't fix it with code

slender nymph
#

you can manually adjust the pivot point in the sprite editor

fresh fern
#

Because setting all
These pivots manually

#

fresh fern
slender nymph
#

ideally you would create/slice your sprites in such a way that their pivot is automatically in the center.
this is really on you if you didn't do that in the first place

spare mountain
fresh fern
spare mountain
fresh fern
#

Sorry guys, i am a beginner

#

My assets are from asset stores

spare mountain
#

ah

#

weird that they didn't set them up nicely then

fresh fern
#

So is there anything i can do?

spare mountain
fresh fern
#

How

spare mountain
#

but you can just do it in the sprite editor

slender nymph
spare mountain
#

probably more effort than just doing it in the sprite editor

fresh fern
#

Yeah but more precision

#

I suppose

spare mountain
elfin pike
#

no idea, why it console logged twice with one input, but strange error shows up.

fresh fern
#

i desperately need help. i have a tilemap, which by default uses the sprite lit material, but i used to see screen tearing in play mode. i switched to a material i manually created, and the screen tearing was gone, so i thought i was finally free to continue development in my game, but when i tried making a build, the screen tearing is still there and it is even worse. i have tried everything from different materials to pixel perfect camera to deleting and recreating my tilemap, to a combination aof all the above, to using chatgpt, to i dont know i have lost track. please help me

fresh fern
#

yes

#

mostly horizontal but also vertical sometimes

#

grey lines you know

elfin pike
# fresh fern yes

its rendered taking next pixel from tilemap (commonly its white). Look up SpriteAtlas

fresh fern
#

i cant say i understand what you just said, but i will look up "sprite atlas"

elfin pike
#

im suprised you didnt find it with google. its first thing to pop up about your topic

fresh fern
#

in the build i mean

#

play mode still works alright

elfin pike
fresh fern
#

no

#

wait]

#

lemme try

#

i did now

#

no tearing

#

it is only exclusively in the build

#

oh god i have spent so much time on this project if it just gets trashed because of that i am going to literally crash out

#

please someone help me how do i remove screen/ tilemap tearing

sour fulcrum
#

Where is this from

elfin pike
fresh fern
#

thank you lemme try that

#

all of that was already set up

sour fulcrum
elfin pike
#

@fresh fern how it looks? lines or delayed pixel movment?

fresh fern
#

it is grey lines

fresh fern
#

some vertical

#

the sprite atlas did nothing

#

and i tried all of its settings

elfin pike
fresh fern
#

what do you mean

elfin pike
#

i Hope @sour fulcrum this isnt against rules

sour fulcrum
#

That’s a different problem i believe

fresh fern
#

i dont know if it is, but it didnt help me

elfin pike
fresh fern
#

okay i will later, i have an idea for something to try first

elfin pike
#

OnDestroy i unassign function from input action, but doesnt unassigns, getting errors

naive pawn
#

why are you looping over _List but using _InputActionRef

naive pawn
elfin pike
naive pawn
#

hm wait the stacktrace seems to be from inputsystem.. i don't think i can help much past basic debugging as im not at my desk right now

naive pawn
#

keep in mind that i'm not looking over your shoulder and i'm not psychic, i have no info about your project, code patterns, or this specific script outside of the small snippets you've shown

elfin pike
#

i think, issue is with editor firing 1 function on 1 call 3times. 1 out of 3 times.

#
    {
        Debug.Log($"Index: {index}");

        //For setting selectedIndex to clicked slot.
        BlockSlot selectedObject = EventSystem.current.currentSelectedGameObject.GetComponent<BlockSlot>();
        if(selectedObject)
        {
            selectedSlotIndex = LoadoutList.FindIndex(slot => slot == selectedObject);
        }
        else return;

        LoadoutList[selectedSlotIndex].SetRune(blockTypesOrder[index]); //127 line
        selectedSlotIndex = (++selectedSlotIndex) % LoadoutList.Count;

        //Sets selected slot
        if (eventSystem != null)
        {
            var baseEventData = new BaseEventData(eventSystem);
            eventSystem.SetSelectedGameObject(LoadoutList[selectedSlotIndex].gameObject, baseEventData);
        }
    }```
#
    {
        for (int i = 0; i < blockTypesOrder.Count; i++)
        {
            int index = i; // For input function not referencing the loop variable
            runeSlotInputs[i].action.Enable();
            runeSlotInputs[i].action.performed += ctx => HandleRuneSlotInput(index); //76 line
        }
    }```
ivory bobcat
elfin pike
#

yes, and also i tried to remove function onDestroy, but it didnt remove on scene load. Summary: Range error, even if list is constantly 10 size. Doesnt unbind on destroy. on 1 button press function is called 3 times (no error, error, no error)

ivory bobcat
#

If the error is with cs LoadoutList[selectedSlotIndex].SetRune(blockTypesOrder[index]); //127 linethen likely the selectedSlotIndex value is invalid. Log the value and the size of the load out list.

elfin pike
ivory bobcat
#

So destroy is functionally correct.

#

What the error is stating is that selectedSlotIndex isn't a valid index for the LoadoutList collection.

#

You need to verify the value and the collection size.

elfin pike
ivory bobcat
#

Log the value

ivory bobcat
#

Log the collection size.

naive pawn
#

you can't unsubscribe a lambda used directly like that

#

it's not "the same delegate", so nothing is being unsubscribed

ivory bobcat
#

You need to unsubscribe the instance.

naive pawn
#

usually you would have a method that you can easily subscribe/unsubscribe instead

elfin pike
#

i subscribed incorrectly?

naive pawn
#

you subscribed in a way that makes unsubscribing properly impossible

ivory bobcat
#

If you cache the lambda with a field, you can subscribe and unsubscribe using the field.

elfin pike
#

is there better way to subscribe to inputaction.

ivory bobcat
naive pawn
elfin pike
naive pawn
ivory bobcat
#

If you're planning to unsubscribe, you'll have to reference the instance to unsubscribe.

naive pawn
#

if you don't understand, just say so instead of ignoring the answer

elfin pike
naive pawn
#

it's just assigning some field to the value you want to keep

#

same as if you were to save an integer value across methods, you would assign to an int field

#

i have no idea what you mean by that last part

elfin pike
#

what field type i would need

naive pawn
#

try hovering the thing you're subscribing to 😉

#

it'll tell you the type

#

though since you have multiple inputactions you'd also have to save multiple actions, probably with a list/array

elfin pike
naive pawn
#

in your ide, hover over the word performed in ...action.performed += ...

#

it'll tell you what the type is

elfin pike
ivory bobcat
#

Probably Action<InputAction.CallbackContext>

naive pawn
elfin pike
#

if i guess, i cant do this Action<InputAction.CallbackContext> _action = runeSlotInputs[i].action.performed += ctx => HandleRuneSlotInput(index);

naive pawn
#

you aren't saving the event listener there, you seem to be trying to save the entire act of subscription

#

(you also would not be doing this all as one statement, you would need this to be a field, not a local variable)

ivory bobcat
naive pawn
#
int attack = /* ... */;
int bonus;
``````cs
bonus = /* ... */;
attack += bonus;

// later
attack -= bonus; // same value as when you did `+=`
ivory bobcat
# ivory bobcat ```cs Action<InputAction.CallbackContext> _action;``````cs _action = ctx => Hand...

The breakdown...
HandleRuneSlotInput(index) is simply a function from this instance that you're wrapping in a lambda.
A lambda generally looks like (/* parameter */) => {/* statements */} where the parameter type does not need to be define - lambdas.
You're expecting a parameter of type InputAction.CallbackContext. The parameter name ctx implies it's the callback context that the Unity input system provides. In your case you aren't doing anything with ctx. The funciton is expected to have a return type of void so you'd want to use the delegate Action instead of Func. You'd cache the instance of the lambda (an anonymous function) with a field and subscribe the instance (using the field). When you need to unsubscribe, you'll use that instance stored in the field to unsubscribe. What you had initially was the creation of new lambda instances when subscribing and unsubscribing. They were two different instances. The second instance wasn't found so nothing was removed. @elfin pike

elfin pike
#

What are common use cases of lambda. I always used it to shorten and not use {}. Also for actions from input manager

naive pawn
#

for delegates that are immediately used

#

they're just another way to make delegates

tender mirage
#

I'm actually using them right now. They make certain code alot more convenient.

naive pawn
#

ah, deferred evaluation like in WaitWhile/WaitUntil or in pooling too

#

as well as callbacks

tender mirage
#

Oh right, like.


bool myBool = false;


yield return new WaitUntil(() => myBool); 

I use that all the time. It's very nice.

elfin pike
tender mirage
#

delegates can also store function parameters. It's pretty dope.

naive pawn
real carbon
#

is this safe? or should I just remove it

naive pawn
gloomy bison
pliant oyster
#

I'm trying to make a pong game, but when the ball touches the enemy paddle, it gets stuck in place instead of reversing its x velocity. It also doesn't bounce off the walls. Here is my code:

    private void OnCollisionEnter2D(Collision2D collision)
    {
        // For the walls, reflect Y velocity
        if (collision.gameObject.CompareTag("Wall"))
        {
            rb.linearVelocity = new Vector2(rb.linearVelocity.x, -rb.linearVelocity.y);
        }

        // For paddles, reflect X velocity, add some vertical deflection, and increase level if the ball hits the player paddle
        if (collision.gameObject.CompareTag("Paddle"))
        {
            float yDiff = transform.position.y - collision.transform.position.y; // Difference in Y position between ball and paddle
            float bounceAngle = yDiff / collision.collider.bounds.size.y; // Normalize offset
            
            float currentSpeed = rb.linearVelocity.magnitude; // Get the current speed
            Vector2 dir = new Vector2(-rb.linearVelocity.x, rb.linearVelocity.y + bounceAngle);
            rb.linearVelocity = dir.normalized * currentSpeed; // Use current speed, not base speed
        
            if (collision.gameObject.name == "PlayerPaddle")
            {
                GlobalVariables.Instance.Level++;
            }
        }
    }
keen dew
#

I'm guessing that the physics engine already reverses the velocity, and then your code reverses it back

#

If you want to make your own collision system you shouldn't be using the physics engine at all, or at least only use triggers. And if you just want to make a pong game, just let the physics engine handle the collisions

elfin pike
pliant oyster
#

I don't really understand. I commented out the lines that change the ball velocity (basically only leaving the Lever increase) and it still gets stuck on the enemy paddle.
I'm thinking, could it be that the physics engine stops the ball dead before my script hits, and then, because the ball velocity is 0, it just stays at 0?

keen dew
#

Why do you need a script at all? The physics engine will bounce the ball automatically

pliant oyster
#

Because I have other stuff in my Ball script

naive pawn
naive pawn
keen dew
pliant oyster
#

You asked why I have a script at all. I have a script because I need it to do things, like resetting the ball to the middle, or launching it.

keen dew
#

Obviously I wasn't suggesting that you should throw out all your code. I meant the part that messes with the physics

pliant oyster
#

Oh that, I assumed that I'd have to do that, because usually when hitting a wall your motion stops, as it does with everything commented out.

#

My collision code is this right now:

    private void OnCollisionEnter2D(Collision2D collision)
    {
        // For the walls, reflect Y velocity
        if (collision.gameObject.CompareTag("Wall"))
        {
            //rb.linearVelocity = new Vector2(rb.linearVelocity.x, -rb.linearVelocity.y);
        }

        // For paddles, reflect X velocity, add some vertical deflection, and increase level if the ball hits the player paddle
        if (collision.gameObject.CompareTag("Paddle"))
        {
            //float yDiff = transform.position.y - collision.transform.position.y; // Difference in Y position between ball and paddle
            //float bounceAngle = yDiff / collision.collider.bounds.size.y; // Normalize offset
            //
            //float currentSpeed = rb.linearVelocity.magnitude; // Get the current speed
            //Vector2 dir = new Vector2(-rb.linearVelocity.x, rb.linearVelocity.y + bounceAngle);
            //rb.linearVelocity = dir.normalized * currentSpeed; // Use current speed, not base speed
        
            if (collision.gameObject.name == "PlayerPaddle")
            {
                GlobalVariables.Instance.Level++;
            }
        }
    }
```As you can see, I commented the physics changing stuff out, but the ball just stops all X movement when it hits the paddle.
#

I'm going to try re-enabling the commented out lines, and removing the Kinematic rigidbody from the paddle.

keen dew
#

That's not going to help

#

Either you have code somewhere else that affects the ball, or the physics setup is wrong

#

Possibly setting the ball velocity every frame

deft hornet
#

I am completely new to unity what should I start with

rich adder
deft hornet
rich adder
# deft hornet What?

You asked in a coding channel so it's the assumption that you want to learn code . Check the pins in the channel?

inner needle
#

hi

deft hornet
#

I tought you guys would help

rich adder
inner needle
#

in which channel we can post for people to connect with?

verbal dome
inner needle
deft hornet
rich adder
verbal dome
inner needle
rich adder
inner needle
#

Does unity have any other home server?

rich adder
#

There are non official ones floating around , dunno which

inner needle
#

very strange unity doesn't have their community connect channels

#

ok nvm

rich adder
#

There is a collabs area on the forums. That's about it.

#

!collab

radiant voidBOT
# rich adder !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**

elfin pike
#

Is there book or website with words I should know?

radiant voidBOT
elfin pike
#

Giving unity documentation doesn't help

tulip herald
#

What did you need then?

naive pawn
#

are you looking for a glossary?

#

i don't think unity has an official one

#

oh no way

elfin pike
sour fulcrum
#

variables declared in a class are referred to as fields

manic juniper
sour fulcrum
manic juniper
#

the field can be used anywhere in this class, but local variables declared in a method can only be accessed from this exact method

manic juniper
#

the line "public Transform target" is a declaration of the field, but not the field itself

sour fulcrum
#

Its both a field and variable

sour fulcrum
cosmic dagger
#

target is a field, which is a type of variable . . .

elfin pike
cosmic dagger
#

the truth usually is (joking) . . .

cosmic dagger
naive pawn
# elfin pike You make it more confusing

a variable holds a value.
a field is a variable that lives in a class (or other type)
a local variable is a variable that lives in a method (or a narrower scope) (it's "local" to that scope)

cosmic dagger
#

basically, the main difference is the scope the variable was created in . . .

elfin pike
#

Not logical. i would class can have methods and fields. Fields contain stack or heap. Method can also have them.

grand snow
#

sorry what

#

a struct that is stack allocated may then have fields in the stack too

naive pawn
cosmic dagger
grand snow
#

this is also now not beginner stuff

polar acorn
#

A field is a variable that belongs to a class. As opposed to a local variable that belongs to a scope

cosmic dagger
#

no, i would consider this beginner as it's the first thing they should learn about variables . . .

manic juniper
#

all fields are variables, not all variables are fields...

#

basically

grand snow
#

No a beginner learning c# does not need to know about the stack or heap

naive pawn
#

right, they brought that up themselves, the main topic was trying to explain what the difference between fields and locals was

polar acorn
#

Yeah I don't even know where those came from. No one was mentioning them

naive pawn
#

eventually, yes. but there are more important things for a beginner.

#

information overload is not conducive to learning

cosmic dagger
#
  • value types are stored on the stack
    Pro-Tip: value types are stored on the heap if they belong to a reference type (array, class, struct, etc.)

  • reference types are stored on the heap (the actual object)
    Pro-Tip: the variable holding the reference can be stored on the stack (local) or heap (field of an object)

#

personally, i never knew this was intermediate or advanced learning. i thought it was a part of learning about variables and what types there are (which is one of the first things you learn, imo) . . .

naive pawn
#

it's advanced knowledge of a beginner topic imo. implementation details that can be abstracted away at the beginner level

grand snow
#

It matters more in c/ cpp where we need to care and think about how we are allocating objects

cosmic dagger
#

damn, realizing my training was harsh. why master?

grand snow
#

in a managed language its not as important

naive pawn
#

yeah stack vs heap alloc is almost never mentioned in eg js or python in the context of learning to use the language (for comparison)

#

implementation detail that's interesting for nerds and important for optimization but you'll get a lot more knowledge leading up to that by the time it becomes important

cosmic dagger
grand snow
elfin pike
naive pawn
#

comparing equal is not becuase they're reference types

#

if you do num1 = num2 then num1 == num2 too

polar acorn
grand snow
#

🤦‍♂️

polar acorn
#

I don't think that you really need to worry about any of that in a garbage-collected language like C#. You don't need to allocate any memory, so you don't really have to care about how that memory is managed.

grand snow
#

but muh bragging rights!

elfin pike
naive pawn
#

the value is the reference

#

it's still passing by value

grand snow
#

ref would like a word

naive pawn
#

passing by reference is a different concept (see ref/out, or c++ &)

manic juniper
#

all of this started from fields and local variables...

polar acorn
#

We can move on to another question once we've adequately solved the last one

manic juniper
naive pawn
#

i think we could drop this tbh. i'm not sure it's going to be of much use

naive pawn
manic juniper
grand snow
naive pawn
#

values of value types are stored entirely inline, whether that's in the stack or in the heap.
values of reference types are stored as a reference (inline) to some object in the heap.

polar acorn
#

Basically, you won't need to care about how the data is stored in C#. You just need to know if it's a reference or value type, and if you need it to be the other one, you have ways of doing that

elfin pike
#

What about fields? How people explained inside field we have field and field type?

cosmic dagger
#

though, I don't understand what you mean by, "inside field we have field" . . .

elfin pike
naive pawn
#

you said it...

#

a field declaration has the field name and the field type, are you thinking of that

elfin pike
#

Yes, I think guys got confused by trying to explain

#

In any other language Its called global variable, because all functions in class can use it

naive pawn
#

no, this is not the same as a global

#

globals are in the global scope

#

fields are in class scope

#

c# doesn't have globals

#

compare: c, c++, js, and python have both globals and fields. they are separate concepts

grand snow
#

Scope doesn't end there but it's the major ones

elfin pike
#

What can be higher then global?

naive pawn
#

global is the highest scope

grand snow
#

I mean the other way. You can have local functions, lambdas and even start new scope within any but that's not as useful in c#

high shoal
#

quick qeustion: how do i remove the paths in visual scripting? the white ones

naive pawn
#

you don't, those are what direct the flow of your code

#

removing the paths just means the code doesn't run

high shoal
#

i dident mean to connect it to "on start"

naive pawn
#

ah, wait, did you just.. mean that

#

yeah ok i assumed you meant visually remove them... that's on me, i need to go to bed lmao

#

probably some right-click action

#

you could also probably just google this though

white zinc
#

Does anyone know why I get this error for this script? InvalidOperationException: You are trying to read Input using the UnityEngine.Input class, but you have switched active Input handling to Input System package in Player Settings. UnityEngine.Internal.InputUnsafeUtility.GetAxis (System.String axisName) (at <5d83d7fd54814220974154076485b684>:0) UnityEngine.Input.GetAxis (System.String axisName) (at <5d83d7fd54814220974154076485b684>:0) CameraControllerFPS.Update () (at Assets/movement/Movement.cs:15)


public class CameraControllerFPS : MonoBehaviour
{
    public float sensitivity = 2f;
    private float xRotation = 0f;
    void Start()
    {
        Cursor.lockState = CursorLockMode.Locked;
        Cursor.visible = false;
    }

    void Update()
    {
        float mouseX = Input.GetAxis("Mouse X") * sensitivity;
        float mouseY = Input.GetAxis("Mouse Y") * sensitivity;

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

        transform.localRotation = Quaternion.Euler(xRotation, 0f, 0f);
        transform.parent.Rotate(Vector3.up * mouseX);
    }
}```
solar hill
#

Switch input handling to use both.

gaunt mason
#

You can either use both, or start using newer active Input System, I prefer the newer but it's a little less intuitive in setting up

ivory bobcat
golden canopy
#

guys is there a better way to achieve this?

 if (cameraFinger != null)
        {
            Vector2 delta = cameraFinger.currentTouch.delta;
            cameraInput = delta * sensitivity;
        }
grand snow
#

reading touch/mouse delta is normal for getting input for this frame

golden canopy
grand snow
golden canopy
#

its basically just a fancy way to adding the delta to the camera rotation, its being called in late update

grand snow
#

This also looks fine but I think the "window space" for delta is a bit shit

#

nvm that should then equate to screen space. Id try to use an input action instead of enhanced touch and see if its better. Im going to try to find what I did when I used enhanced touch last...

#

Dang I was using Touch.activeTouches[0].screenPosition

prisma shard
#

If an experienced coder is familiar with the game RuneScape can u please DM me. I have a few questions

golden canopy
grand snow
golden canopy
#

i see

#

i tried the input action again, its definitely the enhanced touch

#

i looked into the official documentary a bit as annoying as it is i couldnt find an alternative with only the input system

#

because i wanna identify the finger too

grand snow
#

If you want only some area of the screen to do this camera movement you can use the IPointer events in UI to read mouse/touch input

#

using a configured input action is better than doing direct device data reading (and enhanced touch is there really to half replicate old input stuff)

golden canopy
#

not really id have the ui changing but even if i set the drag area below all ui its still going to cause issues with gamepad support etc

grand snow
#

Then 1 action for both should be best

golden canopy
#

id still need to constantly use the joystick to move lol

grand snow
#

another action for that

#

*mapping sorry

#

you can map touch delta and gamepad input

#

then read as vector2

solar hill
#

but Runescape is also not a unity game

#

if you want to know how to recreate anything from Runescape in unity you should also ask here

prisma shard
#

Ok well I guess I can ask a few of the questions here. In RuneScape there is a tick system that I believe is when the server registers game data of events happening. I think all video games are tick systems but RuneScape is known for its big 0.6 second delay. Question, does implementing this in a DnD combat system which is not turn based have any utility for single player games? From my surface knowledge I thought the tick system existed in RuneScape because of hardware constraints and being a multiplayer game. If this tick system would be useless for modern DND real time games. What system should replace it

grand snow
solar hill
#

You really dont need a custom tick rate for a game that isnt multiplayer

#

i cant really think of any productive reason for one

#

tickrates for multiplayer games are basically just how frequently is the server getting all the client sided information and vice versa

#

to put it simply

grand snow
#

yea exactly, we can already tell pretty well how much time passed since the last frame so we can keep things consistent time wise

prisma shard
#

Isn't the body of the player desynced from their actual coordinates? Like it's all animation interpolation or something. I think that's because of the tick system and I am not sure how different the DND combat system would feel if it was too responsive I guess? It's just kind of hard to imagine what it would look like in a different game genre

grand snow
#

are you thinking of physics interpolation?

#

Anyway if you were doing some turn based system you would still process input right away and handle things by the time they take

#

I think you are chasing some idea for no good reason

solar hill
#

Runescape and Wow use tab targetting, which is sort of close to a mix of real time and turn based combat, but that was born out of nescessity, action rpg mmos werent a thing back in the day.

#

For an actual turn based combat system, you dont need tick rates of any kind

prisma shard
#

Perhaps I shouldn't have said DnD. It's just RuneScape is technically a DND combat system. I am not exactly sure how the registry of data for far away fog of war units works (perhaps they don't spawn at all before the player can see them). But I feel if u wanted an authentic RuneScape feeling game u would not want a continuously fast updating tons of data immediately because it would be unnecessary and a waste of CPU resources that u would want for a big map game with many units. If all units have some sort of like minimum 0.6 second attack timer. I am not sure what is lost not just having the game "click absolute time" over the entire game

solar hill
#

I think you are still missunderstanding both the nature of tick rates, what runescape does and why, and what we are telling you...

#

Youre confusing multiple different unrelated things here

grand snow
#

Its true that processing a bunch of things each frame (on the main thread) would be slow but threading, jobs and entities can be used to solve this.
An easier method would be also to stagger when updates happen (some one frame, others the next)

eager beacon
#

whats the best way to learn how to program overall as a COMPLETE beginner

solar hill
#

check the pins here

austere kraken
solar hill
radiant voidBOT
inland lark
#

if i have building sim type game and i need to make like 50 exteriors and interiors, whats the best way to organize things as far triggers collisions etc from going outside to inside

rich adder
eternal needle
# prisma shard Perhaps I shouldn't have said DnD. It's just RuneScape is technically a DND comb...

they do have a ton of units loaded at once, i think there was an update where they stopped updating certain units if no one was around (which caused its own bugs). But they generally dont spawn/despawn much. Dead npcs are sent to (0,0), not destroyed or anything, which also came with its own bugs. Object pooling would be the term for doing this in unity. Other than the 0.6 second tick rate, the stuff you're describing don't actually correlate to a "RuneScape feeling game".

Though you're wasting efforts even trying to compare your game to runescape. If there's a feature you want to recreate, ask about it specifically. Just thinking about implementing a tick system because another game has it will get you no where. Their fundamental systems like the ticks and queue had crazy bugs that have existed for years, you really don't want to copy it anyways

eternal jacinth
#

Yo wsg gangs

elfin pike
#

Is there way to see class used memory and performance? I know it's not beginner's topic

queen adder
#

What the hell?? Why isn't it filling out the field?

I'm trying to fill out an InputActionReference in my player prefab using unity's new input system.

public InputActionReference move;
queen adder
#

Apparently it's a problem specifically with version 1.16.0 and 1.17.0 of the input system. Switching to 1.18 fixed it but now apparently the signature of the package is invalid

eternal needle
#

!collab

radiant voidBOT
# eternal needle !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**

chrome sable
#

how strongly baked into Unity / C# ecosystem is the PascalCase naming convention? I am going crazy without my snake_case variable names 🙁

chrome sable
#

🥹

queen adder
#

You'll get used to them, and then your code will be more readable for everyone so don't feel bad about leaving snake_case behind

chrome sable
#

its just unfortunate because i really hate camel case lol

#

but yes, it is what it is

eternal needle
#

its a good thing to leave behind

chrome sable
#

the lower case feels much easier on the eyes to me

#

but i guess it's easier to just go with a language's conventions or its an upstream battle =\

nocturne kayak
#

hello guys I wanna know can you only call this One time?
interface IInteractable { public void Interact(); } I wrote this a second time to make a second function in an other script but this apparently makes an error

ivory bobcat
nocturne kayak
#

are there still website to paste the script like blaze bin this website is down

nocturne kayak
ivory bobcat
#

You've already defined that interface in your project. Remove one of the two.

#

It's available project wide.

nocturne kayak
nocturne kayak
pseudo barn
#

Hey everyone,
I'm going through a difficult time through my life but since I'm doing a bit better now I'm trying to finally get into codding
I already follow the very basic tutorial to learn how unity work and I was able to start a small project by my self, asking chat gtp how I could improve my code or how I could do this or that (telling him how I would do it first so he doesn't just do all the work for me)
Thing is I'm pretty sure chat gtp isn't the best way to learn programing and I was wondering if there are other ai out there made for programing that could direct me or answer my question better than him

Thank you for your answer or redding my question ^^

(I know there is tutorial for everything out there, but the sheer amount of them and finding the right one for the right situation is a bit intimidating for me and for the stage of my recovery that I'm going through rn, Someone already told me I should look for those instead and I plan on doing too hopefully since they should be better than ai, but I can't really manage to do it rn ^^;)

sour fulcrum
nocturne kayak
#

Oh yeah i have no idea why i wanna implement a second Interaction this is just dumb 😂

#

i'am thinking too hard i dont know 😭

nocturne kayak
tired python
#

vscode?

nocturne kayak
#

visual studio 2022 but it might exist

tender mirage
tired python
tired python
#

i stopped using vs cus it took too much processing power

nocturne kayak
tender mirage
nocturne kayak
tender mirage
#

it's pretty annoying.

tender mirage
#

tedious process.

tired python
#

What I want:-

  • Based on the mouse position, I want the Forward Vector of the Spaceship to rotate towards the Mouse Position
  • In this scenario (acute angle), the spaceship should rotate clockwise
  • In a scenario (obtuse angle), the spaceship should rotate counterclockwise

I want to know how it would be possible for me to find out:-

  • Forward Vector
  • Angular Velocity required to rotate the spaceship (I have done a few calculations and I don't think finding this will be much of a problem if I have the Forward Vector)
grand snow
#

If needed can give an example of how to use it

tired python
#

suppose Mouse Position is mouse_pos and spaceship position is spaceship_pos

nocturne kayak
#

i think

tired python
grand snow
#
Vector3 dir = mouse_pos - transform.position;
float zRot = Mathf.Atan2(dir.y, dir.x) * Mathf.Rad2Deg;
targetRotation = Quaternion.Euler(0f, 0f, zRot + 90f);

@tired python This shows us getting a directional vector from the object to the mouse position (presuming this is world space too)
Then we figure out the z rotation and make a quaternion!

#

You can then use rotate towards to keep rotating to wards the latest target rotation

nocturne kayak
grand snow
#

Oh and this example presumes that X+ is forward (hence the +90 correction)

tired python
grand snow
#

Its based on which direction your ship points with 0,0,0 rotation

#

If it looks right (which is positive X) then we need to add 90 degrees to the calculated rotation to correct it

grand snow
#

wha?

#

Im confused what are you trying to convey to me?

#

I have used Atan2 many times to impement similar "rotate thing to look at mouse" behaviour

#

Please use words instead to tell me what you dont understand or if you think I miss understand your desired behaviour

tired python
#

oh wait

#

i messed up

#

it is Vector3 dir = mouse_pos - transform.position;
not Vector3 dir = mouse_pos - forwardvector.position;

grand snow
#

The current forward vector is not important. If we get the target rotation using the previous example and use Quaternion.RotateTowards() to keep rotating to it each Update then we get it to work

#

We need a direction from the object to the mouse world pos

tired python
grand snow
#

Then why not try what I suggested? Its what I would do to keep rotating an object to look at the mouse

#

Transform has properties for up and right so you do have options for a "forward" direction in 2D

tired python
#

i can't seem to get a grasp of the last step

tired python
grand snow
#
Quaternion target;

private void Update()
{
  transform.rotation = Quaternion.RotateTowards(transform.rotation, target, 90f * Time.deltaTime);
}
grand snow
tired python
#

wait then none of this is needed?

#

i can just use var angleToRotate = Vector2.SignedAngle(transform.up, mouse_pos);

grand snow
#

I am soo confused what you understand or dont rn

#

suggestion: read the doc pages on these things

#

if you did not open the links i sent earlier then that explains this

tired python
#

i did open the links before and I do know that that euler rotation is supposed to add absolute rotations to the object (spaceship)

grand snow
#

Euler is an alternate easier way to represent rotations

#

Quaternion is what is used for rotation. You can get and set rotation in world or local space.

#

RotateTowards() is a helper function that returns a rotation that has slightly moved from one rotation to another by some max amount so it makes it easy to keep rotating towards some goal rotation.

#

Its similar to Vector3.MoveTowards() which helps moving towards a goal position by some max delta

tired python
#

i can't be this stubid UnityChanDown

grand snow
#

zRot + 90f if the sprite looks right
zRot if the spirte looks up

#

zRot is angle in degrees

#

Mathf.Atan2(dir.y, dir.x) * Mathf.Rad2Deg
Atan2 returns an angle in radians so we need to convert it to degrees

lethal gull
lethal gull
tired python
sour adder
lethal gull
sour adder
#

Then it must be the if-statement?

grand snow
tired python
#

got it

lethal gull
#

it will be equal to 0 and do nothing

ivory bobcat
# pseudo barn Hey everyone, I'm going through a difficult time through my life but since I'm d...

When you copy code from a tutorial or the internet, you can be certain that your result will likely match their result - the final result. With AI generated code, there is no certainty. The result is simply generated. If there are mistakes, the AI will not be able to find the solution without curation. There are no promises with AI. The final result is non-existent. The generated result can be wrong. The solution can be wrong. It becomes a really deep rabbit hole of frustration. If you aren't comfortable with scripting but want to make games, your best bet is to look for assets in the asset store (free, paid ect) and find tutorials on how to implement simple mechanics/features that you absolutely need. If you aren't building the entire system yourself, keep the mechanics simple and few. Unity has been around for a long time. There are plenty of fancy ready made assets out there. Integration will be your limiting factor. You might not get exactly what you'd want but with enough iterations (games made) you'll become more familiar with what's acceptable and what you may have to learn or pay to acquire. Reminder that game development consists of more than just programming - there's going to be some compromising on quality: https://en.wikipedia.org/wiki/Project_management_triangle

"Good, fast, cheap. Choose two."

tired python
#

this is what the guy had been writing all this while damn

sour adder
#

forceDirection is set in two places and it is not 0 if the throw is upwards.

nocturne kayak
#

Hey guys uhh there is something that i really dont understand so i just want to change a value from another script and its just doing something weird, so why the hell am i getting those types of result , the second script is in an object that get duplicated over and over but how can it show a value of 0???

ivory bobcat
nocturne kayak
ivory bobcat
nocturne kayak
ivory bobcat
#

Normally you'd want to assign player info when you spawn each duplicate object so that they share the same player info:cs var something = Instantiate(...); something.playerInfo = playerInfo;

#

Can you show how you're instantiating the object

nocturne kayak
ivory bobcat
nocturne kayak
lethal gull
nocturne kayak
#

here is my script to instantiate

#

oh so it is a prefab

naive pawn
nocturne kayak
#

but it mean that each time that i instantiate it would take the script from 0 ?

ivory bobcat
nocturne kayak
#

noo

nocturne kayak
#

and you found my problem i guess😭

ivory bobcat
#

Was it the prefab asset that was being highlighted yellow?

nocturne kayak
#

i had 2 script that would play the same script

ivory bobcat
#

Ah, okay.

nocturne kayak
#

i'am so mad at me its not the first time it happen and i passed like 2 hour trying to find the issue 😭

#

i hope it wont happena again lol

lethal gull
nocturne kayak
sour adder
#

Why would transform.up be 0?

naive pawn
#

it would not

lethal gull
naive pawn
#

that does not make transform.up be 0

lethal gull
#

huh?

lethal gull
naive pawn
#

transform.up is just a normalized direction vector

#

multiplying by 0 results in a zero vector

#

it doesn't change transform.up

lethal gull
naive pawn
#

i think you have the right idea but you're phrasing it extremely confusingly

lethal gull
#

multiplyijg it by zero applies zero force towards the axis

naive pawn
mint swift
#

Hello, when i am working with cinemachine i am getting something wrong it pissed me off, like when using the third person aim camera it's just not rotating and i am trying to add pan tilt it just rotates around it self and not like beside the player so it will get that aiming style.
Any idea?

lethal gull
naive pawn
#

so forceDirection isn't the camera's forward direction then

#

it's whatever (hit.point - attackPoint).normalized is

lethal gull
waxen sequoia
#

Hello i made an animation for Fire and Idle in Idle the weapon keeps flashing around anyoe knows why

naive pawn
naive pawn
#

but also, you need to provide much more info than that

lethal gull
naive pawn
#

we aren't psychic

naive pawn
#

log out hit.point, log out attackPoint.position, log out forceDirection

waxen sequoia
naive pawn
#

the relevant channel

waxen sequoia
#

thx

naive pawn
# waxen sequoia thx

you've already posted in #💻┃unity-talk so just stick to that, don't crosspost
if you actually provide more info, where we'd be able to help, then you may be redirected if necessary

lethal gull
lethal gull
sour adder
#

So, it was the if-statement.

lethal gull
#

I feel like I'm the only one having these weird issues everytime

naive pawn
#

or make it start outside the throw object

#

!collab

radiant voidBOT
# naive pawn !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**

naive pawn
noble sleet
lethal gull
# naive pawn so add a layermask

but how would it fix the issue? if it hits the throwObject(whatever object) using as a direction the cam.forward and then calculating the normalized direction, it should have still been thrown forward and not upwards

lethal gull
naive pawn
#

if the throw object is on a different layer from whatever you want it to hit of course

pseudo barn
naive pawn
#

it's that your raycast was hitting an object you didn't want it to hit

lethal gull
naive pawn
#

i have no idea what you're asking

lethal gull
#

maybe the throwPosition is a bit more elevated than the cam position so yea I should just exclude it from the layers

lethal gull
naive pawn
#

oh whoops misread

#

why wouldn't it be upwards

lethal gull
lethal gull
naive pawn
#

no it wouldn't

lethal gull
naive pawn
naive pawn
true flame
#

So basically i am creating a simple script so when the player hits the enemy, the player resets back to their spawn point. However, when the player does touch the enemy, it doesnt do anything at all.

keen dew
naive pawn
true flame
#

this is the player

#

this is the enemy

keen dew
#

Where's the SpawnPoint component?

true flame
#

so the Spawnpoint is here, so hopefully when the player hits the enemy, it should go to this spawn point

keen dew
#

That's the gameobject. Where did you attach the SpawnPoint script?

true flame
#

to the player

keen dew
#

Ok well show it

sour fulcrum
#

then the player is the spawnpoint

#

thats just a gameobject named SpawnPoint, it doesn't do anything

true flame
#

so it does work on a normal sphere but not the actual Enemy? Is it because it is a prefab?

keen dew
#

no

true flame
#

okay okay

foggy yoke
#

how can I switch controls between two gameobjects that both have the player input component?

grand snow
grand snow
# foggy yoke Thanks

If you read input in update you can use the enabled property of your component

grand snow
foggy yoke
#

So you're saying that I should just disable the Player input component?

grand snow
#

check the playerinput doc page for more info

foggy yoke
#

Thanks!

torpid vault
#

hello, I am currently trying to implement networking into my 2d fighting game but there seems to be a problem regarding knockback. I use server authoritative movement and the knockback only works if player 1 attacks player 2. If player 2 attacks player 1, there is a small chance of knockback being applied but generally nothing happens.

rich adder
torpid vault
#

I tried changing it from dynamic to kinematic rigidbody but i still have the same problem

#

should i send the script?

rich adder
torpid vault
#

not really

rich adder
#

should probably learn about that before even getting into networking, you can't just Apply Force from another RB to another if they are kinematic, they are not affcted by external forces

#

server is the only ones who process the dynamic collisions to keep things somewhat consistent across clients

#

physics isn't exactly trivial thing to get correct on net

#

make a thread in #1390346492019212368 if you want but imo, you need to learn more about these things before implementing physics in a netgame

torpid vault
#

alright, thanks

vernal ledge
#

is there a tool for testing edgecases

#

for multiplayer games specifically

elfin pike
#

Can I use VS code debugger for unity?

naive pawn
#

haven't tried it myself, but ive heard of people doing so, so pretty sure you can, yeah

grand snow
grand snow
#

Then congrats on advancing to real debugging

foggy yoke
#

i set up the blend tree and the parameters like how Game Code Library showed. Here's my script. Why is it getting stuck, and how can I fix it?

FREE animation package on my Patreon!
Hi! This video shows an easy way to animate your 2D platformer character. We'll animate their Idle, Running and Jumping animations! We'll use a blend tree to keep the controller super clean.

We'll also be using blend trees to create the cleanest animator controller for your project.

I start off with th...

▶ Play video
naive pawn
#

...ok... do you have a question

foggy yoke
#

oh wait sorry i forgot

verbal dome
foggy yoke
verbal dome
#

Nah when you have the state selected but i saw it's 1 in the video actually

naive pawn
#

this is a code channel btw. for issues like this in the future, ask in #🏃┃animation

inland lark
# rich adder organize? in what sense... this is a very open ended question

I’m building a city/building sim in Unity with around 50 buildings, each having an exterior in the main world and a separate interior.

What’s the best way to organize transitions between exterior ↔ interior at scale?

Specifically:
– How should I structure triggers and colliders for doors?
– Should interiors be separate scenes or prefabs loaded additively?
– What’s a clean way to manage building IDs so I’m not writing custom logic for every building?

I’m trying to avoid creating 50 unique scripts or messy scene setups. Looking for a scalable architecture approach.

naive pawn
#

should there be a loading seam when entering/exiting a building?

subtle mulch
#

so the gpu doesn't try to render useless stuff

sour fulcrum
#

While that’s not technically incorrect that’s not really why you would make that decision

#

You don’t need separate scenes to avoid redundant rendering

grand snow
#

Its possible to dynamically load in the interior content and unload it later

#

This is easier when using addressables but can still be done other ways

inland lark
#

ok i was reading about addressables but im still trying to wrap my head around it, ill keep studying

tired python
#

i swear, the damn ducks they are teleporting across the z axis as if they are on crack

#

is there a way to create a new spline in 2d, without any z component

#

What I want:-

  • To use only 2D colliders for particle collision detection.

Problem I am facing:-

  • The enemies which move across the spline are supposed to have their transform's z component as 0, instead, the z component keeps on changing continuously. Due to this, the 2d collision does not work as intended
grand snow
#

I remember you asking about some duck thing ages ago

tired python
#

wait, that was yesterday

#

oh wait, yeah, prolly, i am still working on the same game rn

wintry quarry
nimble heath
#

oh ok sorry, my bad

prisma shard
#

I have some questions. How do I know what I should be making myself and what I should be using asset packs for? Like I cannot think of a reason why I would ever make my own RTS camera since a camera is a camera. The thought of programming complicated things I didn't need to scares me. Are there some kind of "asset packs" for scripting, perhaps slightly complicated sim economies based on resource collection and then expenditure on various things. I feel like this might have to be tied to the particular registry data system ur using so not sure how that would work. Perhaps the scripts come as a set time/registra data pack that has a sim economy built on top? I mean these are the essential kind of questions for me right now

wintry quarry
#

I cannot think of a reason why I would ever make my own RTS camera since a camera is a camera
Except that... not every RTS game has the same camera behavior. Almost every game has some unique things in it or unique feel etc. \

#

perhaps slightly complicated sim economies based on resource collection and then expenditure on various things
Yes an economy simulation would certainly be something bespoke to your game you would write yourself

solar hill
#

Theres also rarely any "complete game asset packs"

wintry quarry
#

Even when you have "asset packs" or libraries, you will almost always be writing custom code to "glue" those things into your own game systems

solar hill
#

Yeah you still need to understand how those systems work at the end of the day

#

you cant avoid that

wintry quarry
#

Anything that claims to be a "complete game pack" is lying to you and is basically useless

#

unless the game you're making is just an asset flip reskin of an existing game that you have the project for , you're going to be writing your own custom code

prisma shard
#

Yea I was looking at it more like patchwork. Having at least an RTS camera and pre built grid and unit moving setup would be huge to expand on

grand snow
#

You would probably want a full turn based system instead

prisma shard
#

U mean like a civ end turn button

grand snow
#

No I think the parts you describe wont exist separately as you expect.
Unity already had grid components. Cinemachine is very versatile and moving units isn't super hard when you have a grid node system

#

For a beginner id then just suggest a larger pre made system if you want to go that route

prisma shard
#

Can't find anything like that beside maybe like topdown engine. But not even sure if that's something I'd even have use for. I must be looking in the wrong place. Is this all on itch io or private websites or something. Cinemachine I found and seems to be a cutscene maker but I don't think my game idea would even have cutscenes

solar hill
#

that is not what cinemachine is...

ivory bobcat
prisma shard
#

Like a general unity tutorial that is actually good and can show me pre built starting systems etc

radiant voidBOT
#

:teacher: Unity Learn ↗

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

ivory bobcat
#

I'm not on a workstation right now. Your best bet is to check the official Unity Learn. Select what you want and need but make certain to go over the basic intro setup-description for any of the tutorial groups you're going to use.

grand snow
prisma shard
#

750 hour sheesh. This is really offtopic but do u guys think getting into this stuff is a bad use of my time? I am suppose to be looking for a new job after being laid off but Im technically not in a hurry or at risk of losing my living arrangement. I was trying to do a simple thing in Godot using my knowledge of Python but now it's all spiraled into an almost aching demand to make a particular game I want. Im not sure if it's a bad idea

#

I guess it would be a less pressing issue if I knew c# already or was familiar with unity

solar hill
#

I dont think game development is ever a waste of time as a hobby

#

just dont go into it expecting much success, because it is quite rare

#

Financially every other job in the development field is probably a safer bet, but otherwise its really fun and you get to learn a lot.

prisma shard
#

Yea websites and stuff is where the developers are right? Tbh I was kind of shocked seeing how unreal engine discord only had 40k members. It felt like barely anyone even tries to make video games

wintry quarry
grand snow
prisma shard
grand snow
sour fulcrum
sour fulcrum
grand snow
#

Yea, I am lucky to have like 5+ experience professionally

#

Once you get the first job its easier but before that you can only rely on education or a strong portfolio

sour fulcrum
#

yups

solar hill
#

Im still waiting to see one of those "common" remote work game-dev jobs every single person keeps asking about here 🙃

sour fulcrum
#

I started working with Unity in 2019 and still looking for first position (not to scare anyone off)

grand snow
#

I think i started with 4.5

solar hill
#

I havent even tried my luck professionally tbh, still in college but even with a degree i feel as if im better off just building up the portfolio first

sour fulcrum
#

Most places do not care about your degree at all

prisma shard
solar hill
#

basically you have 1000 people for every 1 position

sour fulcrum
solar hill
#

So companies will naturally gravitate towards the people who already worked in the industry and have experience

grand snow
#

Then I have some tips. Make sure to learn source control like git and have some projects on github.
Make sure you know all major areas, dont ignore things like UI (UGUI and/or UITK) or particles or material set up.

#

If you want to do a dev/programmer position then do prep for the dumb coding questions you will get too

sour fulcrum
solar hill
#

Yeah this isnt even all too game development specific

#

the job market is rough

sour fulcrum
#

portfolio review channel would be nice here

solar hill
#

Dont worry, some rich ceo just got a 3.2 million dollar pay package for laying off 40 people

#

so all is better in the world in the long run

prisma shard
#

Lmao u guys are making me feel like I should be programming a nuclear sub radar system instead or something. Much less competition I would guess

solar hill
#

If you wanna develop games

#

you should

#

we are just telling you that financial success is seldom achieved

#

so go in it with the expectation to have fun developing and learning, and not that it might make you a lot of money

#

something like 70% of all games released on steam last year made less than 100 bucks iirc

#

they didnt even recoup the 100$ deposit lol

prisma shard
#

Lol wtf there's no way that's even possible

visual junco
#

I feel like the statistics that show game development success is rare are flawed. A lot of games hit success because they're actually fun, polished, and unique. Literally every game I've played that isn't is full of major issues, and they shouldn't be counted in stats that say "this has the same chance of success as ___"

grand snow
#

Ill point out that unity is very widly used in mobile games and those cover many genres

solar hill
solar hill
grand snow
#

Good ideas and good execution = monayy

solar hill
#

doesnt matter if your game is like the greatest game of all time

#

if it doesnt make money

#

its not successful

visual junco
sour fulcrum
solar hill
prisma shard
#

Maybe I should just make a game stealing an American IP and release it on the China market thinksmart instant brand name product

solar hill
#

Ive seen some absouletely garbage top the steam charts, while ive seen actual masterpieces get less than 100 players

visual junco
#

Often times when people consider a game very good in gameplay, to me it just looks extremely complex which is probably why it didn't make it

sour fulcrum
#

Means those games probably aren’t all that garbage

visual junco
#

Schedule 1 is very simple but extremely successful

solar hill
#

But no....

sour fulcrum
#

your game can be super shit if it hits the right gameplay spot

prisma shard
#

Flappy bird. What a disgrace to human ingenuity

sour fulcrum
#

eg. Only Up

solar hill
#

its more so accumulative hype that gets them where they are, they make the money

#

and then off to the next big thing

sour fulcrum
solar hill
#

that guy is not only still a multi millionaire, he also cemented himself as a gaming cultural icon for decades

prisma shard
sour fulcrum
#

Ok

solar hill
#

Yeah thats a good thing... for a developer

#

Minput maxput

sour fulcrum
#

It’s a cool little game

solar hill
#

It was unique and addicting

#

its success was deserved

sour fulcrum
#

unique is a bit strong but yeah

solar hill
#

Would rather more games like flappy bird than the current direction mobile gaming is going in

sour fulcrum
#

Some of the stuff featured on Apple Arcade is cool

solar hill
#

but the more popular games are straight garbage

visual junco
solar hill
#

its free marketing

#

its also generally received as a fun game

prisma shard
#

What is modern mobile like I don't play those games. I'm guessing gone are the days of subway surface. I thought that one was very good

#

Subway surfer

wintry quarry
#

I'm pretty sure subway surfer is still very popular

wintry quarry
#

But yeah don't bother trying to make a mass market free to play mobile game, if you want to make any money

#

that field is wayy too saturated

#

especially if it's a skinner box

solar hill
ivory bobcat
prisma shard
#

Yes I imagine the current method of game advertising is tricking some streamer into playing their game

solar hill
#

Not tricking

#

just a shit ton of money

visual junco
#

I'd say a good way to make money is creating simple games (Quality, environment) but with great replayability and unique gameplay
gorilla tag & schedule 1 are prime examples of non-complex games, but they're so simple it's basically impossible to not understand, and I don't see the games ever not reaching success

solar hill
#

I think we are going a bit off topic here atp

visual junco
#

and marketing it well like getting streamers/gamers to play your game, and having good social media reach

#

oh wait this is coding chat

#

lol

prisma shard
polar acorn
#

A good way to make money is to write accounting software. If you want to make money making a video game is the worst thing to do with programming skills.

#

Make games because you want to make games. You might be successful, but probably won't. This isn't a get rich quick scheme.

silk night
spare summit
#

Does anyone know of a solution that could fix this kind of bug?
Basically wats happening in the video is that you can put the boxes into one another and when doing so the script thinks your inside a wall so it stops the movement script. I made it like this to prevent weird glitchy movements inside the walls but in doing so it made the boxes glitch out if they went inside eachother like in the video. I've tried implementing systems where if the box collides with something it'll go back to its last known position but I can't seem to get it to work so hopefully someone here can help me with this ty.

radiant voidBOT
hexed terrace
#

What do you want to happen when the boxes collide?

spare summit
#

I just want them to not glitch inside eachother

hexed terrace
#

it's not glitching

#

so you want them to collide?

spare summit
#

and the way my movement script is setup the movement system stops working becuase their inside eachother

#

I jus don't want them to go through eachother. I want them to act like walls

hexed terrace
#

yes, so.. collide with each other

spare summit
#

ye

hexed terrace
#

do they have colliders?

spare summit
#

ye

hexed terrace
#

and rigidbodies?

spare summit
#

ye

hexed terrace
#

looks like you're moving via transform anyway, so it doesn't matter

spare summit
#

ye plus the movement has a animation type movement which is prob the main issue with y they glitch into eachother

#

its not an actual animation its an IEnumerator

#
private IEnumerator MovePlayer(Vector3 direction)
{
    if (CheckForCollision(direction))
    {
        yield break;
    }

    isMoving = true;

    AudioSource audio = GetComponent<AudioSource>();
    if (audio != null && moveCrate != null)
    {
        audio.outputAudioMixerGroup = sfxMixerGroup;
        audio.clip = moveCrate;
        audio.PlayOneShot(moveCrate);
    }

    float elapsedTime = 0;

    origPos = transform.position;
    targetPos = origPos + direction;

    while (elapsedTime < timeToMove)
    {
        transform.position = Vector3.Lerp(origPos, targetPos, (elapsedTime / timeToMove));
        elapsedTime += Time.deltaTime;
        yield return null;
    }

    transform.position = targetPos;

    isMoving = false;
}
hexed terrace
#

can you share code the proper way, using a paste site like the bot msg you've read told you to

#

however you check for walls , do the same for crates

spare summit
#

i used the last link

#

cause the others didn't work

solar hill
#

you didnt use anything you just send a .txt

#

this is not the proper way to share code here

spare summit
#

thats wat the last website did when I put the code in

hexed terrace
#

no, you just uploaded a txt file

#

the same as the first time with your op

solar hill
spare summit
#

this is the website I used and put my code in. Clicked create paste it did stuff then I clicked copy

hexed terrace
#

now copy the url...

solar hill
#

.... so you copied your code... pasted it, then copied it again and pasted it here

#

what do you think that did....

spare summit
#

😅

#

mb

#

does that work?

hexed terrace
#

you can test that and see for yourself it does ;p

spare summit
#

I'm not rly used to sharing large scripts so mb

hexed terrace
#

you need to debug as to why the crateTag isn't being caught

spare summit
hexed terrace
#

do not "believe" something, test and confirm ..

#

you go into MovePlayer coroutine -> check collision -> if wall, movement ends

That is also what should be happening for the crate, but it's not .. debug it and find out why.

#

also check the crates are tagged correctly (case matters; crate != Crate)

spare summit
#

heres my debug

#

but ye pretty much its the movement animation thingy

hexed terrace
#

that's not very useful is it

spare summit
#

XD

hexed terrace
#

log out the tags

native willow
#

Alrighty, Im here.

subtle mulch
#

k, now which errors?

native willow
subtle mulch
#

we are NOT there with you+

#

we need the errors you are getting

solar hill
subtle mulch
#

send us a screenshot if you need to

#

else we can't help

native willow
#

Ok gimme a min ima do somthin first.

grand snow
#

Lets not encourage screenshots of text

hexed terrace
#

Haha, good luck everyone. May your phsycic powers be of use

subtle mulch
#

XD

grand snow
#

😆

white zinc
#

@versed cove ```using UnityEngine;
using UnityEngine.InputSystem;

public class MovingNewInputSystem : MonoBehaviour
{
public float mouseSensitivity = 1f;

private float xRotation = 0f;
private float yRotation = 0f;

void Start()
{
    Cursor.lockState = CursorLockMode.Locked;
    Cursor.visible = false;

    Vector3 angles = transform.eulerAngles;
    xRotation = angles.x;
    yRotation = angles.y;
}

void Update()
{
    Vector2 mouseDelta = Vector2.zero;
    if (Mouse.current != null)
    {
        mouseDelta = Mouse.current.delta.ReadValue();
    }

    float mouseX = mouseDelta.x * mouseSensitivity;
    float mouseY = mouseDelta.y * mouseSensitivity;

    yRotation += mouseX;
    xRotation -= mouseY;
    xRotation = Mathf.Clamp(xRotation, -90f, 90f);

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

}

native willow
subtle mulch
#

this is another convo entirely

#

pls tell us your errors

native willow
hexed terrace
subtle mulch
grand snow
#

Its better to rotate your "player" on y and the camera on x

subtle mulch
#

that too

white zinc
grand snow
#

this should work fine then tbh

#

just be wary of getting the initial rotation like that as it will be in the 0-360 range

#

ive had funky bullshit thanks to that (as yes its much easier to work in -180 > 180 when doing such mouse input)

naive pawn
#

oh god the convo's crossposted

#

and im trying to have a convo with sidia, this is not viable on mobile lmao hold on

silk night
#

im busy for another 5 min anyways

naive pawn
#

ah welp i suspected mousedelta * deltatime, nice to not see that for a change i guess

silk night
silk night
naive pawn
#

things in update should be in units of x per frame

naive pawn
silk night
spare summit
#

so ye pretty much I've come to the conclusion that its the weird animation effect I have with the boxes. Which I kinda already suspected and i don't rly know how to debug for it aka jus knowing that its the animation. But heres a video of me doing the bug rly easily which its jus me holding down the s and w key and they glitch into eachother

#

also it gets fixed if i un tick the freeze position x and y but then I get another bug which makes the crates go off the grid and may end up breaking the game more

#

ik its kinda hard to see in the video but thats basically what happens, the boxes going off the grid

hexed terrace
#

you talk about "animation", but there's nothing in the shared code using that word, so.. clear that up

spare summit
hexed terrace
#

..movement 😄

#

then you're not confusing terms, as unity has animation and an animation component, etc.

spare summit
#

yee

naive pawn
#

what's the current issue? the boxes moving into the same cell/tile?

spare summit
#

lowk a solution I have in mind for the bug I have is that if ur boxes do get stuck it jus auto resets the level but thats not rly ideal but I'm just not that advanced in code to think of something else

hexed terrace
#

ah, damn.. I removed vscode from my mac because it's too old to run it. Was going to tidy up your code

naive pawn
#

(i had a 2012 mac running mojave because i didn't feel like using catalina that i used up to 2 years ago)

hexed terrace
#

I cba with that, I don't use my mac for any dev

spare summit
hexed terrace
#

your collision check for walls and crates is at the same time and is BEFORE the movement. I think you're wrong in your assumption at the issue.

naive pawn
#

yeah it seems like they're just moving to the same "empty" cell at the same time

subtle mulch
#

you should calculate the final position of the previous move

#

and use that to calculate the collision of the new move

naive pawn
#

is that not what they're currently doing...

#

that's... an interesting way make a "grid", i guess

spare summit
#

ngl if I did check for collisions before moving, it wouldn't rly do anything since the collision check is on the crate thats moving so by the time the crate begins moving it will detect the box thats in the detection zone and it wouldn't cancel the movement so they get stuck

naive pawn
#

what should happen? should one crate enter the cell arbitrarily, or should both cancel, or something else?

#

you could probably make them detect collision with each other and kinda "bounce back" pretty easily, if that's what you want thinkies

spare summit
hexed terrace
spare summit
naive pawn
#

one solution i see would be to have a levelmanager that maintains a dict over Vector2Ints for what tiles are occupied, and when crates move they would "claim" the tile they're moving to. you would need a stronger notion of tiles though

naive pawn
spare summit
# hexed terrace The first thing you do in the MovePlayer coroutine is to call the CheckForCollis...

I already had that.

private IEnumerator MovePlayer(Vector3 direction)
{
    if (CheckForCollision(direction))
    {
        Debug.Log("Movement blocked due to collision in direction: " + direction);
        yield break;
    }

    isMoving = true;

    AudioSource audio = GetComponent<AudioSource>();
    if (audio != null && moveCrate != null)
    {
        audio.outputAudioMixerGroup = sfxMixerGroup;
        audio.clip = moveCrate;
        audio.PlayOneShot(moveCrate);
    }

    float elapsedTime = 0;

    origPos = transform.position;
    targetPos = origPos + direction;

    while (elapsedTime < timeToMove)
    {
        transform.position = Vector3.Lerp(origPos, targetPos, (elapsedTime / timeToMove));
        elapsedTime += Time.deltaTime;
        yield return null;
    }

    transform.position = targetPos;

    isMoving = false;
}
spare summit
subtle mulch
#

check for collision is done on the crate that is still on the previous "grid" space, no?

#

if you do it fast i mean

hexed terrace
naive pawn
hexed terrace
#

which is why I said that is what you are doing, and didn't word it as a suggestion.

naive pawn
#

heyyy wait these crates have a collider and potentially also an rb? you shouldn't be moving via the transform then

hexed terrace
#

You're using raycasts for detection, rb can be removed, just have one on your bullets

naive pawn
spare summit
#

normally the x and y are frozen but I have them unfozzen for testing

naive pawn
#

you should still use the rb to move the colliders, otherwise they get recreated in the physics scene every time you move

hexed terrace
#

Yeah, ok fair enough, especially when you couple that with all the GetComponents happening all the time in this code

#

Really wanna make sure to have that AudioSource

spare summit
#

ngl I'm so confused XD... So if I use rb as the movement it would fix the issue?

#

instead of transform

hexed terrace
#

That one single change will not necessarily be the only thing required

#

But a step towards it

naive pawn
#

i don't think this would fix the issue at hand, i don't think it would change anything related to the issue at hand

#

but it would be more correct and more reliable and easier to work with

naive pawn
spare summit
#

how would I even implement rb as movement instead of transform?

naive pawn
#

the current code would map closest to MovePosition on kinematic rbs

#

(though, that wouldn't have collision between crates)

native willow
subtle mulch
#

well

#

it tells you exactly what is going on

naive pawn
#

that's not your code...

#

why would you paste in someone else's code that's specific to their game