#πŸ’»β”ƒcode-beginner

1 messages Β· Page 265 of 1

queen adder
#

IT WORKS

abstract pelican
#

Both work, but what's the best way to write?

wintry quarry
# abstract pelican

there's not really a "better" here. Do you want to enable all of them or just the Player map

abstract pelican
#

Both work, but what's the best way to write?

polar acorn
wintry quarry
#

If you want to enable them all, use the second one.
If you want to only enable the Player map, use the first

abstract pelican
#

player only

wintry quarry
#

Then the second one is wrong

#

it will enable all maps

rich adder
#

amazing πŸ₯Ή

abstract pelican
rich adder
polar acorn
#

A poop emoji for the correct answer. Tragic.

#

The Input System and an FPS Controller are not nested subjects. You should learn each separately and then put them together

languid spire
rich adder
languid spire
polar acorn
queen adder
abstract pelican
#

I just wonder why people are still sitting on the old system and recording videos about it

rich adder
languid spire
polar acorn
rich adder
queen adder
#

I got nitro but I am planning on cancelling it because it has no benefits besides more stuff on an app.

rich adder
languid spire
rich adder
#

fair enough

abstract pelican
#

Can we stop rambling off-topic about development?

polar acorn
rich adder
#

I reacted "Ok" but they blocked me

#

weird flex

polar acorn
rocky canyon
crisp anvil
#

I have a question If i define a virtual method in a parent class and override that method in the child class will it work the way i think it will?
I'm expecting when I override UseItem and call the base method itwill the isOnCooldown boolean from the child class and the cooldown timer from the child class as well, or is that something that would need to be passed in?
Parent Class

    public virtual void UseItem(Player player, ConsumableType type)
    {
        if (!isOnCooldown)
        {
            isOnCooldown = true;
            StartCoroutine(Cooldown());

            switch (type)
            {
                case ConsumableType.Health:
                    if (player.CanHealPlayer(replishmentValue))
                    {
                        int playerhealthbeforepotion = player.playerHealth;
                        player.HealPlayer(replishmentValue);
                        int actualHealing = player.playerHealth - playerhealthbeforepotion; // Calculate actual healing
                        Debug.Log($"Player restored {actualHealing} hit points.");
                    }
                    else
                    {
                        Debug.Log("Player is already at full health.");
                    }
                    break;
                case ConsumableType.Mana:
                    if (player.CanPlayerDrinkManaPotion(replishmentValue))
                    {
                        int playerManabeforepotion = player.playerMana;
                        player.GivePlayerMana(replishmentValue);
                        int actualMana = player.playerMana - playerManabeforepotion; // Calculate actual healing
                        Debug.Log($"Player restored {actualMana} mana points.");
                    }
                    else
                    {
                        Debug.Log("Player is already at full mana.");
                    }
                    break;
                case ConsumableType.Stamina:
                    if (player.CanPlayerDrinkStaminaPotion(replishmentValue))
                    {
                        int playerStaminabeforepotion = player.playerStamina;
                        player.GivePlayerStamina(replishmentValue);
                        int actualStamina = player.playerStamina - playerStaminabeforepotion; // Calculate actual healing
                        Debug.Log($"Player restored {actualStamina} Stamina points.");
                    }
                    else
                    {
                        Debug.Log("Player is already at full stamina.");
                    }
                    break;
                case ConsumableType.Food:
                    break;
                case ConsumableType.Drink:
                    break;
                case ConsumableType.Buff:
                    break;
            }
        }
                else
        {
            Debug.Log("Potion is on cooldown.");
        }
    }
    IEnumerator Cooldown()
    {
        yield return new WaitForSeconds(cooldownOnUse);
        isOnCooldown = false;
    }

Child class

public class MinorPotionofHealing : ConsumableBase
{


    public override void UseItem(Player player, ConsumableType type)
    {
        if (player == null)
        {
            Debug.LogError("Player not found. Cannot use potion.");
            return;
        }
        if (!isOnCooldown)
        {
            base.UseItem(player, this.consumableType);
        }
        else
        {
            Debug.Log($"{type.ToString()} is on cooldown.");
        }
    }

}

thanks.

wintry quarry
#

overrides completely replace the behavior of the virtual method

#

(hopefully I understood the question properly?)

crisp anvil
#

In the child class I include that
if (!isOnCooldown)
{
base.UseItem(player, this.consumableType);
}
Would that extra stuff in the override negate the base class?
Sorry, My question was if I called the base method from the parent would the Coroutine use the cooldownonUse variable from the Child class?

languid spire
crisp anvil
#

so im fine if its only declared

#

from the parent class
public float cooldownOnUse;
public bool isOnCooldown;

dawn kestrel
#

If vectorB is a Vector3 found by multiplying quadC * vectorA, can I get from vectorB to vectorA by multiplying -quadC * vectorB?

rocky canyon
crisp anvil
#

ty

autumn tusk
#

why isnt unity accepting this?

rocky canyon
#

b/c random doesnt give u gameobjects this

autumn tusk
#

weapons is an array with 4 items, if i print it it works fine

crisp anvil
#

use system.Random or UnityEngine.Random i think

rocky canyon
#

weapontospawn is a gameobject.. not a number

crisp anvil
#

or that

rocky canyon
#

weapontospawn = weapons[randomstuff]; might make more sense

autumn tusk
#

yeah

#

ill try that

polar acorn
autumn tusk
#

oh i realized

#

i am trying to store an int in a gameobject

#

πŸ€¦β€β™‚οΈ

#

thats the major issue here

rocky canyon
#

split out if it helps u understand better..

int randomNumber = randomStuff;
weapontospawn = weapons[randomNumber];

#

tends to help me.

rocky canyon
#

C# thats who!

#

your ide should have also told you that..

#

if you hover over the error.. it should give u some pretty good hints

#

cant implicity convert integer to gameobject or something like that

rich adder
dry gate
#

Hi! I'm following a beginner tutorial on writing code in unity (using Microsoft visual studio), and for some reason, when typing the code, the text suggestions don't appear below

eternal falconBOT
rocky canyon
#

configure it

dry gate
#

Thank you so much!

tropic marten
#

can anyone suggest the reason why play player doesn't wallslide correctly if the gravity has been inverted and they are now on the ceiling? The wall slide doesn't slow down the y movement like ity does if the player is on the floor:

    private void WallSlide()
    {
        if (IsWalled() && !IsGrounded() && horizontal != 0f)
        {
            isWallSliding = true;
            rb.velocity = new Vector2(rb.velocity.x, Mathf.Clamp(rb.velocity.y, -wallSlidingSpeed, float.MaxValue));
        }
        else
        {
            isWallSliding = false;
        }
    }
rocky canyon
#

if ur inverted.. then obv is not the same..

oak mist
#

Navmeshagents cant do pathfinding for objects roaming in 3d correct

#

right?

tropic marten
night mural
rich adder
oak mist
rich adder
#

oh you cannot make flying ones, but you can certainly Offset your enemy to make it look like its flying

oak mist
#

oh havent thought of that.

languid spire
oak mist
#

what do you mean?

#

So in context, theres a spaceship, enemy spaceship and some asteroids

rich adder
#

you can also bake a navmesh surface for sky itself if you have obstacles there, then disable the renderer for it

oak mist
#

i want the spaceship to avoid the asteroids when trying to gun for the player spaceship

oak mist
languid spire
#

normally the agent base is the object pivot point, you can offset that by, for example 2 y, so that the obuject can be at + 2 y (i.e. flying) and still use nav mesh

rich adder
oak mist
#

so my navmeshsurface would actually be the enemyship?

#

oh i see

#

or am i hearing it wrong

rich adder
#

no navmesh surface is the plane / height they will be at just used for bake

oak mist
#

sorry im still a little confused#

rich adder
#

your usecase is diffcult to do with navmesh without some hacky bits

#

honestly might be better off using rays and shifting your enemy, cause you can make ship avoid them

oak mist
#

yh i was thinking to use raycasts and detection

kindred stratus
#

How do I detect when someone clicks a circle collider

swift crag
rocky canyon
swift crag
#

It's unlikely that there will be a huge wall of asteroids that completely blocks movement

oak mist
#

yh

#

they are spaced out

swift crag
#

A navmesh is a good idea if your game isn't full six-degree-of-freedom space combat

#

i.e. your game is mostly aligned to a plane

rocky canyon
#

for asteroids in teh way.. u could do the same.. u could have them exist on the navmesh

rich adder
# rocky canyon

the problem is this wont avoid the Asteriods at the same plane as ship unless they will also be offset

rocky canyon
#

but their graphics be in the sky

rich adder
#

truth

oak mist
#

ah fair enough

rocky canyon
#

A* ftw

swift crag
#

Pathfinding is useful for dense obstacles

#

where most random paths will just bang into a corner and get stuck

#

If you can just move towards a target with some small deviations, do that

oak mist
#

yh i may just stick with learning raycasts

rocky canyon
#

oh πŸ’―

oak mist
#

thank you so much anyways i may experiment

rocky canyon
#

if u havent yet, learn raycasts asap

#

raycasts and trigger volumes are like 60% of gamedesign

oak mist
#

actually one last issue while im here. Ive been practicing with some AI movement: https://pastebin.com/XCu4DFRn. It moves pretty well, but it seems to rotate insanely quickly. I saw a channel that used navmeshagents 'SetDestination' method, but i cant use navmesh in my example so i improvised, but yh im getting the rotation issue.

#

because after i am going to add it so the ai can target asteroids to shoot at rather than the player (which i just learnt how to do), and this adaptation could be very useul. I have made some code to control the move of my actual ship that i like so im thinking of adding it in to it once i figure this out

rich adder
#

!collab

eternal falconBOT
summer stump
#

You've been on this server a long tome to get banned

Oh, it's gone

rich adder
#

oh they posted in all channels

#

fml

ivory bobcat
#

Don't ping everyone (it doesn't work) and collab posts aren't accepted

oak mist
#

cold

rocky canyon
#

like here, the navmesh is actually always facing forward..but depends on what u want to accomplish.. you can change the rotation speed in the navmesh settings

kindred stratus
#

How do I detect when someone clicks a circle collider 2d

wintry quarry
#

Or IPointerDownHandler

queen adder
#

hey, why the audio doesnt play?

public AudioSource audioSrc;

(...)

private void SpriteTouched()
{
    if (audioSrc != null && audioSrc.clip != null)
    {
        audioSrc.Play();
    }
    else
    {
        Debug.LogWarning("AudioSource or AudioClip is missing!");
    }

this is NOT the whole script, but everything after audioSrc.Play(); works and no error or warning is shown

queen adder
queen adder
polar acorn
#

See if anything logs at all

oak mist
#

So it’s not entirely needed in my scenario

#

Fair enough

queen adder
#

sure

oak mist
# oak mist Fair enough

But what I still don’t get is why the ship moves so weirdly. It quickly moves or sometimes teleports to a certain positions and then just moves straight forward

#

I want more fluid movement when going to that position

#

I’ll do some more research on plane movement and see what comes of it

polar acorn
# queen adder

Okay, so it looks like it is playing fine. Are you sure your editor isn't muted and you have an audio listener close enough to source to hear it?

wintry quarry
#

Which will cause it to restart each frame

queen adder
rich adder
wintry quarry
#

You're running it in update

queen adder
#

but it basically runs the spritetouched function only when there is input from mobile device, not every frame...

wintry quarry
#

As long as you have touches

#

It's definitely every frame as long as there's at least one touch

#

Debug and see if and when the code runs

queen adder
rich adder
queen adder
#

oh wait, i think i see the problem

#

im litteraly destroying the object directly after i play the sound

rich adder
queen adder
#

now i gotta think how to solve that

rich adder
#

have an Audio Manager which wont destroy

queen adder
#

in an empty object?

rich adder
#

yeah why not

#

idk if thats pricey though constantly making a new AudioSource

queen adder
#

i didnt complete coding it yet but i think there can be another problem

#

cause when there is going to be a lot of piece then the sound will be player every 0.1s and that may not work with audiomanager gameobject

rich adder
queen adder
#

okay dont worry playclipatpoint solved it

visual hedge
#

Maybe I'm in wrong channel, but I think it's appropriate to ask it here anyways:
Planning tiled dungeons. Only option the player will ahve from the moving and input = those 2 UI arrows. THose aren't coded yet, basically clicking on either it will just give the MoveTowards() which will move player to the tile left or right from present one (if possible). 1 Tile at a time and I guess each frame will have it's own "thing" which player will ahve to go thru first before moving further. Again, 1 tile at a time.
The question is, though: Best way to determine which direction player can go? For instance: there may be situations where player can't go right or can't go left. As far as I understand it has to be detected within the tile player is standing on or by the grid code? I use some tile gridmap editor.
Asking for suggestions, what would be best approach to such type of dungeon? What do I ahve to do first, what do I have to do second and so on?

rocky canyon
#

@rich adder good idea mate

rich adder
rocky canyon
#

ya, imma keep the readme for the BIRP project

#

but this is hella more stylish

rich adder
#

Next is custom Inspectors πŸ’ͺ

tender stag
#

how can i access this height through script?

rocky canyon
rich adder
rocky canyon
#

thats why my first dependency is NaughtyAttributes! lol

rich adder
#

i make everything a custom inspector now

rocky canyon
#

love that [Button()] attrib

rich adder
#

haha yeah its convenient , I just hard headed and code everything myself when possible

rocky canyon
#

check out the doc's has all the properties and how to access em

kindred stratus
#

How do I make onmouseenter work with a specific collider?

rocky canyon
#

put it on a script the object, or use Unity's EventTrigger component

rich adder
rocky canyon
#

you'll also need the event system and the graphic raycaster that usuaslly comes w/ it

rich adder
#

on mouseenter doesnt use Canvas

#

you're thinking of OnPointerEnter

rocky canyon
#

the EventTrigger uses it doesn't it

rich adder
rocky canyon
#

the inspector component

rich adder
#

the only way that works on colliders if you have the 3D/2D Physics Raycaster on the camera

#

EventTrigger component I mean

rocky canyon
#

i actually have a video i forgot about lol

rich adder
rocky canyon
#

been a while.. i always get all the different methods mixed up

#

have to re-watch my own video sometimes lol

rich adder
#

this is still using raycast thouggh no ?

rocky canyon
#

well the world buttons 1 uses a raycast 1 just uses the OnMouse functions

rich adder
#

I meant the World Objects colliders can get EventTrigger events if you put this

#

without raycast

rocky canyon
#

ahh true, this is how the left world button works

rich adder
#

yeah OnMouseDown is different cause it runs from Monobehavior

#

the collider on it to be precise

rocky canyon
#

mmhmm soooo many different ways to click lmao

rich adder
#

yeah I usued to use that non-stop before using raycasts lmao

rocky canyon
#

raycasts make me feel more powerful πŸ˜„

rich adder
#

i started learning raycast when I realized it wasnt that precise

rocky canyon
#

like i have more control over the world

rich adder
#

yeah that too, especially once you deal with Layers

rocky canyon
kindred stratus
#

if i have 2 colliders on the object will it happen for both colliders and how do i make it so it only happens for one of the colliders

rocky canyon
#

remove the other one 😬

#

why you have two colliders? whats the reason?

queen adder
rocky canyon
#

ahh clicker game.. u evil

rocky canyon
#

i normally seperate my colliders onto different gameobjects

#

even if its for the same object

#

that way i can set layers, and ignore 1 if i need to

rich adder
queen adder
#

well technicaly its a mobile channel and my game is related to mobile development

rocky canyon
#

you'll probably get away with it a few times b4 a mod sends u a message πŸ˜„

rich adder
queen adder
#

i posted it there also

rocky canyon
#

crossposts ftw πŸ˜…

queen adder
rocky canyon
#

loophole

queen adder
#

i may be wrong but its not only for questions

rocky canyon
#

well dev-log is a better place anyway.. you can add to it

rocky canyon
#

instead of ur posts being gapped up

rich adder
#

all channels say that but generally are for help questions/topics

rocky canyon
#

Foptciy got a big question coming

rich adder
#

(not me saying , mod)

toxic flax
#

When I click the Add Component btn on a gameobject I get an error:

System.Collections.Generic.Dictionary`2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) (at <ee4485bb020b402fb901fb78b3f9a4cd>:0)```
When I double click the error it says file not found. I am using pretty mismatched versions of things like assets because I'm trying to program on a mac where the project unity version doesn't exist for mac, any quick fixes?
rocky canyon
#

ohh photon πŸ€”

rocky canyon
#

if u do u should get rid of 1

rich adder
#

what exactly is weird about it ?

#

make a custom struct ?

rocky canyon
#

[x,y]

#

its like basic math

rich adder
#

something you should probably ask Microsoft lmao

toxic flax
rocky canyon
#

the inspector doesnt show?

toxic flax
#

like I can't even add a sprite component or anything

rich adder
#

it makes kinda sense to me,
its an array but deuce

toxic flax
#

ill record

rocky canyon
rich adder
#

make a custom struct

eternal needle
toxic flax
rocky canyon
#

ohh, have u tried a simple restart?

toxic flax
#

yea

rich adder
#

its not even that difficult

    public struct XY
{
    public int X; public int Y;
}```
rocky canyon
#

im not very familiar with Photon, but ill do a bit of googling to try to help ya real quick

toxic flax
#

no similar results πŸ™‚

rocky canyon
#

its an Editor/Photon error..

toxic flax
#

yea

rich adder
#

then having a smart IDE this would be a non-issue

heavy knot
#

so subjective its not even fathomable

rich adder
#

so? X n Y are just variable names, you can call them Rows,Column if you want

#

wdym rows contain columns

heavy knot
#

chess board is a grid

rich adder
#

rows and columns are different

eternal needle
toxic flax
#

when I dble click the error vscode says
File not found: /Users/bokken/build/output/unity/unity/Editor/Mono/Inspector/AddComponent/AddComponentDataSource.cs

rich adder
#

wat i sent is exactly a GRID

heavy knot
#

yes but rows containing columns is what you said that is not a grid in my mind

#

that sounds like a jagged array

rich adder
#

man this is how microsoft wrote it, just get over it

eternal needle
#

Then make a class which represents the grid, and can only be interacted with through your class. Enforce any structure you want

#

None of these are matrixes, everything is simply just an array of arrays. But yes a jagged array let's you have different array sizes

kindred stratus
#

how do i check if a collider is triggered

ionic juniper
#

is it normal visual studio is not showing me the files ?

rocky canyon
rich adder
#

cause you should not be touching those

rocky canyon
#

visual studio shows u text /code

#

it doesn't care about ur .assets and graphics

rich adder
#

.meta files are important files to keep reference not broken , they are generally ignored in IDE

polar acorn
#

2D Array: Array[rows,cols]

  • Creates rectangular matrix with the given numbers of rows and columns
  • Indexed with [x, y]

Jagged Array: Array[][]

  • Creates an array of arrays, meaning each "sub" array can be of any length
  • Indexed with [x][y]
strong wren
#

You can most likely change a setting to show all files, if you so desire.

rocky canyon
#

not the same name..

eternal needle
#

At the same time you can call it a grid, these are just things we associate it with. It can be called a matrix but you most likely are not doing any real matrix math on these

rich adder
#

should be fine

#

also thats a field not property

rich adder
rocky canyon
#

myThang

rich adder
#

Piece CurrentPiece

#

or something

rocky canyon
#

NotReally notReally;

#

BoardSquare boardSquare

#

i just end up using alot of compound words

#

works out good

#

u can always come up with own convention..

#

just gotta be consistent

rich adder
#

no one is forcing you to use them

rocky canyon
#

ohh then yea,, try to stick to c# conventions then

#

if its a portfolio

rich adder
#

"I want a job in c# but hate everything c#" πŸ‘

polar acorn
#

Who cares, better than having a variable with the same name as a class. But also since this is a collection you should at least call it Squares instead of just Square

rich adder
#

well better get used to it then lol

rocky canyon
#

atleast with an IDE it'll hold ur hand a bit.

#

imagine not using conventions back b4 intelligent IDEs

rich adder
#

c# recommends _ for private variables

#

I dont do it

#

I hate _

rocky canyon
#

neither do i..

#

i use _localVars;

#

PublicVariable;
privateVariable;

rich adder
rocky canyon
#

yup that too..

rich adder
#

i dont see the big fuss for _ scripts look ugly af

rocky canyon
#

depends on how much my brain is working for the day

#

m_Variables; are ugly tho

rich adder
#

Unity πŸ˜΅β€πŸ’«

modest dust
rich adder
#

the only benefit for _ or any other prefix i found is that it speeds up finding all Fields for example in IDE list

modest dust
#

Any convention is fine, as long as it's consistent and not too... unique. Keep it simple and all will be fine

north kiln
#

They don't collide with built-in Unity nonsense, and they're the C# standard, both of which are the benefits to me

#

I don't think I've ever used prefixes to find fields, I would look at the structure view

rich adder
#

yea

eternal needle
#

The only difference would be if this was some serialized class and property I believe

#

Which is unity specific

teal viper
#

If it's supposed to be a constant value, maybe use const instead.

#

Instead of a property + baking field.

modest dust
#

Maybe he wants a runtime const, but for that you'd use a readonly field

rocky canyon
#

sounds valid to me

#

public static bool IsValidMoveForPawn
public static bool IsValidMoveForRook

#

etc, then pass in the current row and col to see if the move is valid...
then check if theres a piece there, capture it, etc

#

i think thats how i'd do it.. but im just a noob πŸ˜„

autumn tusk
#

i am so confused

#

so i have an input

rocky canyon
#

hello confused πŸ‘‹

autumn tusk
#

and it works whenever i open it inside the unity editor

#

but whenever i play a build

#

the input doesnt work for some reason

rocky canyon
#

and the window is focused?

rich adder
#

prob resolution change issue if its UI

#

poor anchoring elements prob overlap

rocky canyon
#

^ thinkin this too.. not sure about other inputs

rich adder
#

unless they mean some other type of input πŸ˜…

rocky canyon
#

i think ur on to it

#

not sure why kb or mouse input wouldnt work

autumn tusk
rocky canyon
#

UI clickity click input?

autumn tusk
#

basically i have a weapon pickup

#

its a key input

rocky canyon
#

ohhhh.. odd

rich adder
#

ohhh key input

rocky canyon
#

build a developement build..

#

and have debugs run to make sure they are indeed working

#

(that way you'll have a console window in ur build)

rich adder
rocky canyon
#

life-changer

rich adder
#

neat! thought about building one but if there is an asset im down for that

#

i like the one inside source sdk

rocky canyon
#

ya, debugs get routed to it.

#

soo its like the best of both worlds

rich adder
#

oh yeah i use his runtime file browser

#

dudes a saint

autumn tusk
#

ughhh

#

this is so frustrating

#

i thought my build was done....

#

i even released it on itch πŸ’€

rocky canyon
autumn tusk
rich adder
rocky canyon
rich adder
#

thanks!

rocky canyon
#

tick the box that says development build

quartz mural
#

im really sorry but i dont understand, can u give me an example please?

polar acorn
autumn tusk
#

i got warned about my own game, nice

modest dust
#

A struct or class.

rocky canyon
quartz mural
rich adder
#

or self sign just works on your machine

rocky canyon
#

Publisher: Unknown πŸ΄β€β˜ οΈ

autumn tusk
#

dont you also have to pay microsoft to get rid of the unknown app popup

rich adder
#

yes for code signing it cost money, not microsoft you do it via code signing company

polar acorn
rocky canyon
rich adder
#

or just like, upload it to steam. It signs it all for you

rich adder
rocky canyon
#

im also looking for win10/11 link but cant find it

#

only unity discussions

rich adder
#

yeah sadly it cost yearly, just like macos dev account

#

thats why steam is convenient , its a one time fee and your app is pretty much signed

#

yay DRM!

autumn tusk
#

god i hate code signing so much

#

i feel like itd be the easiest thing to replace with ai

rocky canyon
#

meh, i run unknown sources all day long πŸ˜„

#

windows defender got my back

rich adder
#

Live dangerously or no gains!

rocky canyon
#

if its a unity program.. i gotta elaborate

#

not unkown source exe's

#

whats about this sign-tool

#

self- signing i guess thats what that is

rich adder
#

yea you can self-sign to get rid of warning on your machine

#

doesn't work across machines

rocky canyon
#

seems a bit.. pointless lol

rich adder
#

if you could self sign your apps people would self-sign a spyware/virus as a legit app UnityChanLOL

rocky canyon
#

oh im not saying that..

#

but if ur running ur own software..

#

are u ocd that bad u have to remove the warning u know about?

crisp heart
#

hi kinda of a dumb question, ive just downloaded some assets from the store into my unity. but they didn't show up in assets under project? last assets i downloaded showed up, but not these ones, anyone know a fix?

rocky canyon
#

gotta make sure i dont run this virus i wrote on myself lol

rich adder
#

lol

rocky canyon
#

have u tried shuffling thru teh different types of assets

rich adder
autumn tusk
#

jesus christ my game is laggy

rocky canyon
crisp heart
crisp heart
rich adder
crisp heart
#

(its my 2nd day using unity lmfao)

rocky canyon
#

no, dont try, do it

rich adder
crisp heart
crisp heart
rocky canyon
#

indeed

rich adder
#

classic!

crisp heart
#

had to happen at some point

rich adder
#

happens to me at least once every few weeks

rocky canyon
#

you're gonna end up being one of those guys that adds a new script reference and always clicks play before realizing it isn't assigned

crisp heart
#

btw did u guys learn coding while making games or went straight to learning code specificly?

rocky canyon
#

both

crisp heart
#

im planning on learning code while modifying already existing scripts if that makes sense, good strat?

rich adder
#

my first project in unity was modifying the FPS Microgame

rocky canyon
#

decent strat, but gonna need supplemented with Google

#

and extending ur knowledge about what it is ur modifying

crisp heart
#

yeah i guess

#

appreciated

rocky canyon
#

no, you know

#

πŸ˜‰ lol πŸ€ good luk

rich adder
crisp heart
#

is it good ?

rich adder
#

well dont

#

no its shite

crisp heart
#

yeah i guess its like a cheat code

rich adder
#

not even

#

it will give you mostly wrong answers

crisp heart
#

oh ye that happens alot

#

thnx for the headsup

rich adder
#

people mistake it for "thinking" its just pattern matching close enough to your prompts

dim bridge
#

Hello does anyone have a tip on checking the collisions for a collider that is serialized (I have two colliders on an object and want to use one as a check for jumping) could I do C# if ( [ColliderHere].IsTouching() && ![ColliderHere].IsTouching(playerCollider) ) to check if this collider is touching anything

#

Ok ig not intellisense says that's invalid. Ik I can do a box cast in the script but I figure this might be a good method for if you had multiple triggers on a game object using colliders also ig this wouldn't truly work anyway bc its a trigger

wintry quarry
dim bridge
#

I have a 2nd collider on the player marked as a trigger I am trying to check. I want to check if this trigger is colliding with anything else except the players main collider

proven inlet
#

hey guy sorry for disturbing, i have a player that move toward point to point but i want to invert the mouvement (and vice versa) when i press space but i dk how to inverse the count of an index

transform.position = Vector2.MoveTowards(transform.position, Pattern[pointsIndex].transform.position, speed * Time.deltaTime);

  if (transform.position == Pattern[pointsIndex].transform.position)
         {
           pointsIndex++;
         }
        if (pointsIndex == Pattern.Length)
         {
           pointsIndex = 0;
         }
dim bridge
proven inlet
#

not working :/

rich adder
#

or use modulo to wrap it

dim bridge
proven inlet
#

like its working but one time

rich adder
#

again share current code, also check console for errors

dim bridge
proven inlet
#
{
    [SerializeField] Transform[] Pattern;
    private int pointsIndex;

    public float speed;

    private void Start()
    {
        transform.position = Pattern[pointsIndex].transform.position;
    }

    private void Update()
    {
        transform.position = Vector2.MoveTowards(transform.position, Pattern[pointsIndex].transform.position, speed * Time.deltaTime);

        if (transform.position == Pattern[pointsIndex].transform.position)
         {
           pointsIndex++;
         }
        if (pointsIndex == Pattern.Length)
         {
           pointsIndex = 0;
         }

        if (Input.GetKeyDown("space"))
        { 
            pointsIndex--;
        }
    }

}
dim bridge
#

yeah check if points index is !0

#

if it is either dont let it do anymore or set the index to the length

#

depends what you want

rich adder
#

yeah def at least put if(pointsIndex)>0

#

also shouldn't this be
if (pointsIndex == Pattern.Length-1)

dim bridge
#

because if the length is say 3 you have index 0,1,2

quartz mural
#

@polar acorn bro i finally got it to work, but i got this new problem can u check it out

proven inlet
#

ok ty ill try

dim bridge
#
        if (Input.GetKeyDown("space"))
        { 
          if (pointsIndex != 0)
          {
            pointsIndex--;
          }
          //Add if you want to go from the first to last point, else remove this else statement
          else
          {
            pointsIndex = pointsIndex.Length-1;
          }
        }
#

This should be right

#

also might not be bad idea to add a delay to this so the object has time to get near the next point if you are trying to make it look snappy

#

(Sorry, I went ik what I'm doing mode, but I'm still here to ask a simple question myself lol)

dim bridge
#

just need a method to check what the serialized trigger touches/ doesnt touch bc i cant use void OnTriggerEnter Since that handles the first collider

rich adder
#

just use an Overlap, ignore player layer

ionic juniper
#

how can i change "EniCode" name ? to a specific name

polar acorn
rich adder
#

doesnt new Collider component have option to already ignore certain layers anyway ?

teal viper
rich adder
#

or yeah just have it on two diff objects ^

#

serializing a collider how you're doing is not a good way to do it

dim bridge
#

Is there a way to carry variables between scripts bc all this trigger does is check if the player is allowed to jump

rich adder
#

ofc there is, if you couldn't this language would be useless

teal viper
ionic juniper
teal viper
#

All the trigger should be doing is telling your controller wether there's is a collision or not and with what.

#

The controller should decide what to do with it.

rich adder
#

though , if you're doing ground check may I suggest using OverLapBox/Circle instead of Triggers

dim bridge
polar acorn
rich adder
ionic juniper
#

i just changed the name and that error occurs

dim bridge
polar acorn
dim bridge
#

one sec im gonna draw what I mean since I suck at words

rich adder
quartz mural
#

index out range one

#

but im not using any loops

#

its an array

rich adder
quartz mural
#

i can deal damage

#

and the opponent/AI does it too

#

when i try to implement type effectiveness

#

then it goes wrogn

teal viper
quartz mural
#

@polar acorn

#

the error on line 147

quartz mural
polar acorn
# quartz mural

Pretty sure we already went over index out of range exceptions. You're trying to get an element from the array that doesn't exist

#

like getting the fifth thing out of a list with four things in it

quartz mural
#

but this time its with an array

polar acorn
#

if the error is on chart[row][col] then either row or col is out of range of the array

polar acorn
#

It's exactly the same principle

quartz mural
#

i see

#

i swr last time the base was null

#

and i had to assign a value to it

#

ok so either row or col is out of range

polar acorn
quartz mural
#

i see

dim bridge
#

I have Serialized Fields Already ik that process

#

I just have done at with Text, GameObject, etc. not directly a bool value or etc

bright rain
#

I'm using RigidBody2D for this capsule character that has a simple jump, left and right. However, hitting walls at an angle makes it tilt or spin. Is there a way to negate this?

rich adder
timber tide
#

do you want to tild in spin at all

buoyant knot
#

bool backwards is loob

bright rain
bright rain
dim bridge
# rich adder take a look

Ok yeah this is serializing a gameobject and dragging it but I need a boolean from the script not the script itself and if theres an option to select a var from a script or smth how am I doing that because that means I would need two inspector windows open with each gameObject

rich adder
teal viper
eternal falconBOT
#

:teacher: Unity Learn β†—

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

rich adder
#

yes you need the c# basics or this will be diffcult

dim bridge
cobalt kestrel
#

I'm following a guide (I'm super new to this) and it's already giving me an error that I don't understand

dim bridge
#

I think im just doing piss poor job of explaining/understanding rn

#

cause like I have serialized other stuff already and did checks and modifications to it

rich adder
#

this is a c# basics not Unity

rich adder
#

You're basically accessing Input class from wrong namespace, well at least the computer is having a hard time telling which one you want to use

cobalt kestrel
teal viper
rich adder
#

sometimes the IDE will try to add in the namespace for you if it doesn't know Input..
ohh you deleted message lol

eternal needle
teal viper
cobalt kestrel
cobalt kestrel
dim bridge
teal viper
dim bridge
dim bridge
teal viper
#

No..

swift crag
#

"member" is just a placeholder

#

foo.bar.baz.buz.whatever.you.want

swift crag
#

a member is something you access with the member access operator!

#

.

teal viper
#

Looking at the code academy course they covered classes,types, and fields, so you should know how to do that.

dim bridge
#

oh so damn ok reference the class name since each script is wrote in a class

#

ok I think I got it now..

teal viper
#

Script is not wrote in a class. A script can contain a class.

#

A script is just a text file that contains your code.

sterile wraith
#

Does anyone have experience implementing steering in a car without wheel colliders.

dim bridge
#

Well this defines a class with the Interface MonoBehavior correct

#

ah wait

#

ok but I need the bool of the object not the class

#

ok uhm

#

lemme looksie here

#

This gameObject is considered an Object code side correct?

#

I understand properties and methods its just the Unity fricking with me

#

sorry I just feel like this could be explained in a timely manner rather than having to like read smth that will end up repeating parts I may be aware of but then again.. maybe not

rich adder
dim bridge
#

... hmm

rich adder
#

its a Class

dim bridge
#

wait

#

so its

#

ah ok

#

its a class inherited from a class

rich adder
#

yes

dim bridge
#

ok

#

forgor about that for a sec

rich adder
#

you cannot inherit multiple classes, thats where interfaces come in handy

supple sand
rich adder
#

yes if class has no inheritence then you do : otherwise you normally add interfaces with ,

supple sand
#

You inherit classes (only one) and implement interfaces (many)

#

All are choices, can be included or not

dim bridge
rich adder
#

public class Human : Mammal, ISleep, IEat, IRun

dim bridge
#

I feel the need to prove I'm not an absolute dum dum and that I have used serialized fields for other things

ionic juniper
dim bridge
#

Ik thats on reason that shows if theres more than one

ionic juniper
quartz mural
#

quick question

#

im not signed in on unity

#

but im making a game

#

if i sign in

#

will i lose the game

#

or will the data just be added to my accoutn

dim bridge
#

@rich adder Do I have to do this? define the class of the other script in my player script to access it? I feel this is wrong when you were talking about easily being able to use a serialized/public field

#

wait ok ok so I think I see now I need to make my own class to hold the boolean then I can reference it in the other script?

rich adder
bleak pasture
#

Hello, sorry to disturb you this is more of a "good practice" question. I have a model from the asset store with crop as submodel of a model. model A is a labeled and textured empty box for it, model B is a lone crop, model C is the labeled box with all the crops. I have the choice of two approach: I. Drag both multiple instance of model B to mirror model C as you fill the box dynamically II. forget about model C and do a physics simulation with mesh colliders and a trigger zone to keep it all in the box and redropt it doing a editor helper to run that simulation in the editor and printing the relative x,y,z pos of all the crops once all of them have stopped moving or after a timeout ?

quartz mural
#

bruh i got aired

rich adder
bleak pasture
#

The scope of my question doesnt include dynamically showing the model/subbed childs of it since I already know about this. It is more of a scene organization/model parenting thing to make code easier / make game more believable

swift crag
#

I would write a script that shows the appropraite number of crops in the box as you fill it up.

bleak pasture
#

But I never done physics in unity before so maybe Im underestimating the difficulty of approach II of running a full simulation to realisticaly fill the box and use the results to produce the final scene

rich adder
bleak pasture
#

Is there a way having no access to the original mesh that I could detect the edges of the crops in the original box model or I have no other choice to place X crops by hand in the scene and compare it to the baked full box model ??

swift crag
# quartz mural will i lose the game

No*

*The Hub used to have a really bad bug where signing into your account in the editor immediately after creating a new project would wind up replacing your project with the original template. This would only happen if you weren't signed in when you made the project and you then signed in before you closed the editor.

#

I believe that has been fixed now

#

And beyond that, no, nothing will happen

dim bridge
#

what I'm missing is the declaration right there

rich adder
#

ofc dont copy this exactly

swift crag
dim bridge
swift crag
#

It's not a bunch of game objects

rich adder
# dim bridge ik lol

ok lol You'd be surprised how many people mindlessly copy and paste example code

swift crag
#

In that case, it won't be easy to identify where each crop belongs, no. It would be easy to pop the asset into Blender and separate the crops back out into individual objects.

dim bridge
rich adder
bleak pasture
# swift crag So asset C is just one mesh renderer, right?

yeah it's all together as a baked unity model. The asset didnt come with the original meshes . The crop just all have a submodel A: empty labeled box B: individual crop C: box filled with all the crops together. Where has if ivisually lettuces have 5 crops in the box I want to fill it dynamically before I display model C as agents/player fill it up. I assume I would want a prefab as well since you could place 8 of these things on a single shelves rack model and they would have all to fill individually. The manager for it would need a model name in the prefab and the number of crops to be full to show model C. Does that sound good ?

dim bridge
bleak pasture
#

Also I tried blender before and I completely broke my teeth on it, I dont think that is doable short term where as I have around 40 crops and pre-positioning them should take like 15 mins per

rich adder
swift crag
swift crag
#

I'd consider having all of the models pre-attached (but deactivated)

dim bridge
swift crag
#

you'd have a list of the objects, and turn them on one at a time as you add crops

dim bridge
bleak pasture
#

I was planning to sub says crop1 crop2 crop3 crop4 crop5 as invidual crop as child of the main GO in the scene as meshrenderer GOs and show their visibility from the bottom up, ie: crop1 to 5 where 5 actually disable all of them and shows model C

dim bridge
bleak pasture
#

but obviously if the individual crops arent placed almost the same as model C that would ruin the player immersion

rich adder
#

components are the scripts on a gameobject

bleak pasture
#

I think I can get away with the skyrim/oblivion modding technique where I make the parent go disappear before I redisplay the whole box 1s later so the player dont notice the positioning isnt exactly the same...

dim bridge
rich adder
dim bridge
#

im gonna record myself doing this setup and you can yell at me when you see what I do wrong. Can we do that lol

bleak pasture
#

thanks for helping me avoid coding a complicated physics simulation πŸ˜„

rich adder
dim bridge
#

ok

dim bridge
#

im making the declaration public which means its a serialized field isnt it

rich adder
#

public field are serialized in the inspector yes

dim bridge
#

AAGGGHH

#

I think I finally got it

rich adder
#

it doesnt need to be public , it can just be [SerializeField] private

#

they both show in the inspector as a field/box

dim bridge
#

I use serialize field as privatizing is good

#

at least usually it seems

rich adder
#

as long as the variable you want to access is Public

red geyser
#

hello! I'm trying to use a prefab to spawn a button at a spawner location, but I believe the button is spawning really small. Is there specific logic needed when you instantiate to copy the size of the button? or is it not playing nice becauase it's a UI object

dim bridge
#

lemme try this now

rich adder
red geyser
#

yes and yes

rich adder
red geyser
#

400x200

rich adder
#

shouldbe able to spawn at that size on Instantiate

dim bridge
red geyser
#

hmm, I do see the button spawn in the Hierarchy on run, I guess I'll have to look harder why it's not spawning right

rich adder
#

press F on keyboard when selected in hirerchy during playmode on spawned object

#

then show inspector n where it is

dim bridge
#

if (Input.GetButtonDown("Jump") && playerJump.canJump) is where im using it

rich adder
#

alr..so what do you expect this is gonna do ?
yourcant jump, is always gonna be false

red geyser
dim bridge
#

yeah but for some reason its letting me jump rn

#

I was using it as a test

rich adder
#

i literally told you why

dim bridge
#

when its false

rich adder
#

ohh

dim bridge
#

goober..

rich adder
#

is the inspector for canJump set to false?

rich adder
#

spawning UI elements outside a canvas will cause them not to be visible

#

pass the canvas as a parameter inside Instantaite

#

Instantiate(myButtonPrefab, canvasTransform)

#

or Instantiate(myButtonPrefab, myPos, Quaternion.identity, canvasTransform)

dim bridge
#

ok it's good

#

thanks for dealing with my dumb butt

rich adder
#

lol sure

dim bridge
#

I just didnt realize I could make a class into a serialized field like that

#

it makes sense now

rich adder
#

most objects can like custom classes or regular MonoB

#

there is the whole list of stuff

red geyser
#

eh? am I dumb

rich adder
red geyser
#

πŸ˜„

rich adder
red geyser
#

figured

rich adder
#

also dont code without a configured IDE

dim bridge
#

unity just handles it so well I didnt think much about the internals

bleak pasture
#

I seem to be missing newtonsoft.json, I just use nuget to add it right or I should get a version specially made for unity ?

dim bridge
rich adder
#

add by name

#

com.unity.nuget.newtonsoft-json

red geyser
#

just realizing my IDE from VSCode isnt in Visual Studio ig

#

but thats a problem for later

rich adder
red geyser
#

correct

dim bridge
#

anyways thanks once again @rich adder bc it prob would've taken me like a whole day of googling just to try to understand that one simple concept

#

I really appreciate it

rich adder
dim bridge
#

and phrasing issues etc

rich adder
#

sure well keep it at it soon you will be doing the same with your own code

dim bridge
#

I'm AI's archenemy...

rich adder
bleak pasture
#

thanks for your help, I have tasks for the next 1-2 week now πŸ™‚

dim bridge
burnt crow
#

Hello folks, I’m making a beginner Meta Quest 3 VR application to place 3D objects in an AR space. The user can choose to place either a cube or a sphere. Where they place the item is determined by where they point a laser from the right controller to wherever they want.

Right now, I have a parent prefab for a cube that encapsulates both the cube, the β€œhighlight” when the cube is selected by a laser, and text over this cube. I want the highlight to show when the laser raycast hits the box collider of the cube element (not the cube parent). Just to clarify, the cube parent structure is like this

cube parent

  • cube
  • highlight
  • textMeshPro Canvas
  • textMeshPro text

How can I do this within Unity? Thanks so much folks

#

text wall I know

red geyser
#

hmm

when I ran as GameObject got similar error

rich adder
dim bridge
dim bridge
rich adder
burnt crow
red geyser
#

yessir

rich adder
#

also the Instatiate parent expect Transform

dim bridge
#

My exact thoughts actually

rich adder
#

any Component has access to their transform property @red geyser

#

you can also just declare it as Transform and skip the .transform

burnt crow
#

this isn’t working though :/

rich adder
burnt crow
#

the ray is finding the cube element, the sibling of the highlight element I want to setactive(true)/setactive(false) depending if the ray hits it

rich adder
#

access it from the cube script

#

imo the most solid way

#

without resorting to string or weird indexes

#

cause you would need to do Transform.GetSiblingIndex

#

actually dont even know how would access a sibiling after that without transform.Find or transform.GetChild(sibilingIndex)

burnt crow
rich adder
#

its a mess , i never do it

rich adder
#

assign in the inspector

#

the cube is on the same object there is no reason you cannot just make a field

burnt crow
#

I thought if I seralizefield-ed it that it would not be specific to each cube yk

rich adder
#

then all prefabs have the same assigned field

burnt crow
#

yeah so you mean instead of like having the cubeparent structure and the highlight in that as a child it’s just a serializefield in the cube?

#

I wouldn’t know how to make sure the cube and the highlight are linked though yk

#

maybe I’ll just change the cube color at this point LOL

rich adder
#

what do you plan on doing with highlight with ray

burnt crow
#

right but how would I link it to one instance

burnt crow
eager spindle
#

I have multiple scripts attached to a gameobject that do the same thing but act on different game objects, is there a way I can "rename" the scripts to differentiate them?

rich adder
rich adder
burnt crow
burnt crow
eager spindle
#

hmmm
the way that I structured my projec right now is that I place all the "manager" scripts on one gameobject πŸ˜…

rich adder
eager spindle
#

i dont like to put my scripts across too many gameobjects because if i accidentally delete something then the references will mess up

rich adder
#

I dont know personally any other way you could 'label' them without a custom editor script

burnt crow
#

I think I’m making progress one second

eager spindle
#

I see, thanks!

burnt crow
#

ok I think I’m on the right track for that issue now @rich adder , much appreciated, but I also have (what should be) easier thing that I’m having trouble with and I was wondering if I could get your take

#

so like in the images I want the highlight to go off when my laser hit right

#

however, the hit detection only happens when my rightcontroller is touching the cube object, not when the laser is touching right

rich adder
#

touching right ?

red geyser
# rich adder any Component has access to their `transform` property <@234833303859888128>

Just wanna come back and say I did get it, I see what you meant by what you were saying, thank you!

I did some more digging on youtube and found this really helpful guide that explained Instantiate at dummy levels that helped me conceptually understand. Thank you again! https://www.youtube.com/watch?v=EwecdOv-40E

This is a Unity quick tip on how to spawn and clone objects with instantiate. Radiobush has no affiliation to Unity but very much enjoys using the Unity engine.

Subscribe please: https://www.youtube.com/channel/UCsEUJT0o4ZWQKpIDkhm6AJA

This tutorial is all about the code lines and how they are used.

β–Ά Play video
red geyser
#

I appreciate you taking the time to explain GWcmeisterPeepoLove

burnt crow
rich adder
eternal falconBOT
burnt crow
#

I’m just gonna try to simplify my code, make it braindead, I’ll let y’all know if I get stuck again

#

thanks so much for the help

nimble linden
#

Hey, With the help of a tutorial I just created a movement script where I can walk, sprint, jump and crouch. But when I crouch I can occasionly double Jump. I believe there is an issue with the raycasting on line 68, and to fix this I have tried changing the players height to half of what it normally is when crouched but the issues still persists? I was wondering if anyone had any insight into how to fix this?

ivory bobcat
eternal falconBOT
rocky canyon
#

GetKey for jump?

nimble linden
nimble linden
rocky canyon
#

i always use GetKeyDown (a single frame)

rich adder
nimble linden
#

Ok

nimble linden
rocky canyon
#

i'd just try it first

nimble linden
#

ok

#

I can still double/tripple jump whilst crouching with GetKeyDown instead

rocky canyon
#

ahh, its a deeper problem then

nimble linden
#

It's ok I just found the issue turns out I was assigning varibles incorrectly and that fixed the issue, thanks for all your help though

#

nevermind I can no loinger jump whilst standing

burnt crow
#

With all my cubes in the Cube layer, I'm doing . . .

// earlier
layerCubeNumber = LayerMask.NameToLayer("Cube");
// a bunch of code later

if (Physics.Raycast(ray, out hit, laserDistance) && hit.transform.gameObject.layer == layerCubeNumber) {
  // highlight the cube hit.collider.gameObject (working)
}
else {
  // do other stuff (working)
}

What doesn't work about this is that the highlight only works if the right controller (where the laser originates) is touching the cube, not the laser touching the cube. Anyone know why this could be? Thanks so much folks

#

I've also tried changing hit.transform.gameObject.layer to hit.collider.gameObject.layer but I get the same result

rich adder
#

why are u doing that anyway

#

you can just filter out only cubes if you put layermask in Rayacast

burnt crow
#

but I want only cubes, not to filter out only cubes yk

rich adder
#

what

burnt crow
# burnt crow

ok so like here, the laser is used to select a cube right? I'm trying to see which cube the laser hits by using the hit from the Raycast

whole idol
#

Why is there no add 2d vector composite option?????????

burnt crow
#

based on which cube the laser hits is the cube that should be "highlighted"

ivory bobcat
burnt crow
rich adder
whole idol
rich adder
#

I understood what you're trying to do a while ago, the problem is how you're explaining what you're doing makes no sense to what the issue is @burnt crow

ivory bobcat
burnt crow
#

how would I do it without the && part

#

I'm still not sure I understand what you're saying

whole idol
rich adder
burnt crow
#

right so in my case it would be if (Physics.Raycast(ray, out hit, laserDistance, cubeLayers)) {

#

the reason I didn't go with that initially was because I thought that would filter OUT the cubeLayers, like that would be the only layer you can't use

whole idol
rich adder
#

which would hit everything BUT cubelayers

#

it has to do with bitmasks and how they work

burnt crow
#

right its a bitmask ofc that makes sense now

burnt crow
rich adder
rich adder
burnt crow
#

I'm not sure I understand how this is happening

rich adder
#

make sure to always draw debugs too with rays / overlaps

burnt crow
#

I'm not sure what you mean by that. My ray is always visible to the user, they always see it as a lineRenderer

ivory bobcat
#

tldr change the action type to something that supports 2d vector (button does not)

burnt crow
#

laserDistance scales based on user controller input (works for drawing it)

rich adder
#

I trust Debug.DrawRay but anyway, are you certain the cubes all have proper layers setup?

#

is just at distance ?

burnt crow
#

hmm, could you explain what you mean?

rich adder
#

then Id make sure all cubes / collider that im hitting has the Cube layer assigned

#

if that is all checked out something is wrong in the highlight logic perhaps

burnt crow
#

wait i have an idea, may have spotted a mistake in logic

burnt crow
rich adder
#

nice!

rocky gale
#

https://hastebin.com/share/irixajofaq.csharp why does this not work im, trying to see what image the player i hvering over but it diesnt work

rich adder
#

what you need to use image for

rocky gale
#

cause when you hover over image i want to show stats

#

ik how to tdo the stat thing

#

i just wanna be able to detect if player is hovering iover image and have it in a variable and chek its tag

rocky gale
rich adder
rocky gale
#

wdym

#

they have a public string that has description

rich adder
#

yeah but how do you know which stat you want to pullup from specific image

rocky gale
#

i get the stat component and then use variable

#

wat

#

wdymn which stat

#

its a script with public string

rich adder
#

sounds like you don't know yourself what you want to do lol

rocky gale
#

i do

rich adder
#

cause what u sent doesn't make much sense

rocky gale
#

i domt knoq what youre asking

rich adder
rocky gale
#

i have image and i want to detect when the player hovers over it and then show stats when mouse is hovering over it

rich adder
#

you explained the script part, I meant your current setup

#

how many images ? each image different stats? how do you handle that

#

etc

rocky gale
#

i have image with stat script and a script in an empty game object (dript we were talkimh about)

rocky gale
rich adder
#

I dont see anything about stats in your script tho UnityChanThink

rocky gale
#

ik cuz i cant even detect image yet

rich adder
#

jutse use IPointerEnter interface

rocky gale
#

ik ow to do the stat part thats not the pronlem

rocky gale
rich adder
rocky gale
#

let me redo it uz i deleted it

rich adder
#

also do you have a canvas with Graphic Raycaster and do you have event system in the hierarchy

rocky gale
#

wait

#

not ipointereter method?

rich adder
#

IPointerEnterHandler is an interface

#

that needs graphic raycaster / event system

rocky gale
#

i trird the method

rich adder
#

huh which method?

rocky gale
#

hold on'

#

oh i did onpointerenter

rich adder
#

OnPointerEnter yes is the method

#

but did you have the interface

rocky gale
#

no

#

im watching tut

rocky gale
#

thx

rich adder
low perch
rocky gale
rich adder
rich adder
rocky gale
#

sir yws sir

rich adder
rocky gale
#

yes

#

its im empty go

rich adder
#

ohhh..

#

this should go on an actual UI element in the canvas lol

rocky gale
#

oh

#

woah it worked man

#

thx

rich adder
#

np! UnityChanThumbsUp

thin hollow
#

how do i make it so a sprite is above a layer than my UI. im trying to change the layer its on but its not working

rich adder
#

also not a code question

thin hollow
#

ya

rich adder
#

try sett canvas to ScreenSpace-Camera then play around with the proper Plane number

thin hollow
#

it works but not its pretty hard to work with lol

thin hollow
#

it looks wierd int eh editor

polar wasp
#

i need more coder friends

small mantle
#

Why is this so fast? moveSpeed is at 1 and it zooms around. Is there a way to make it slower?

void MovePlayer() {

        rb.MovePosition(transform.position + movePosition * moveSpeed);

    }```
polar wasp
polar wasp
#

transform.Translate(); lmao

rocky gale
#

lmao

#

goat

carmine turret
#

Took a mini break from my project now back to it. Can anyone make some suggestions on improving movement if my rigidbody co troller when grounded? Current it cannot go up Inclines and flies over them when going down

#

(gravity is applied)

summer stump
carmine turret
carmine turret