#πŸ’»β”ƒcode-beginner

1 messages Β· Page 416 of 1

radiant frigate
#

im just not english native

rich adder
#

me neither, bookmark is a pretty common word on the internet world..

radiant frigate
#

not in the places iΒ΄ve been for what it seems

rich adder
#

yeah im sure no one uses bookmark where you're from

radiant frigate
#

i dont mean in my country i mean in the places ive been on the internet

#

for example game-forums or in game chats arent usually a place where the word bookmark is used

#

havent seen someone use it in a league game

rich adder
#

alright lets move on cause thats just stupid.. its literally built into your browser..

#

what is your code issue ?

radiant frigate
#

i want to compare the vector2.dot for each vector2 in the array with the mouse direction vector, so i know which one is the one that fits the most

#

but i cant think of a way to do that without making it a living hell to write with lots of random variables that would just be for that precise thing and i wont use again

#

and iΒ΄ve been thinking for an optimal way(or atleast one that isnt bad) and cant think of it

rich adder
#

what exactly is the end goal here , what are you trying to use it for

radiant frigate
#

i want to make a dash towards the enemies

#

let me represent it with a paint so its easier to see

rich adder
#

so you want the one you're facing most ?

#

or

radiant frigate
#

yes

rich adder
#

btw Vector3.dot returns the value of the operation

radiant frigate
#

im in 2d

rich adder
#

same thing

radiant frigate
#

idk if i can use that

#

oh

#

okay i understand

rich adder
#

i mean vector2.dot returns a float

#

the dot product ofc

radiant frigate
#

i basically have each enemy with a child that is just a bigger trigger collider,

#

but for example in this case im most looking at the last one, but if i just make it a simple raycast without comparing it would launch at the first one

#

giving an unpredictable and not pleasing result

#

i dont know if i explained myself

queen adder
#

Hello guys! Is there anyone here who would like to introduce me into game dev?

timid hinge
#

isnt this suposted to hide the other 2 maps?

eternal falconBOT
#

:teacher: Unity Learn β†—

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

rich adder
queen adder
radiant frigate
# queen adder Thank

this is just a recommendation, but when you finish the learning procces dont try to make a big game, go for arcades or small scope games

#

because the learning procces never ends

rich adder
radiant frigate
#

exactly

rich adder
#

you could probably just use vector2.angle as well

radiant frigate
#

i would need to look into what that is

rich adder
#

but dot should be fine too

radiant frigate
#

but i think i would run into the same problem where i would need 300 lines for checking which one is closest to it

rich adder
#

maybe

  foreach (Collider2D collider in colliders)
        {
            var directionToCollider = (collider.transform.position - playerPosition).normalized;
            var dotProduct = Vector2.Dot(playerDirection, directionToCollider);

            if (dotProduct > highestDotProduct)
            {
                highestDotProduct = dotProduct;
                bestCollider = collider;
            }
        }

        return bestCollider;```
radiant frigate
#

i would need to look what return does exactly because i only have a vague idea but it seems fine

#

only 1 thing

#

the collider changes with each foreach loop?

#

i guess so because if not it wouldnt make sense

rich adder
#

this just assume the function returns a Collider2D forgot to add that

#

but you can easily just store the bestCollider at script level too

#

names are inconsequential also

radiant frigate
#

script level?

rich adder
radiant frigate
#

oh okay

rich adder
#

not a local variable from a function/ loop

radiant frigate
#

yes yes

#

okay

#

imma try that because it seems to make sense

#

btw

#

idk how much a game scales, but how many raycast would cause lag?

#

because im scared and im only using like 10 rn

rich adder
#

raycast are quite performant

radiant frigate
#

i imagine

#

but, if i scale the game, and spawn lets say 10 enemies, each with 5 raycast, it would be 50 casts

rich adder
#

Overlaps and things that return multiple of something you should opt in for the Fixed version

#

aka nonalloc

radiant frigate
#

but it can get worse

radiant frigate
radiant frigate
#

i imagine

#

but like

#

10k is a lot of raycasts?

#

or is it like

#

average?

#

how much would be considered a lot

rich adder
#

there is no set measurement

#

its all relative

radiant frigate
#

because im scared of using even more than 20 per script

#

i suppose

#

but im scared that it gets to laggy from one day to another

#

lmao

rich adder
#

ofc everything you do has impacts but rays in not something I'd be most concerned performance drops from

radiant frigate
#

okay

#

ty navarone!

#

hope everything is going well

#

ill report back if i somehow mess up

rich adder
#

I haven't tested but it should work, I will try it as soon as back to see if didn't miss anything

radiant frigate
#

imma test it rn np

vale karma
#

thats my favorite phrase hehe

#

i say that alot at work

radiant frigate
vale karma
#

I havent tested it but it should work

radiant frigate
#

oh

#

LMAO

vale karma
#

navarone do you ever take a break? i was last on here months ago and you were ther still

rich adder
#

keyword *should *

vale karma
#

your brain must be big brain now

radiant frigate
#

fr he be helping me make half my games

rich adder
#

literally me steaming off my crap going on

vale karma
#

let me help these childrens so i can relax

queen adder
rocky canyon
#

thats ideal

#

i started w/ 3D b/c i actually find it easier and more intuitive than 2D

#

but it is more work in the long run imo

safe radish
#

for a plane mesh used for water. does it need to be discrete or might having shared vertices work better for that?

radiant frigate
#

you can do either 2d or 3d imo, the only thing you should look out for is to not trying to make overwhelming games, start low and easy

#

as i said, this is just what i think is the best option, you are free of doing however you find it more suitable

crisp anvil
#

Don't understand what I am doing wrong. Why would this not set the MarkerPanel/Text in this way?

    private void SetPathMarkersAlongPath()
    {
        foreach (GameObject marker in pathMarkers)
        {
            Destroy(marker);
            MarkerPanelUI.SetActive(false);
        }
        pathMarkers.Clear();

        foreach (OverlayTile tile in path)
        {
            GameObject marker = Instantiate(PathMarker, tile.transform.position, Quaternion.identity);
            pathMarkers.Add(marker);

            if (tile == EndPathTile)
            {
                MarkerTurnText = marker.GetComponentInChildren<TMPro.TMP_Text>();  <--- Here
                MarkerPanelUI = marker.transform.Find("Panel").gameObject; <--- Here
                MarkerPanelUI.SetActive(true);
                marker.GetComponent<SpriteRenderer>().color = PathMarkerColor; 
                MarkerTurnText.text = path.Count.ToString();
            }

        }
    }
queen adder
#

As it's a dream since very young

wintry quarry
radiant frigate
queen adder
#

Yes of course

#

I was thinking after 1 year of daily learning

#

probably

radiant frigate
#

probably more depending on how big it is

#

but you will feel it once you have a feel for how big games are, and how hard it is to do them as a solo developer

rocky gale
crisp anvil
queen adder
radiant frigate
rich adder
radiant frigate
#

i made an arcadelike-game but i wouldnt even consider it a game

rocky gale
#

but i dont get how the calculation works

queen adder
rich adder
#

the code is messy in the first place

rocky gale
#

how is it messy

rich adder
rocky gale
#

oh

rocky canyon
#

camOrthoSize * 2f - gapY - gapSize * .5f, xPos, false scary line of code πŸ™‚

#

its not too bad tho, since its small, and the function definition is directly below it

rocky canyon
radiant frigate
#

is there a way to break 2 statements with 1 break?

rocky canyon
#

whats ur starting code?

radiant frigate
#

i have a forloop inside an if

#

can i break the forloop with a break inside the if

summer stump
radiant frigate
#

wait no

radiant frigate
rich adder
#

yes you can use if to break inside for loop

radiant frigate
#

if >forloop >if

#

can i break the first if with a break in the 2nd?

#

like double break?

rich adder
#

what

radiant frigate
#

or should i do something like goto?

rocky canyon
#

lmao i was gonna say goto as a troll comment 😈

rich adder
#

what are you trying to do exactly

radiant frigate
#

lmao

rocky canyon
#

ya, i wish i could see the entire code block so i can wrap my head around it

rich adder
#

did the dash thing work?

radiant frigate
#

im on the proccess

#

fixing some other things related (this is one of them)

#

basically the raycast detects enemies and walls, so it can break if it hits a wall and take the enemies closer than the wall

rocky canyon
#
if(condition)
{
  forloop
    {
      if(secondcondition)
      {
      // you want a break here? [1]
      }
    }
  // that would skip this? [2]
}```
radiant frigate
#

indeed

rocky canyon
#

maybe someone knows.. but thats more complex than anything ive done thusfar

rich adder
#

if you want to skip the rest you need a return

rocky canyon
#

could u use a flag u set true when u first break? that returns later on?

radiant frigate
rich adder
#

from the code you sent you should not break tho

#

you want to check all iterations

rocky canyon
#

true..

radiant frigate
#

if its a wall i dont want it to be considered as a possible objective, and neither any ongoing objects that are further away than the wall (behind it)

rich adder
#

if you only want to seek enemy colliders user layermasks

radiant frigate
#

yes, but then it would consider even the ones that are behind a wall if the raycast hits

rocky canyon
#

thats how i do it..

rocky canyon
#

if u find an enemy behind a wall

#

then raycast a regular cast to see if its obstructed

rich adder
#

then put the enemies behind a component if statement

radiant frigate
#

so my idea was to include walls, and whenever it reaches a wall, to break the loop that goes throught the iterations

rich adder
#

no just filter out the walls

#

its ok to grab solid colliders, but an additional if statement in loop

radiant frigate
#

hm im understanding what you mean but im not wrapping my head completely around the idea

#

could you elaborate a bit pls

rich adder
#

instead of breaking you want to continue
if(!longDashHitsArray[i].collider.TryGetComponent(out Enemy enemy)) continue

#

this will skip doing anything below

radiant frigate
#

anything below in the same if or forloop or whatever right?

#

not like the whole function

ivory bobcat
#

In the loop

rocky canyon
#

the surrounding loop

rich adder
#

basically whatever is inside the loop

#

so the walls dont go in the part about Dot

radiant frigate
#

oh thats why the ! at the start

rocky canyon
#

not.. yea

rich adder
#

yes its same as == false

radiant frigate
#

yes ik

#

but i was thinking like you want that and if that is true to procced

#

but no, the continue skips if not true

#

which makes sense

rich adder
#

if its not enemy then skip this iteration

rocky canyon
#

my favorite kinda code questions

radiant frigate
#

why is that so? if i may ask

ivory bobcat
radiant frigate
rocky gale
radiant frigate
#

oh wait

#

so it skips in that moment

#

or maybe i just found a different solution

rich adder
#

RaycastNonAlloc still captures the walls

#

but now you're filtering further via if statement component check

rocky canyon
radiant frigate
#

(which will not be a debug.log later on)

#

so its the same but inverse

#

i think

rich adder
#

that makes no sense why would you only be checking dot on 1 then breaking

radiant frigate
#

nono

#

its after the forloop ens

#

ends

rich adder
#

yeah

radiant frigate
#

wait that wouldnt work, because in case the wall is the bestObjective, even if there is a good objective, it wont take it into account because it will take the wall as bestObjective and not work because of the if statement

rich adder
#

yes bestObjective would never be a wall if you put that filter i told you about

#

component is the best method imo, but ofc layers work too

radiant frigate
#

makes sense

#

but im scared of component so i think ill go with layers

rocky canyon
#

tryget components are OP

#

u should try to learn about em if u can

rich adder
radiant frigate
#

btw is there a way to have multiple colliders in a gameobject, my solution is to create a child and give it a collider, but i havent tried having 2 colliders on the same object

rich adder
#

whats scared about it

rocky canyon
radiant frigate
radiant frigate
#

then imma just remove the child and give it another trigger collider

rocky canyon
radiant frigate
#

and what type is enemy?

rich adder
rocky canyon
#

out MyScript referenceOfScript

rocky canyon
#

ur just checking if that gameobject has a certain script/component

radiant frigate
#

oh

#

okey

#

i understnad

rocky canyon
#

and if there is one u get the reference as the out

rich adder
#

and the bool becomes try

radiant frigate
rich adder
#

TryGetComponent returns a bool but out is the result if true

radiant frigate
#

i was just using it unsconciously lmao

rocky canyon
#

that happens sometimes πŸ˜…

rich adder
radiant frigate
#

lmao

#

ily guys you are a mood fr

rocky canyon
#

gotta stay sane somehow

radiant frigate
#

true

#

artist are uncomprehended minds

#

while programmers are literally sisyphus

rocky canyon
#

im more artist than coder.. so i guess im okay πŸ™‚

radiant frigate
#

both are good

rocky canyon
#

what kinda game u making btw?

radiant frigate
#

but my artist friend told me that he is scared of programmers, because they are like sisyphus, since no one valorates their work

radiant frigate
#

but i would say like a dungeon crawler mixed with hotline miami or katana 0

rocky canyon
#

well, good luck anyway πŸ€ πŸ‘

radiant frigate
#

ty!

#

i want it to be adungeon crawler but with the high activity of hotline miami and the cool parrys and dash like katana 0

#

or something like that

#

weird mix i think

rocky canyon
#

unique is good

radiant frigate
#

yes it is

#

i hope i manage to make it work

rocky canyon
#

just keep learning, if u get stuck take a break re-evaluate and get back at it later

#

learning + developing at the same time can be very organic.. and u can end up w/ something even better than u started w/

radiant frigate
#

i will, i have a complicated situation right now since i am travelling a lot because of work (being a teenager is like being a slave) but it helps me keeping my mind fresh for when i have time to work on my project

queen adder
rocky canyon
#

thats the best way to learn

#

hands-on

radiant frigate
#

yes

#

theory is good, but the most valuable thing is practice

rocky canyon
#

true.. focused practice

#

if u practice bad habits.. u just get good at bad habits 🫠

radiant frigate
rocky canyon
#

similar

#

but no, we were talkin about TryGet

radiant frigate
#

ohhhh

#

i understand

#

but i think this also works

#

and since i dont need the component for anything besides checking if its true imma rock with this

summer stump
rocky canyon
radiant frigate
#

okey

#

good to know

#

ty!

#

spawn camp, where you the one i talked with about ui?

rocky canyon
#

it depends on what issue u were having

queen adder
#

if (currentHealth = deathvalue)
{
Destroy(this.gameObject);
}

#

its telling me i cant do int into a bool asnyone got a fix?

rocky canyon
#

first off = is used for assigning values

#

not comparing them

polar acorn
radiant frigate
rocky canyon
#

== is the correct comparison

queen adder
#

im brand new to coding that you

#

thank you

#

it fixed it

vale karma
#

hey nav how could i get it to stop lerping entirely once its at the target position? it seems to always be doing it after i pick it up

#

jittering that is, not still lerping

radiant frigate
queen adder
#

spawn camp games you are the goat!

radiant frigate
#

you helped me with resizing my game and all that

#

he is indeed

rich adder
rocky canyon
#

sounds kinda sus lerping to me if its jittering

#

oh, i just noticed, you already know all this stuff

vale karma
#

yea one sec, i stepped away for a sec ill send a vid

#

i feel like it only enables the lerp or movement when its "used" or has been touched. Soon everything thats pick upable is gonna be jittery

queen adder
#

My game is crashing everytime I ender play mode

teal viper
teal viper
queen adder
#

freeze... I just wrote a while loops

teal viper
queen adder
#

while (isWaveGoing == 1)
{
Invoke("spawnEnemy", 2);
}

#

is that it?

teal viper
#

You need to make sure that the condition is changing during the loop execution

vale karma
#

increment isWaveGoing up by something until it goes over 1

queen adder
#

im brand new to coding im not 100% sure what that means

vale karma
#

While loops are pretty hard to use if your unsure how they work, I still dont use them for that reason lol

teal viper
eternal falconBOT
#

:teacher: Unity Learn β†—

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

queen adder
vale karma
#

a timer, or coroutine

hazy quail
#

I wish there was something like wait(4); rather than having to mess with coroutines

queen adder
#

what is a coroutines πŸ˜†

teal viper
vale karma
#

try a timer using delta time, but its better to learn the pattern

teal viper
teal viper
vale karma
#

dlich i need ur help bigdog106

queen adder
#

so should I use a timer or a cororoutine?

vale karma
#

coroutine

teal viper
# vale karma

Trying to understand what the issue is in the video. What should I be looking at?

queen adder
#

Alright ill try to learn it

queen adder
#

Just until I find a good partner on the way

summer stump
hazy quail
# queen adder so should I use a timer or a cororoutine?

make sure you don't ever destroy the object your coroutine's script is a component of. took me ages to figure out why my coroutine was never ending and it was because i was destroying the object before it finished executing

rocky gale
teal viper
sharp abyss
#

does anybody know how can I attach left lower arm to the weapon too but I dont want it to affect it physically.Or I can completely change the way I position sword. I use this script to rotate shoulder and elbows(elbows are only rotated when weapons are one handed)https://hatebin.com/rzpasthrvj. I tried to make weapons follow mouse cursor but couldnt.So if you know any solutions for one of these problems help pls.

#

some people suggested inverse kinematics but even if I watched tutorials I couldnt implement in for this character.

vale karma
#

NullReferenceException: Object reference not set to an instance of an object
UnityEditor.ProfilerWindow.SaveViewSettings ()

IConnectionState was not Disposed! Please make sure to call Dispose in OnDisable of the EditorWindow in which it was used.
UnityEditor.Networking.PlayerConnection.GeneralConnectionState:Finalize ()

I got these two errors ive never seen before, and cant get rid of. I undid all the scripts past the last point of testing so im not sure what this is

rocky gale
queen adder
#

How do i turn off when I let of of the movement key the player moves slightly i want him to stop imediatly

rich adder
teal viper
rocky gale
#

wouldnt that just give you the bottom of the gap

teal viper
rocky gale
#

yes but the pivot is at the bottom

#

o i think i get it

teal viper
#

I'd assume it has to do with inverting the sprite. Not entirely sure. Hard to say without having access to the whole project and seeing the pivots and stuff.

rocky gale
#

its for the bottom pipe tho and its for the height so i dont get how it returns the height between the bottom of the gap and the bottom of the camera

#

i would think it would give you the distance from the center of the gap to the bottom of the gap

#

o nvm i understnad now thx

fading mountain
#

Hey guys, I know this is probably a pretty simple and elementary question but I've been completely stuck on this issue for the past couple of hours. My platformer game has three levels, and each level has 3 - 4 different rooms. I have created each room as a seperate scene and added all of them to the build settings. Then, I created a scriptable object in C# called LevelSO which just has [SerializeField] List<Object> rooms = new List<Object>();, and added the room scenes for each level to their own scriptable object. Finally, I created another scriptable object in C# called LevelListSO with a [SerializeField] List<LevelSO> levels = new List<LevelSO>(); , and added my three LevelSO scriptable objects to it. In my game manager script, I want to:

  1. Get the levels[index]
  2. Get the buildIndex of the first room room[0] of the selected level
  3. Load the first room.
    How would I go about doing this? Is this possible? If not, what's the correct way of implementing the functionality I desire?
    Please let me know if you need the scripts themselves.
rich adder
#

where is the code question ?

fading mountain
#

I'm trying to figure out how to use it correctly

rich adder
summer stump
uneven quartz
#

I'm trying to rotate my gameObject on its z axis based on the direction it traveling from the player. So if the position is left, i want it rotating to the left.
The problem is im setting the target position after it gets spawned, and it seems to always to default to left.

if (targetEnemy != null)
{
    Vector3 directionToEnemy = targetEnemy.transform.position - Player.Instance.transform.position;
    float dot = Vector3.Dot(directionToEnemy, Player.Instance.transform.position);

    rotationSpeed = (dot < 0) ? 360f : -360f;

    transform.Rotate(new Vector3(0, 0, rotationSpeed * Time.deltaTime));
}

is where I'm at now, but it seems be choosing a rotation at random honestly. Any help or direction would be great.

fading mountain
# rich adder in what way?

Currently these are my scripts that I explained in my message above. I know I'm not doing it correctly because of this error message relating to LevelSO.cs line 18 ||" 'Object' does not contain a definition for 'buildIndex' and no accessible extension method 'buildIndex' accepting a first argument of type 'Object' could be found "|| but I have been tirelessly trying any change I can think of the past few hours to implement this functionality and can't !code

eternal falconBOT
fading mountain
eternal needle
rich adder
#

thats already 2 specific base classes that exist

#

UnityEngine.Object and System.Object

rotund bronze
uneven quartz
# eternal needle well your rotation speed is always 360 or -360. So itll have to choose one, if t...

I've tried a lot of other ways of getting the direction to the enemy position, and had never come across the Dot function before so was trying it.
it says 0 is only when the objects are perpendicular, which shouldn't happen that often with the random spawning, but maybe that is the issue.
would there be a simpler way of figuring out if an object's destination if going to be traveling -/+ on the x axis?

fading mountain
rotund bronze
#

u can use string if u eant

#

want

fading mountain
rich adder
#

Try not to use reserved class names. Unity already has a struct named Scene

queen adder
fading mountain
#

so does that mean I can only access the current scene?

uneven quartz
rotund bronze
fading mountain
rotund bronze
#

u might want a list/array of level data tho instead of just one

#

well better approach might be having serialized dictionary of level dictionary where u have the scne as key and list of room scene as value

echo hamlet
#

I am working on a fishing game and I would like to implement a system of animations that looks like Roblox fishing sim (You can cast the rod and still move around) I already have movement sussed and it just runs off a blend tree like so:
I don't really know what to do next. Any Idea what I sould do?

frosty hound
#

@echo hamlet Please don't crosspost. You can leave your question here.

echo hamlet
#

Ok

#

apologies

thorn lake
thorn lake
#

Additional question:

I'm following a tutorial and have noticed that his code does not contain the "0 references" indicators. Is that just a setting one can turn on and off?

thorn lake
#

Thanks.

#

@young warren

(In reference to the help/answer you gave me here #↕️┃editor-extensions message so we can continue in the proper channel)

I already followed the steps there previously to asking my Q but that's exactly the issue: Having the Visual Studio Code set as my External Script Editor and having the Visual Studio Editor's package installed in the Package Manager did not resolve the issue and I'm unsure how to proceed. Everything it up to date.

#

I've also tried deleting the scripts, closing everything, and reopening everything

#

Anyone know of anything else I can try to get my IDE to autocomplete code if those steps did not work?

#

I've got 3 questions right now:

  1. The above question.
    2. How does one post code here in that easy-to-view format that others were using before my comments? (Q2 answered)
  2. I completed code that should have shown a grid of "rooms" appearing on my Scene window but the rooms did not appear. Assuming everything was coded correctly, what else could be the issue? (I did not have any compiling error messages in Unity, Unity loaded the new code fine, and I was copying a tutorial's code).

Below is my code and a photo of what I *should * be seeing in my Scene (but am not):

eternal falconBOT
thorn lake
#
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class RoomManager : MonoBehaviour
{
    [SerializeField] GameObject roomPrefab;
    [SerializeField] private int maxRooms = 15;
    [SerializeField] private int minRooms = 10;

    int roomWidth = 20;
    int roomHeight = 12;

    int gridSizeX = 10;
    int gridSizeY = 10;

    private List<GameObject> roomObjects = new List<GameObject>();

    private int[,] roomGrid;

    private int roomCount;

    private void  Start()
    {
        roomGrid = new int[gridSizeX, gridSizeY];
    }

    private Vector2Int GetPositionFromGridIndex(Vector2Int gridIndex)
    {
        int gridX = gridIndex.x;
        int gridY = gridIndex.y;
        return new Vector2Int(roomWidth * (gridX - gridSizeX / 2),
            roomHeight * (gridY - gridSizeY / 2));
    }

    private void OnDrawGizmos()
    {
        Color gizmoColor = new Color(0, 1, 1, 0.05f);
        OnDrawGizmos.color = gizmoColor;

        for (int x = 0; x < gridSizeX; x++)
        {
            for (int y = 0; y < gridSizeY; y++)
            {
                Vector2Int position = GetPositionFromGridIndex(new Vector2Int(x, y));
                Gizmos.DrawWireCube(new Vector3(position.x, position.y), new Vector3(roomWidth, roomHeight, 1));
            }
        }
    }
}
#

To further clarify what my Scene is showing: It's just the single white Camera rectangle.

#

Do I need to be using ".NET SDKs?"

glass aurora
#

where to get knowledge and hlep about assets?

languid spire
winter tinsel
#

im flabbergasted

#

it should rotate on the z axis right?

#

by "angle"

#

that angle is the same angle that the rigid body turns

#

problem

#

it only rotates if i click fast enough???

#

what is going on??

#

and even then it doesnt rotate right

#

the first row is supposed to be me clicking in bigger invervals and the big smorgasboard in the middle is me clicking rapidly

#

you can see it rotates SOMETIMES

rapid bone
#

@winter tinsel how can i make a clicker game

winter tinsel
#

do not ask me lol i am near beginner

winter tinsel
#

he has a really good unity starter tutorial

rapid bone
winter tinsel
burnt vapor
#

Perhaps share the whole file

winter tinsel
burnt vapor
#

If possible, prevents unneeded lack of context

winter tinsel
#

ok

burnt vapor
eternal falconBOT
winter tinsel
slender nymph
# winter tinsel https://paste.ofcode.org/EtNqciU4DA74rCQCuRqKxN
float angle = Mathf.Atan2(look.y, look.x) * Mathf.Rad2Deg -  90;
transform.Rotate(0, 0, angle);

you are rotating by that amount but that should be the current angle.
also if the object faces up when not rotated at all you can just set transform.up to look, or if it faces right when not rotated you'd assign to transform.right, no need for that extra math.
also you could just use the (targetPosition - currentPosition) as the direction from this object to the target rather than the InverseTransformPoint call

winter tinsel
#

the problem is in the instantiate code

#

the last argument just wont work

#

the one that calls the rotation

#

it "works"

#

but only if i click fast enough??

slender nymph
#

well for starters, is there a reason that you are using Unity.Mathematics.quaternion instead of just UnityEngine.Quaternion? (not that it would make much difference, but like why are you doing that)

winter tinsel
#

to jsut match the "transform.Rotate(0, 0, angle)"

#

cause then it should be the same thing, a rotation around the z axis

#

unless theres some difference between degree rotation and euler angles

slender nymph
#

that's not what i asked but okay

winter tinsel
#

also

slender nymph
#

that doesn't answer the question i actually asked

winter tinsel
#

i dont understand quaternions lol

slender nymph
#

but it is inconsequential. so since you clearly don't understand what i asked don't worry about it

#

but just try what i first suggested and use transform.rotation instead of creating a quaternion from that angle you calculated (since it isn't going to actually match the rotation of the ship for the reason i already pointed out)

winter tinsel
slender nymph
#

it's a Vector3

winter tinsel
#

okay

#

so i can just assign say uh

slender nymph
#

but you're not getting the position of the projectile. you're using the position of the ship, no? becuase this is the "shipscript"

winter tinsel
#

yes but look in the instantiate code

#

the position of the projectile will be equal to the position of the ship

#

thats where it starts

#

then i need the right rotation (towards the mouse) and add the speed

slender nymph
#

your entire issue is that your ship is not rotated the way you expect it is

winter tinsel
#

the target is actually the mouse

#

no

#

its the projectile

slender nymph
#

yes

winter tinsel
#

the ship rotates fine

#

when i try to use the same code of the ship

#

for the projectile

#

things get whacky

#

i changed the sprite of the projectile to the ship for troubleshooting

slender nymph
#

quaternion.EulerXYZ(0, 0, angle) this does not produce the same rotation that your ship is at because you are not rotating the ship correctly. you rotate by the angle rather than setting the ships current rotation to the angle

#

so fix the ship's rotation like i suggested then you just use transform.rotation as the rotation for the instantiated object

frank zodiac
#

the BEST way to make a ground check in unity2d? raycast? ontriggerstay? physics2d.overlapcircle? i dont know which one to choose

slender nymph
#

there's hardly ever a "best" way to do something. but physics queries like raycasts and overlapcircles are going to be better/more reliable than trigger messages

slender nymph
#

note that a raycast has no volume so if you only raycast from the center of the object straight down it will only be considered grounded if the exact center of the object is over ground, so if the center is just ever so slightly off the ground, but you still have a decent amount of surface area touching ground it won't actually be considered grounded. you could use more than one raycast, or some cast with volume

#

or if that behavior is perfectly acceptable then a single raycast would be fine

waxen adder
#

I recall seeing in some projects that people have all of their script variables organized into neat sections in the editor. How do they do that?

#

i.e.
Movement:

speed
velocity

slender nymph
#

custom inspectors or attributes like Header, Space, etc

waxen adder
#

Ah, gotcha

slender nymph
#

there are also third party libraries that implement a bunch of organizational attributes for the inspector like NaughtyAttributes and OdinInspector

waxen adder
#

Will have to look into those, getting some more organization into the editor is something i like

thin summit
#

hi, just a question. do you guys use some generic movement system or your own?

slender nymph
#

itdepends
you use whatever makes the most sense for your project

thin summit
#

i just need a simple wasd first person movement :D

hexed terrace
#

Use the Unity FPS starter asset from the store

slender nymph
#

there are also dozens of tutorials for that

thin summit
#

well this is what i found

#

i think im goind with the modular fps controller

#

since it is free

waxen adder
#

What are the different ways to detect the beginning of collision? I know there's OnTriggerEnter and OnCollisionEnter. Any others?

hexed terrace
thin summit
winter tinsel
#

wherever i am on the screen the ship has no issue rotating

#

the ship and the projectile both look up at start

slender nymph
#

let's say your ship is currently pointed to 90 degrees on the Z axis. if the angle is 90 degress, rather than just not rotating it would rotate by 90 degrees

winter tinsel
#

OH

#

amazing

slender nymph
#

all you really need to do is this:
transform.up = target.transform.position - transform.position;

winter tinsel
#

wait cant i just somehow find a way to nullify it?

eager spindle
#

would fingerID always be equal to i in this case?

#

im finding a way to see if the current touch is over a UI object before raycasting into world space

slender nymph
#

https://docs.unity3d.com/ScriptReference/Touch-fingerId.html

However, the array index is not guaranteed to be the same from one frame to the next. The fingerId value, however, consistently refers to the same touch across frames. This ID value is very useful when analysing gestures and is more reliable than identifying fingers by their proximity to previous position, etc.

eager spindle
#

🫑

winter tinsel
slender nymph
#

use transform.rotation for the rotation like i told you earlier

thin summit
#

unity outdone themselves on this one... the materials

eager spindle
#

today I learned about touch.phase; I didn't need to make a check for when the first touch is made Facepalm

slender nymph
winter tinsel
#

now if i just give it forward velocity itll keep going in the direction of its current rotation right?

thin summit
slender nymph
slender nymph
#

forward is along the Z axis. but the projectile points along its Y axis. you're in 2d so if it starts moving along z you won't actually see it moving

slender nymph
eternal falconBOT
#

:teacher: Unity Learn β†—

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

slender nymph
#

but again, this is a code channel and that is not a code question

waxen adder
#

Is it normal for an object to collide with itself?

#

I could do some filtering to make sure something isn't colliding with itself, but want to make sure

slender nymph
#

a collider won't collide with itself but that doesn't mean that colliders on child objects can't collide with the parents or vice versa

waxen adder
#

The child objects of the one I'm messing with don't have colliders at all. I even have debugs firing off saying that it's colliding with itself for some reason

slender nymph
#

show the setup and relevant code

waxen adder
#

K 1 sec

fickle karma
#

Hello im stuck at reloading domain in unity on my macbook pro. Tried switching to another wifi. Tried deleting temp and library files. Its a consistent error anytime i try to go into play mode. I recently wiped my drive because of another issue in unity. Redownloaded the hub, editor 3.8f1, recloned the project from github desktop, and setup ide for visual studio code. Im at a loss. someone help me please. Still no official solution on this huge problem refering to https://forum.unity.com/threads/getting-stuck-on-domain-reload.1377126/

Still have not tried to move everything to another clean project, cause im looking for another potential fix. Last time i asked about this, i got no help, so please i would appreciate if someone could help me

slender nymph
#

if you disable domain reloading does it still get stuck?

fickle karma
slender nymph
#

no it isn't

waxen adder
#

This is everything I believe is relevant to the problem. If you need more info, let me know

fickle karma
slender nymph
#

But if the editor still gets stuck with that disabled then most likely you have an infinite loop in your code

fickle karma
slender nymph
slender nymph
waxen adder
slender nymph
#

no, literally just copy/paste what i provided

#

i did just edit it to fix something though so try now

waxen adder
#

Oh, weird

#

This happens exactly twice in the logs btw

slender nymph
#

are the numbers swapped in the other one

waxen adder
#

I recall this is a tell tale sign of... something wrong with how I'm doing the collisions.

#

No, they're different?

languid spire
#

it means a prefab is colliding with a game object

waxen adder
slender nymph
fickle karma
slender nymph
# waxen adder

one thing i will point out that is wrong with your setup is the use of both a CharacterController and a Rigidbody on the same object, they don't play well together and you shouldn't need both

slender nymph
waxen adder
slender nymph
#

the charactercontroller has its own collision message, and it can also work with OnTriggerEnter

polar gulch
#

Hello you amazing people!

hexed terrace
polar gulch
hexed terrace
polar gulch
jolly cobalt
#

In the old CinemachineConfiner there was the property CameraWasDisplaced. I cannot find it in the CinemachineConfiner2D. How can I check the displacement using the CinemachineConfiner2D now?

hexed terrace
glass aurora
#

anyone tell me whaat to do?

slender nymph
#

where have you declared checksphereRadius

glass aurora
slender nymph
#

no that's checkSphereRadius, i was asking about checksphereRadius

glass aurora
#

i dont know what does "," in C# just tell me how to fix it

slender nymph
#

if it wasn't obvious from my previous message, your spelling is wrong

glass aurora
slender nymph
#

have you considered spelling it correctly?

glass aurora
#

you can see the screenshot.

slender nymph
#

yes. and checksphereRadius is not spelled the same as checkSphereRadius

glass aurora
hollow vault
#

where do i ask my problem?

slender nymph
glass aurora
#

not to learn C#

#

i dont want to create documents etc for my office etc i want to use C# as a game deev.

slender nymph
#

to make games you'll need to actually understand what you are doing. therefore you need to learn c#

glass aurora
#

where you started?

#

ahm broken english

slender nymph
#

i already told you that there are beginner c# courses pinned in this channel

hollow vault
#

!bug

glass aurora
#

Beginner scripting?

slender nymph
#

if you need help with something then read #πŸ”Žβ”ƒfind-a-channel to determine where to ask your question. then actually ask the question in the most relevant channel

glass aurora
#

previous issue was fixed βœ…

slender nymph
#

sorry, i don't help people who refuse to learn the basics

glass aurora
halcyon geyser
#

Why do you call yourself an experienced developer when you cant even figure this out on ur own?

halcyon geyser
#

ur bio

glass aurora
gray ember
#

hey im making a tank control using wheelCollider and to turn im just powering 1 side. however its super slow due to the sideways friction. im just wondering if i should multiply my rotationSpeed to maintain the physics or just lower the friction?

hollow vault
verbal dome
slender nymph
hollow vault
#

saviour fr

glass aurora
#

i asked every single time that how to learn tell me now how to

halcyon geyser
#

"Show me how to learn C#"
Gets shown how and where
"No I want you to spoonfeed me all the answers"

languid spire
hollow vault
#

!code

eternal falconBOT
copper matrix
#

so idk if its the right chat but i try to let the maincharacter throw the Shuriken and trigger the bool IsShieldActive in the Shield Script. After the Deactivation the mainCharacter Should be able to destroy the ShieldEnemy by dashing threw him how can i make it work. Im very new so please explain like im 10

halcyon geyser
#

You dont want to actually reference the scripts, but rather reference gameObjects that hold those scripts

glass aurora
frosty hound
#
  1. Does your shield script have a IsShieldActive property?

  2. If you are checking if something is false, you use ==

  3. You can't put your OnTriggerEnter function inside another function. It's inside of your Update function right now.

copper matrix
#

cant find anything on the community hub

hollow vault
#
  public void Start()
  {
    //  instance = this;
      sceneindex = SceneManager.GetActiveScene().buildIndex;
      if (sceneindex != 0)
      {
          LevelRecords();
      }
  }
  public void Update()
  {
      LevelRecords();
  }
  public void LevelRecords()
  {
          int LevelCompleteScore = ((int)saveLevel.IncreasingTime);
          PlayerPrefs.SetInt("level " + sceneindex, LevelCompleteScore);
          print(LevelCompleteScore);
      Debug.LogError(PlayerPrefs.GetInt("level " + sceneindex, 0));
      Debug.Log(PlayerPrefs.GetInt("level " + sceneindex + "record", 0));
      if (PlayerPrefs.GetInt("level " + sceneindex, 0) >= PlayerPrefs.GetInt("level " + sceneindex + "record", 0))
          {
              Record = PlayerPrefs.GetInt("level " + sceneindex);
              PlayerPrefs.SetInt("level " + sceneindex + "record", Record);
              print(Record);
              recordTxt.text = Record.ToString();
          }

  }

okay so i am trying to save my highscore using this code but its not RUNNING like compiler just skip LevelRecords() funtion

hollow vault
halcyon geyser
#
public GameObject Shield;

public void Start()
{
  Shield.GetComponent<ShieldScript>().ToggleShield();
}
slender nymph
halcyon geyser
#

For example

languid spire
glass aurora
halcyon geyser
#
Unity Learn

Welcome to Roll-a-ball! In this learning project, you’ll: Use Unity Editor and its built-in capabilities to set up a simple game environment Write your own custom scripts to create the game functionality Create a basic user interface to improve the game experience Build your game, so other people can play it!

broken cargo
glass aurora
glass aurora
halcyon geyser
#

yes

glass aurora
#

i am ashamed tho dont wanna roll a ballllll i wanna make games AHEM AHEM well well well i should learn everything everyone started from that stage am i right?

halcyon geyser
#

correct

copper matrix
glass aurora
halcyon geyser
#

everyone started there

copper matrix
#

like the right one

halcyon geyser
#

So nothing to be ashamed off

broken cargo
slender nymph
glass aurora
hollow vault
slender nymph
#

well is the component attached to a gameobject in the scene?

glass aurora
#

i know how to use unity if i dont there is alot of tutorials about unity not on c#

copper matrix
slender nymph
hollow vault
copper matrix
glass aurora
halcyon geyser
#

its misspelled

#

capital I

slender nymph
hollow vault
slender nymph
# copper matrix

I do not see a variable or property called IsShieldActive here

sage mirage
#

Hey, guys! I am making a First-Person Horror game and I am dealing with a serious in my opinion issue. It is related with character controller and how to move actually the player down the stairs. Is there someone available to help me because I will have to create a thread?

broken cargo
hollow vault
#

sure

slender nymph
#

this is a code channel. also you'd need to provide some actual details

solemn wraith
slender nymph
solemn wraith
#

okay, thank you

copper matrix
frosty hound
#

Move the function outside of the Update function

fervent abyss
#

erm... im trying to disable "Allow unsafe code" in project settings but... it doesnt uncheck.. πŸ’€ i keep getting "Build interrupted" error

frosty hound
#
public class MyClass : MonoBehaviour
{
    private void Update ()
    {

    }

    private void OnTriggerEnter (...)
    {
    
    }
}
copper matrix
#

? like this

frosty hound
#

You just put it inside of another function

#

It needs to be on its own

copper matrix
#

but it should only be running while im dashing

#

should i do it with a bool?

cyan holly
#

i had a project on unity version control. So i wanted to work on my new PC so i donwloaded unity on it and opened my project on that PC however the download is taking so long its been 2 hrs is this normal?

frosty hound
#

I don't know what that has to do with dashing, but if you want the trigger to only handle code if you're dashing then yes you would check if IsDashing inside of the function.

copper matrix
#

but im too stupid do it like i think i cant connect these 2 scripts

copper matrix
slender nymph
#

no what they said was incorrect

halcyon geyser
#

yeah no sorry

slender nymph
copper matrix
#

i dont understand what osteel is saying tbh

#

started programming like a week ago

slender nymph
#

OnTriggerEnter2D should not be nested inside of another method

#

and you can put a boolean condition inside of that method if you only want its contents to run in a specific circumstance

languid spire
copper matrix
frank zodiac
languid spire
#

Note the difference

copper matrix
#

its still not working

#

so it kinda is cause he dies but he dies when i dont dash, he dies when i dont throw the shuriken he just always dies

#

on my shield script its printing tho

languid spire
#

So now you have the structure of the code correct =, you need to start debugging

copper matrix
#

can i ask for a bool status in update?

languid spire
#

that question makes no sense

copper matrix
#

sth like print(Bool Status)

#

so i know every frame if the bool is true or false

languid spire
#

do you have a variable called status?

copper matrix
#

i have a bool calles isShieldActive

languid spire
#

then, yes, you can Debug.Log that in update

copper matrix
#

how

#

Debug.Log(isShieldActive);

languid spire
#

Debug.Log($"isShieldActive {isShieldActive}");

slender nymph
slender nymph
#

well it looks like the issue is probably that you are trying to get input inside of FixedUpdate, but i don't have any info on what InputManager.GetInstance().GetJumpPressed() is doing

frank zodiac
frank zodiac
slender nymph
#

typically yes. but it also depends on how you are handling the input in the first place

#

simply saying "GetJumpPressed returns a bool" isn't helpful at all with regards to explaining how the input is actually being polled

frank zodiac
#
public void JumpPressed(InputAction.CallbackContext context)
{
    if (context.performed)
    {
        jumpPressed = true;
    }
    else if (context.canceled)
    {
        jumpPressed = false;
    }
}
slender nymph
#

then that should be just fine. you need to actually do some debugging to find out what is happening

frank zodiac
# slender nymph then that should be just fine. you need to actually do some debugging to find ou...
private void Update()
{
    if (IsGrounded() && InputManager.GetInstance().GetJumpPressed())
    {
        canJump = true;
    }
    else
    {
        canJump = false;
    }

    animator.SetBool("isJumping", !IsGrounded());
    if (!Mathf.Approximately(rigibody2d.velocity.x, 0f))
    {
        animator.SetBool("isWalking", true);
    }
    else
    {
        animator.SetBool("isWalking", false);
    }
}

private void FixedUpdate()
{
    velocity = new Vector2(xVelocity * InputManager.GetInstance().GetMove1Value(), rigibody2d.velocity.y);
    rigibody2d.velocity = velocity;

    if (canJump)
    {
        rigibody2d.AddForce(new Vector2(0.0f, yVelocity), ForceMode2D.Impulse);
    }
}

here, i split them up into FixedUpdate and Update, should that help?

#

or does it not make a difference

slender nymph
#

you need to actually do some debugging to find out what is happening

frank zodiac
slender nymph
#

anything relevant. make sure that everything is in the state you expect it to be

frank zodiac
#

debug a raycast?

slender nymph
#

yes obviously that is something that would be relevant to your issue

frank zodiac
#

πŸ‘

#

but how do i debug a raycast and set a specific height for it

#

because it doesnt let me set a height it just goes on forever

slender nymph
#

did you look at the docs for Debug.DrawRay?

#

<@&502884371011731486> spam

languid spire
#

<@&502884371011731486>

frank zodiac
slender nymph
#

try looking at the documentation so you can see how it actually works

frank zodiac
#

didnt know that

#

thanks

vast vessel
vast vessel
#

mb, fixed it

sleek gazelle
#

[moved to a pastebin]

slender nymph
#

so you remember how i said you should post a link to the !code ?

eternal falconBOT
sleek gazelle
#

I didn't know that was a thing, sorry

slender nymph
#

you're also still not providing all of the relevant context. there is nothing you've shown that would actually cause unity to freeze. you don't even have any loops or recursive methods (at least that we can see). so you need to provide all of the context. not just what you think it is

sleek gazelle
#

Hi, can someone please help me? Why using forward or left Vector2s in the path object makes my editor freeze?
https://hastebin.com/share/dihequpoba.java

sleek gazelle
frank zodiac
#

how can i make something happen every 1 to 2 minutes in unity

#

is there any other way beside coroutines

slender nymph
#

either a coroutine or a timer in update

frank zodiac
#

haha

slender nymph
#

that's one of the worst ways tbh. but i suppose it's technically an option, yes

raven token
sleek gazelle
#

If I just use Vector2.forward it works

slender nymph
#

you should try some proper debugging instead of trying random things. you can attach the debugger and break all when it freezes then inspect what the main thread is doing to see where it is actually getting stuck

sleek gazelle
#

But I need to use forward which is a Vector2 in the path direction

sleek gazelle
slender nymph
# frank zodiac why is it bad?

it uses reflection to call the method, you have to rely on the string name of the method so no local methods, no parameters. stopping it is not nearly as nice as with a coroutine

frank zodiac
#

in that case i will have to use a for loop

slender nymph
#

i don't know wtf you mean by that

sleek gazelle
frank zodiac
#

InvokeRepeating("MyCoroutine", 1f, 5f)

slender nymph
#

coroutines are functions. but you cannot start a coroutine with InvokeRepeating because it doesn't actually start the coroutine

frank zodiac
#

thanks

#
for (int i = 0; true; i++)
{
    yield return new WaitForSeconds(Random.Range(90f, 120f));
    StartCoroutine(InitializationCoroutine());
}

would this line of code be any dangerous?

polar acorn
frank zodiac
#

i was thinking of calling it in the update function

polar acorn
frank zodiac
gaunt ice
#

you can just run the code
you dont need another startcoroutine

polar acorn
pliant sleet
#

Should I use object pooling as a beginner ?

slender nymph
#

yes, why would being a beginner mean you shouldn't?

pliant sleet
#

maybe the fact that I don't really understand what it does behind

slender nymph
#

so learn?

pliant sleet
#

idk if i will understand it but i ll try

frosty hound
#

You had to know it in some way to even ask the question of using it though?

pliant sleet
#

a little bit

sleek gazelle
sage mirage
#

Hey, guys! I am making character controller movement and for one reason I am getting a bug when I am getting downwards the stairs. What issue is it because I think I have no collider there at that altitude, where my player actually is.

rich adder
sage mirage
rich adder
#

wouldn't hurt

sage mirage
#

Btw, I don't think it is a coding issue because it happens only at that place. alright wait

rocky canyon
#

rogue collider perhaps

sage mirage
#

Check from different perspective

#

I have changed player position

rocky canyon
#

yea the collider there is obviously the problem u can see it

sage mirage
#

The mesh collider I have?

rocky canyon
#

yea, from the middle floor

#

goes down to the bottom of the stairs

rich adder
#

oh its because of convex

rich adder
rocky canyon
#

ur player is rock-climbing

sage mirage
#

I did everything I have unchecked the colliders to see how it behaves the same thing

#

Give me a sec

rocky canyon
#

nope, its def the collider

sage mirage
#

I will send the code

rocky canyon
#

100 %

sage mirage
#

Do you think I have to make my own box collider and change its rotation and put it there

rocky canyon
#

you could do that yes

#

since the stairs butt up against a wall it should be fine

sage mirage
#

I did that for all game objects inside the house btw

#

Otherwise my player couldn't move on floors etc

rocky canyon
#

its only odd-shaped colliders that act out

#

b/c convex wraps around the out-most sticking edges like bubble wrap

sage mirage
rocky canyon
sage mirage
#

Here is the code btw for player movement

#

Btw for my upper stairs it works fine

rocky canyon
languid spire
sage mirage
rocky canyon
#

theres prototype kits i use from the asset store

#

these here

#

that way, my stairs look like stairs.. but the collider is actually nice and smooth

sage mirage
#

Btw, I ve changed from mesh collider to my own box collider place it there and the same happens

#

I really saw everything there is no box collider there somewhere

rocky canyon
#

im not exactly sure its a collider that u think it is. b/c that video u shown w/ the stairs gone the issue was still there

sage mirage
#

I did ctrl + a to view everything there is no collider

#

Do you think it is a coding issue?

#

I don't have any code except that I sent you

rocky canyon
#

πŸ€” i dont think soo tbh w/ u

sage mirage
#

That's my player controller

rocky canyon
#

if it was a code issue it would happen more frequently.. (not just in one area of the house)

sage mirage
#

I stuck on that bro 2 days I really can't find it out

#

I am going to other places as well to see if that happens somewhere else

rocky canyon
#
    public void MovePlayer()
    {
        if (RoundManager.instance.currentState == GameState.playing)
        {
            float horizontal = Input.GetAxis("Horizontal");
            float vertical = Input.GetAxis("Vertical");

            if (characterController.isGrounded)
            {
                velocity.y = -1f;
            }
            else
            {
                velocity.y -= gravity * -2f * Time.deltaTime;
            }

            Vector3 moveDirection = transform.TransformDirection(horizontal, 0f, vertical);
            Vector3 finalMovement = moveDirection * playerSpeed + velocity;
            characterController.Move(finalMovement * Time.deltaTime);

            Debug.Log(characterController.isGrounded);
        }
    }```
#

you can try adding a debug at teh end like i did here.. and see if ur player is grounded when he's floating like that (my guess is that it is)

rich adder
rocky canyon
sage mirage
#

I found out that there are other places that it does that not only one

rich adder
#

you still floating ? did you try raycasting to see whats under you ?

sage mirage
#

Never used that

#

What is raycasting?

rich adder
#

its a way to detect colliders

sage mirage
#

ok how to use that programmatically?

rich adder
#

if(Physics.Raycast(transform.position, Vector3.down, out var hit)
Debug.Log(hit.name)

#

very basic example

sage mirage
#

or do i have to create another function

rocky canyon
#

u can put it in update to run it every frame..

sage mirage
#

ok

#

How it behaves?

rocky canyon
#

then debug the hit like @rich adder mentioned

sage mirage
#

I mean what I am going to see

rocky canyon
#

well in this example

sage mirage
#

oh ok

rocky canyon
#

you'll see the object w/ the collider's name

rich adder
#

might need to filter out the player collider too

rocky canyon
#

nah, it shouldn't hit it from within its origin

#

don't quote me on that tho

sage mirage
#

ssets\Scripts\Game\PlayerController.cs(24,27): error CS1061: 'RaycastHit' does not contain a definition for 'name' and no accessible extension method 'name' accepting a first argument of type 'RaycastHit' could be found (are you missing a using directive or an assembly reference?)

#

I got an error btw

polar acorn
sage mirage
#

I just copy paste what the other guy told me XD

rocky canyon
#

ya, i think u should use hit.gameObject.name

#

in the debug

sage mirage
#

oh ok

#

no it doesn't work

#

It should be a game object?

rocky canyon
#

u checked digiholics doc page he sent yet?

sage mirage
#

Yeah

glad rune
#

i change the start color of this particle in the particle generator with the script. It does change the color but the particles dont
spawn for some reason, if the color isnt changed it spawns normaly

rocky canyon
#

had to check my code for a second

sage mirage
#

Oh I find it out

#

I had a box collider on a fench actually

rocky canyon
sage mirage
#

Outside the house

rocky canyon
#

it went from the outside through the house to theother side of hte fence

sage mirage
#

yes

rocky canyon
#

wrapped the entire fence in a box (like plastic wrap) πŸ˜‰

sage mirage
#

It was something like that

rocky canyon
#

yes! thats it

dapper sparrow
#

Hello everyone, I'm trying to update my android app target api level from 33 to 34 and I don't understand what's going wrong while building.. do you guys know please?
(Error messages in the console*)

rocky canyon
sage mirage
#

Btw thanks for that method I will be using it from now

rich adder
soft lotus
#

How do i find the center of an object that has it's pivot off center?

rich adder
soft lotus
#

Im trying to do a melee attack system, and for that i use an overlap box, the same shape as sprite

rocky canyon
#

^ bounds /2

soft lotus
#

Okay, thanks, it worked!

rich adder
rocky canyon
#

idk lol

soft lotus
rich adder
#

lmao

rocky canyon
#

im not a 2D player

rich adder
rocky canyon
#

TIL thanks πŸ™‚

rich adder
#

just double checking :p

rocky canyon
#

im guessing center is just bounds/2 in the background

#

maybe some absolute values too idk

rich adder
#

yeah probably too lazy to open up vs rn to go through bounds struct lol

rocky canyon
#

same πŸ˜„ im trying to put together an itenerary for the week 😬

rich adder
rocky canyon
#
using UnityEngine;
using SPWN;

public class WriteOnScreen : MonoBehaviour
{
    public string msg = "THE-KIT - v0.0.1 - 2024";
    public Color textColor = Color.cyan;

    [HideInInspector]public int textSize = 24;
    [HideInInspector]public Vector2 screenSize = new Vector2(1000, 200);
    [HideInInspector]public Vector2 offset = new Vector2(40, 40);

    private void OnGUI() {
           Utils.RealtimeDebug(msg, offset, textSize, textColor, screenSize);
    }
}
``` yea i have this code that lets me debug stuff on screen real quick
#

wait let me find Utils.RealtimeDebug

rich adder
#

ahh yeah that class

#

only when I use OnGUI yea

rocky canyon
#
      public static void RealtimeDebug(string text, Vector2 position, int fontSize, Color textColor, Vector2 widthHeight)
        {
            GUIStyle style = new GUIStyle(GUI.skin.label);
            style.fontSize = fontSize;
            style.normal.textColor = textColor;


            // Draw the text with the adjusted position and calculated size
            Rect rect = new Rect(position.x, position.y, widthHeight.x, widthHeight.y);
            GUI.Label(rect, text, style);
        }```
#

i was just wondering how i could scale it w/ the viewport

rich adder
#

Ohh nice. Is there a benefit to this instead of UGUI ?

#

I feel like thats where the Canvas shines here

rocky canyon
rocky canyon
rich adder
#

I feel like the UGUI is much easier you can even make prefabs thats why
yeah for quick debug i feel like ONGUI is good but anything else I just use canvas esp for designers

rocky canyon
#

as u can see i'd have to get teh viewport size and scale it

#

ahh okay.. thats probably what i'll do instead

rich adder
limber marlin
#

sorry

rich adder
#

all good

#

though I would suggest using Git instead of PlastiSCM

limber marlin
#

Wait what is PlastiSCM?

#

I'm trying to use Github right now

rich adder
#

Unity aquired it back in the day and renamed it to Unity version Control

#

but we all know the truth

#

subpar VC solution

#

there is a reason GIT is so popular πŸ™‚

rocky canyon
#

#Savage

limber marlin
#

Ah, I'm going to avoid that like hell because Git is the superior option

rich adder
#

the only benefit to the unity one is the in editor gui and "locking" a file like a scene for example

limber marlin
#

...wait so Git for Unity is PlastiSCM?

rocky canyon
#

id much rather use an external tool to pull and update before i launch

rich adder
#

its not based on GIT

limber marlin
#

what.

summer stump
limber marlin
#

Yeah that's what I thought

rich adder
#

Differences can be summarized as: improvements in merge, native support for large files and projects, optional file-locking, can work distributed and centralized. There are differences in the branching structure too: while in Git branches are just pointers, in Plastic branches are containers. Plastic versions directories and files identifying them with "item ids" which is good for move/rename tracking, while Git relies on diffs to rebuild the renames/moves and doesn't version directories.[15]

#

idk if they changed it since then but this was plastic

summer stump
#

Plastic SCM (now called Unity Version Control) is a completely different type of version control.

There are many

limber marlin
#

Yes

rancid tinsel
#

is there a simple way to find objects with tag that also have a specific bool set to true or false?

rocky canyon
#

simlpe enough.. two conditionals

rancid tinsel
rich adder
#

well yeah if you already have the component with bool

rocky canyon
#

find all w/ tag.. loop thru.. find ones w/ bool

rich adder
#

though if you already have the component , using a tag is useless

limber marlin
#

So I want to use Git and Github, and Git for Unity isn't working, so should I try to do something separate? I saw examples of Git without Git for Unity online

rocky canyon
#

ya wait.. if u have a bool within a component.. just search for components instead

#

navarone got big brain this morning 🧠

summer stump
limber marlin
rocky canyon
#

its a Github Fork..

rich adder
#

I think this is to add Git packages from Package Manager

summer stump
#

This is just an addon.

#

It is not an either or. This does not replace git

rich adder
#

just learn git + github how they work without the unity part

#

then add the unity part

limber marlin
#

Sorry, my question was phrased badly - should I use this addon, or use Git separately from Unity?

#

It's MADE by Unity hence my confusion, I assumed this was the default

rich adder
summer stump
#

It is not either or. You can use it or not, it will not affect your use of git itself
Just set up git first

limber marlin
#

I have Git setup

rich adder
rocky canyon
rich adder
#

don't lock yourself in with a specific company πŸ™‚

#

git is universal

#

github is just popular host, but you can use others or your own HDs

#

if unity somehow gets rid of that branch (look at other stuff unity abandoned)
now your project are tied to that possibility