#π»βcode-beginner
1 messages Β· Page 265 of 1
there's not really a "better" here. Do you want to enable all of them or just the Player map
Both work, but what's the best way to write?
Use Random.Range along with Terrain.SampleHeight to get a random point on the terrain and then check how high you should spawn stuff.
https://docs.unity3d.com/ScriptReference/Terrain.SampleHeight.html
If you want to enable them all, use the second one.
If you want to only enable the Player map, use the first
player only
amazing π₯Ή
What's the best video to recommend for FPS on the new control system?
your move / shoot script shouldn't care how you get the inputs, it should only care that it has values
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
only a child would respond with an emoji, wtf would you expect otherwise?
Oh, it's complicated.
but I like emojis π¦
I f..ing hate them. to me it's a sign of an inability to articulate
You're challening lightning through flat rocks to make them thing. Everything's gonna be complicated.
i get emoji spammed everytime i enter one server.
I hate it and despise it so I refrain from them.
I'm trying to bro
I just wonder why people are still sitting on the old system and recording videos about it
ohh but they're fun to look at, since we're in digital space and reading text is a bit emotionless. I get downvoted on reddit for using emojis 
do you have any idea of the bandwidth you are wasting with a stupid image when one or two words would convey the same sentiment?
I will admit I have been infected by the emoji mind virus since basically every other social platform on the internet became unuseable. Helps that I finally bit the bullet and got nitro 
well idk bandwidth is non-issue these days lol maybe 56k days
I got nitro but I am planning on cancelling it because it has no benefits besides more stuff on an app.
I miss my nitro too many good ones!
for you maybe, but not for everyone
fair enough
Can we stop rambling off-topic about development?
Yeah, definitely. Back on topic.
I gotchu
https://streamable.com/w06il9 part1
https://streamable.com/dypf48 part2
maybe visualizing it would help you out..
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.
If you want to also invoke the base class version you would need to do base.UseItem(player, type);
overrides completely replace the behavior of the virtual method
(hopefully I understood the question properly?)
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?
if the variable is overridden in the parent it will use that
so im fine if its only declared
from the parent class
public float cooldownOnUse;
public bool isOnCooldown;
yes
If vectorB is a Vector3 found by multiplying quadC * vectorA, can I get from vectorB to vectorA by multiplying -quadC * vectorB?
ty
why isnt unity accepting this?
b/c random doesnt give u gameobjects 
weapons is an array with 4 items, if i print it it works fine
use system.Random or UnityEngine.Random i think
weapontospawn is a gameobject.. not a number
or that
weapontospawn = weapons[randomstuff]; might make more sense
You're trying to store a number in a variable of type GameObject
oh i realized
i am trying to store an int in a gameobject
π€¦ββοΈ
thats the major issue here
split out if it helps u understand better..
int randomNumber = randomStuff;
weapontospawn = weapons[randomNumber];
tends to help me.
its 2024.. who says a gameobject cant be an int.. π
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
well int is an Object just not a GameObject π
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
true
!ide
If your IDE is not autocompleting code
or underlining errors, please configure it.
Select one:
β’ Visual Studio (Installed via Unity Hub)
β’ Visual Studio (Installed manually)
β’ VS Code
β’ JetBrains Rider
β’ Other/None
configure it
Thank you so much!
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;
}
}
if ur inverted.. then obv is not the same..
everythign else is the same though?
like things flying around? nope, only flat surfaces, but they can be in a 3d world
wdym they are strictly in 3D
no sorry i mean flying wise
oh you cannot make flying ones, but you can certainly Offset your enemy to make it look like its flying
oh havent thought of that.
yes they can, you need to offset the agent base to be on the nav mesh, then flying objects can use pathfinding
what do you mean?
So in context, theres a spaceship, enemy spaceship and some asteroids
you can also bake a navmesh surface for sky itself if you have obstacles there, then disable the renderer for it
i want the spaceship to avoid the asteroids when trying to gun for the player spaceship
Right but the asteroids only spawn on start, would that still be possible to do?
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
bake surface at same level your enemy ship will be then use navmesh obstacle on the rocks but its tricky cause agent wont move itself if obstacle is approaching
so my navmeshsurface would actually be the enemyship?
oh i see
or am i hearing it wrong
no navmesh surface is the plane / height they will be at just used for bake
sorry im still a little confused#
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
yh i was thinking to use raycasts and detection
How do I detect when someone clicks a circle collider
For avoiding sparse obstacles, just steer away from them.
It's unlikely that there will be a huge wall of asteroids that completely blocks movement
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
for asteroids in teh way.. u could do the same.. u could have them exist on the navmesh
the problem is this wont avoid the Asteriods at the same plane as ship unless they will also be offset
but their graphics be in the sky
ya, thats the hacky bit
truth
ah fair enough
A* ftw
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
yh i may just stick with learning raycasts
oh π―
thank you so much anyways i may experiment
if u havent yet, learn raycasts asap
raycasts and trigger volumes are like 60% of gamedesign
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
!collab
We do not accept job or collab posts on discord.
Please use the forums:
β’ Commercial Job Seeking
β’ Commercial Job Offering
β’ Non Commercial Collaboration
You've been on this server a long tome to get banned
Oh, it's gone
Don't ping everyone (it doesn't work) and collab posts aren't accepted
cold
i tend to rotate the graphics myself.. and only use the navmesh to move position
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
How do I detect when someone clicks a circle collider 2d
IPointerClickHandler
Or IPointerDownHandler
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
Needs more context
What calls SpriteTouched
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
when sprite is touched, but everything other works
Try logging audioSrc and audioSrc.clip outside the if
See if anything logs at all
Ah right I see makes sense
So itβs not entirely needed in my scenario
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
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?
You are quite possibly starting the sound every frame in Update
Which will cause it to restart each frame
no? im not
the audio listener is on the camera
try PlayOneShot and see the difference
Seems from your code like you are
You're running it in update
but it basically runs the spritetouched function only when there is input from mobile device, not every frame...
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
and what to put in the ()?
pass the clip.
Or if you want to prevent a possibly looping Play() without one shot Just do
if(audioSource.isPlaying == false ) audioSource.Play()
oh wait, i think i see the problem
im litteraly destroying the object directly after i play the sound

now i gotta think how to solve that
have an Audio Manager which wont destroy
in an empty object?
yeah why not
you can also use https://docs.unity3d.com/ScriptReference/AudioSource.PlayClipAtPoint.html
(iirc it creates a gameObject with the AudioSource just to play the sound without caring about other object)
idk if thats pricey though constantly making a new AudioSource
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
not sure I understand wht you mean there
okay dont worry playclipatpoint solved it
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?
@rich adder good idea mate
haha yea!!
Lookin good
Next is custom Inspectors πͺ
how can i access this height through script?
i hate those ngl lol
lol I have way too much fun with them
thats why my first dependency is NaughtyAttributes! lol
i make everything a custom inspector now
love that [Button()] attrib
haha yeah its convenient , I just hard headed and code everything myself when possible
check out the doc's has all the properties and how to access em
How do I make onmouseenter work with a specific collider?
put it on a script the object, or use Unity's EventTrigger component
usually the script its on, is the collider
you'll also need the event system and the graphic raycaster that usuaslly comes w/ it
the EventTrigger uses it doesn't it
the inspector component
the only way that works on colliders if you have the 3D/2D Physics Raycaster on the camera
EventTrigger component I mean
lol nice
been a while.. i always get all the different methods mixed up
have to re-watch my own video sometimes lol
this is still using raycast thouggh no ?
well the world buttons 1 uses a raycast 1 just uses the OnMouse functions
I meant the World Objects colliders can get EventTrigger events if you put this
without raycast
ahh true, this is how the left world button works
yeah OnMouseDown is different cause it runs from Monobehavior
the collider on it to be precise
mmhmm soooo many different ways to click lmao
yeah I usued to use that non-stop before using raycasts lmao
raycasts make me feel more powerful π
i started learning raycast when I realized it wasnt that precise
like i have more control over the world
yeah that too, especially once you deal with Layers
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
navarone check #π±βmobile
ahh clicker game.. u evil
make a raycast
π
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
nice!
but like I said any showcase should prob be on #1180170818983051344
well technicaly its a mobile channel and my game is related to mobile development
you'll probably get away with it a few times b4 a mod sends u a message π
but its not "mobile help questions"
i posted it there also
crossposts ftw π
loophole
i may be wrong but its not only for questions
well dev-log is a better place anyway.. you can add to it
i did it
instead of ur posts being gapped up
all channels say that but generally are for help questions/topics
Foptciy got a big question coming
(not me saying , mod)
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?
ohh photon π€
you dont have (2) Photon View components on that gameobject?
if u do u should get rid of 1
something you should probably ask Microsoft lmao
the component window thing doesn't even pop up
the inspector doesnt show?
like I can't even add a sprite component or anything
it makes kinda sense to me,
its an array but deuce
ill record
show the inspector of said gameobject
make a custom struct
int[][] does exist but it is also different
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/arrays
this is consistent on EVERY gameobject π₯²
ohh, have u tried a simple restart?
yea
its not even that difficult
public struct XY
{
public int X; public int Y;
}```
im not very familiar with Photon, but ill do a bit of googling to try to help ya real quick
no similar results π
its an Editor/Photon error..
yea
then having a smart IDE this would be a non-issue
so subjective its not even fathomable
so? X n Y are just variable names, you can call them Rows,Column if you want
wdym rows contain columns
chess board is a grid
rows and columns are different
Did you miss this? <#π»βcode-beginner message>
Jagged arrays exist. Also what you are saying really doesnt make sense.
when I dble click the error vscode says
File not found: /Users/bokken/build/output/unity/unity/Editor/Mono/Inspector/AddComponent/AddComponentDataSource.cs
wat i sent is exactly a GRID
yes but rows containing columns is what you said that is not a grid in my mind
that sounds like a jagged array
man this is how microsoft wrote it, just get over it
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
how do i check if a collider is triggered
is it normal visual studio is not showing me the files ?
mark the collider as isTrigger in the inspector
and in the script on the collider use OnTriggerEnter()
unless im confusing what u want to do
yes its normal
cause you should not be touching those
.meta files are important files to keep reference not broken , they are generally ignored in IDE
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]
You can most likely change a setting to show all files, if you so desire.
not the same name..
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
although myself I try to use a suffix of Current or Instance whenever I can't come up with name π
myThang
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
no one is forcing you to use them
"I want a job in c# but hate everything c#" π
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
well better get used to it then lol
atleast with an IDE it'll hold ur hand a bit.
imagine not using conventions back b4 intelligent IDEs
that or just type this.similiarVar = localVar
yup that too..
i dont see the big fuss for _ scripts look ugly af
Unity π΅βπ«
Yeah, it should be m_variable instead 
the only benefit for _ or any other prefix i found is that it speeds up finding all Fields for example in IDE list
like this
Any convention is fine, as long as it's consistent and not too... unique. Keep it simple and all will be fine
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
yea
The only difference would be if this was some serialized class and property I believe
Which is unity specific
If it's supposed to be a constant value, maybe use const instead.
Instead of a property + baking field.
Maybe he wants a runtime const, but for that you'd use a readonly field
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 π
hello confused π
and it works whenever i open it inside the unity editor
but whenever i play a build
the input doesnt work for some reason
and the window is focused?
^ thinkin this too.. not sure about other inputs
unless they mean some other type of input π
yeah
UI clickity click input?
ohhhh.. odd
ohhh key input
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)
I use this sometimes
https://assetstore.unity.com/packages/tools/gui/in-game-debug-console-68068
aye, i use that guys command window
life-changer
neat! thought about building one but if there is an asset im down for that
i like the one inside source sdk
ughhh
this is so frustrating
i thought my build was done....
i even released it on itch π
https://assetstore.unity.com/packages/tools/gui/command-terminal-123344
woops, wrong guy.. but i got confused b/c i use alot of his stuff too.. this is the command window asset
how do i do this btw
was about to say I couldnt find it π₯²
thanks!
tick the box that says development build
im really sorry but i dont understand, can u give me an example please?
What do you want the moveBase of this object to be
i got warned about my own game, nice
A struct or class.
hellz ya, thats how u know you're on top
emmmm the moves stored in learnable moves ig?
yes you need code signing to get rid of this
or self sign just works on your machine
Publisher: Unknown π΄ββ οΈ
dont you also have to pay microsoft to get rid of the unknown app popup
yes for code signing it cost money, not microsoft you do it via code signing company
I literally cannot answer this question for you. You need to decide what you want this variable to hold and then set the variable to that
or just like, upload it to steam. It signs it all for you
ok
macos instructions ?
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!
god i hate code signing so much
i feel like itd be the easiest thing to replace with ai
Live dangerously or no gains!
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
yea you can self-sign to get rid of warning on your machine
doesn't work across machines
seems a bit.. pointless lol
if you could self sign your apps people would self-sign a spyware/virus as a legit app 
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?
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?
gotta make sure i dont run this virus i wrote on myself lol
lol
have u tried shuffling thru teh different types of assets
not really a code question. Also did you refresh the package manager?
jesus christ my game is laggy
does reopening unity count as a refresh? also i didn't know where to ask since this question is not specific
thanks man imma try that
oh thought you meant inside package manager they werent showing
(its my 2nd day using unity lmfao)
no, dont try, do it
also #π»βunity-talk
ty
ohhhh i just forgot to import after downloading bruh
indeed
classic!
had to happen at some point
happens to me at least once every few weeks
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
btw did u guys learn coding while making games or went straight to learning code specificly?
both
im planning on learning code while modifying already existing scripts if that makes sense, good strat?
my first project in unity was modifying the FPS Microgame
decent strat, but gonna need supplemented with Google
and extending ur knowledge about what it is ur modifying
as long as you're not using GPT
haven't actually thought of that yet
is it good ?
yeah i guess its like a cheat code
people mistake it for "thinking" its just pattern matching close enough to your prompts
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
What exactly are you trying to figure out with this check?
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
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;
}
pointsIndex--; ?
Thats what im guessing he wants
not working :/
where did you put it , also you probably want some proper checks for it like if pointsIndex > 0
or use modulo to wrap it
well if it reaches 0 then itll try to do- E he beat me
like its working but one time
again share current code, also check console for errors
well it'll decrement till it reaches 0 then it'll go to -1 which would be an invalid point
{
[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--;
}
}
}
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
yeah def at least put if(pointsIndex)>0
also shouldn't this be
if (pointsIndex == Pattern.Length-1)
yeah this
because if the length is say 3 you have index 0,1,2
@polar acorn bro i finally got it to work, but i got this new problem can u check it out
ok ty ill try
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)
Anyway anyone got a tip on using a 2nd collider as a trigger on a gameObject with a serialized field for the trigger
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
just use an Overlap, ignore player layer
how can i change "EniCode" name ? to a specific name
Change the namespace in the code
doesnt new Collider component have option to already ignore certain layers anyway ?
It's best to have different colliders/triggers on separate objects(with their own rb) and forward the events to your controller.
or yeah just have it on two diff objects ^
serializing a collider how you're doing is not a good way to do it
Is there a way to carry variables between scripts bc all this trigger does is check if the player is allowed to jump
ofc there is, if you couldn't this language would be useless
The trigger shouldn't be checking that.
once i do that this error occurs
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.
though , if you're doing ground check may I suggest using OverLapBox/Circle instead of Triggers
yes.. I'm saying the boolean for that will be the bool I need to determne if the player can jump in the player script
Are you missing a using directive?
If you weren't able to share variables between script this programming language would be useless
i just changed the name and that error occurs
well I've seen serializing and dragging gameObjects etc but how would I be able to drag a variable from one script into the serialized field of another
And what namespace is Ability in
one sec im gonna draw what I mean since I suck at words
the same exact way you said it
take a look
scroll down to Object reference fields
can i show u a problem?
index out range one
but im not using any loops
its an array
Scripts are Types that can be serialized in the inspector.
GameObject for example is a type
Transform is a type
etc..
thanks bro
i can deal damage
and the opponent/AI does it too
when i try to implement type effectiveness
then it goes wrogn
You would do it the same way you do it in C# outside of unity:
objectReference.PublicMember
is the last line in this one
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
but this time its with an array
if the error is on chart[row][col] then either row or col is out of range of the array
It was last time too, List uses arrays internally
It's exactly the same principle
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
Yes but the error before that was an out of range error
i see
ngl dont understand these words rn maybe my mind is a little wonky and not clear with my previous memory of C# rn but I have this if this made my intention any clearer if there was miscommunication
I have Serialized Fields Already ik that process
I just have done at with Text, GameObject, etc. not directly a bool value or etc
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?
lock the rigidbody rotation under constraints
do you want to tild in spin at all
bool backwards is loob
Thank you, I solve it
And no, no spin at all
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
you access it the same way you access anything else in code , with . operator
Then I suggest going through the C# basics. As well as unity !learn beginner programmer pathway. They cover all the stuff you need there.
:teacher: Unity Learn β
Over 750 hours of free live and on-demand learning content for all levels of experience!
yes you need the c# basics or this will be diffcult
oh wait so in the player script am I doing like [scriptvariable].[variablevaluelogic]
I'm following a guide (I'm super new to this) and it's already giving me an error that I don't understand
I have took a C# beginner course on code academy
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
if you did beginner course you should know how to access variables between objects
this is a c# basics not Unity
Get rid of using UnityEngine.Windows
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
I also did the C# basics and struggle with the actual basics like accessing. I think we need practice so we can "remember" the basics. I tried unity a while back
No. We understand what you're trying to do. That's why we're suggesting to go through the basics.
sometimes the IDE will try to add in the namespace for you if it doesn't know Input..
ohh you deleted message lol
those courses are mostly useless because most beginners will just look at it, assume they understand it and move on. you need to also create your own codes where you test around with how this stuff works. you can even do it on an online compiler https://dotnetfiddle.net/
I don't know what they have in code academy. It would be weird if they didn't teach you how to access other object's members.
I was gonna resend it lol I worded it wrong and forgot to tag you
if you want, maybe we can practice together as we learn
I mean I understand like an object is a copy of a class and it has properties that can be modified on it ik that I'm just like.. brain rotting because these are two completely seperate scripts so am I like getting the component on my gameobject in my code then getting the scripts variable like uhm GetComponent("Player").[smth here]?
You can reference the component however you want(serialized field being the preferable way). Then you just access the member you want to access with reference.member
thats backwards id do get component for the triggers go if this works
wait so am I referencning the entire gameObject that has the trigger in it then doing ref.member.[script].[variable]?
No..
You reference the object of the type(class) that you have your member in.
Looking at the code academy course they covered classes,types, and fields, so you should know how to do that.
oh so damn ok reference the class name since each script is wrote in a class
ok I think I got it now..
Script is not wrote in a class. A script can contain a class.
A script is just a text file that contains your code.
Does anyone have experience implementing steering in a car without wheel colliders.
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
MonoBehaviour is not an interface
... hmm
its a Class
yes
you cannot inherit multiple classes, thats where interfaces come in handy
This one is a class implementing an interface
yes if class has no inheritence then you do : otherwise you normally add interfaces with ,
You inherit classes (only one) and implement interfaces (many)
All are choices, can be included or not
yeah I was thinking very flat minded going hey an interface goes here then remebered class inheritance
public class Human : Mammal, ISleep, IEat, IRun
you forgot IDie Womp Womp
I feel the need to prove I'm not an absolute dum dum and that I have used serialized fields for other things
Ignore that this is messy and should probably be separate scripts
https://learn.unity.com/tutorial/classes-5#5c8a695cedbc2a067d475193 welp that didnt explain it.. just what I knew
Does your serialized field have the gameObject in it?
Ik thats on reason that shows if theres more than one
it's null , but where can i get it from?
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
@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?
You have to always declare something you want to use
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 ?
bruh i got aired
you already have the boolean in a class, no need to make an additional class
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
keeping a bunch of objects in a box with physics sounds like it'd just be a headache
I would write a script that shows the appropraite number of crops in the box as you fill it up.
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
like this
public class A : MonoBehaviour
{
public bool MyBool;
}
public class B : MonoBehaviour
{
public A a; //We declare A before we access/use it, we just need to make sure its assigned. IN Unity the inspector is one of them ways to do
public void Method()
{
bool theValueInA = a.MyBool;
}
}```
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 ??
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
ok
I will test that
thx
what I'm missing is the declaration right there
So asset C is just one mesh renderer, right?
ik lol
It's not a bunch of game objects
ok lol You'd be surprised how many people mindlessly copy and paste example code
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.
but wait this code is referencing the class not the object isn't it so whatever the value of the thing in the class is... It wouldnt change then would it... ugh hehfhsfeie brain
you just drag the class inside , that is the object as far as the computer knows.
GameObjects are unity concept, but aside from that anything in c# in an Object, including a class
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 ?
but how is that gonna work if I have multiple objects
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
you drag the specific object you want?
well, you'd pretty much just select the object, go into edit mode, and hit P to separate by loose parts
but that sounds reasonable enough. You'd just need to make a nice way to define where the individual crop models are positioned
I'd consider having all of the models pre-attached (but deactivated)
wait so I drag the gameObject in the game editor and it uses that to determine which script to grab the object data from?
you'd have a list of the objects, and turn them on one at a time as you add crops
wait no thats serializing an unused field
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
grah be smarter mE
but obviously if the individual crops arent placed almost the same as model C that would ruin the player immersion
if you drag the whole object it will grab the first one, otherwise you normally just drag the component itself inside
components are the scripts on a gameobject
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...
each script is on a seperate gameObject tho
and?
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
thanks for helping me avoid coding a complicated physics simulation π
how about I show you a quick gif so we can probably just make it very obvious
ok
oh wait
im making the declaration public which means its a serialized field isnt it
public field are serialized in the inspector yes
it doesnt need to be public , it can just be [SerializeField] private
they both show in the inspector as a field/box
yeah
I use serialize field as privatizing is good
at least usually it seems
as long as the variable you want to access is Public
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
ok
lemme try this now
is UI button? are you spawning it inside/child of a canvas ?
how big is BtnOne originally
400x200
shouldbe able to spawn at that size on Instantiate
ok so I have the setup for this and it didn't return an error but when set to false it acted like it was true
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
not even sure what that means
show me where it spawns
press F on keyboard when selected in hirerchy during playmode on spawned object
then show inspector n where it is
Ill send the editor pic and the files
if (Input.GetButtonDown("Jump") && playerJump.canJump) is where im using it
alr..so what do you expect this is gonna do ?
yourcant jump, is always gonna be false
F isn't doing anything, but::
it may actually just not be spawning in the canvas lol
"for some reason"
i literally told you why
ohh
goober..
is the inspector for canJump set to false?
yes thats a problem
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)
bruh I forgot about that
ok it's good
thanks for dealing with my dumb butt
lol sure
I just didnt realize I could make a class into a serialized field like that
it makes sense now
most objects can like custom classes or regular MonoB
there is the whole list of stuff
eh? am I dumb
dont blindly copy
π
you need to define what canvasTransform is
figured
also dont code without a configured IDE
Yeah guess I should have taken into account that those gameObjects are all from classes until that are instantiated..
unity just handles it so well I didnt think much about the internals
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 ?
Haha I would've gave up by now
get the one from unity
add by name
com.unity.nuget.newtonsoft-json
just realizing my IDE from VSCode isnt in Visual Studio ig
but thats a problem for later
they're two different code editors
make sure to have it configured with underlinging and all
correct
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
well nothing wrong with googling π
People are more helpful bc they can point out my issues..
and phrasing issues etc
sure well keep it at it soon you will be doing the same with your own code
I'm AI's archenemy...
Google is just past people being stuck in the same problem as you π
thanks for your help, I have tasks for the next 1-2 week now π
They know how to speak though and aren't literally autistic.. well maybe depends lol
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
ehh no reason to get down on yourself is only counter-intuitive
To clarify I'm not sure if I'm actually autistic but I heard it from a close family member and I'd believe it
I like to poke at myself
please config your ide first
doesnβt matter, your brain is your brain yk
yessir
Yeah
also the Instatiate parent expect Transform
My exact thoughts actually
any Component has access to their transform property @red geyser
you can also just declare it as Transform and skip the .transform
right now Iβm trying to do the highlight by getting the parent of the cube the raycast hits and then going down a level again to get the child highlight
this isnβt working though :/
which one has the collider/ which one is ray finding
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
put a script on the cube that references the highlight script / object
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)
This is what I think I do now, on cube parent initialization it gets child index 1 or 2 or whatever and thatβs the highlight
its a mess , i never do it
man using indexes is brittle af just create the field for it
assign in the inspector
the cube is on the same object there is no reason you cannot just make a field
hmm I have a field that I assign using the index
I thought if I seralizefield-ed it that it would not be specific to each cube yk
if you need multiple, you make a prefab with the highlight already assigned
then all prefabs have the same assigned field
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
you drag and drop highlight inside the cube script field
what do you plan on doing with highlight with ray
right but how would I link it to one instance
let me draw a picture one second
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?
put them on different gameObjects ?
yes and is Highlight a script or wat?
yeah itβs a method in a script attached to the cube parent
hmmm
the way that I structured my projec right now is that I place all the "manager" scripts on one gameobject π
ok so Reference that script then link it inside the inspector
i dont like to put my scripts across too many gameobjects because if i accidentally delete something then the references will mess up
You might be able to do a custom inspector with color labels or maybe custom label but prob more trouble than worth, just put it on a child of this manager object
I dont know personally any other way you could 'label' them without a custom editor script
right right
I think Iβm making progress one second
I see, thanks!
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
touching right ?
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.
awesome! np. π
I appreciate you taking the time to explain 
I have a box collider over the cube and when the rightcontroller touches the cube, itβs the cube itself selected. I just canβt move the controller away while the laser stays
show current !code cause I'm a little confused still.
Also make a vid if possible
π Large Code Blocks
Use links to services like:
https://gdl.space/, https://paste.ofcode.org/, https://hatebin.com/, https://paste.myst.rs/, https://hastebin.com/
π Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
hmm I think itβs kinda working now?? but it works poorly LOL
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
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?
Some users aren't able to see embedded text files on discord. Consider using one of the two !code sharing solutions below.
π Large Code Blocks
Use links to services like:
https://gdl.space/, https://paste.ofcode.org/, https://hatebin.com/, https://paste.myst.rs/, https://hastebin.com/
π Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
GetKey for jump?
Thank you, here is an updated version using hastebin
What do you mean?
i always use GetKeyDown (a single frame)
you have to send the link to the page
Ok
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
Ok I will change that thanks for the advice!
i'd just try it first
ahh, its a deeper problem then
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
actually I got my other problem working . . . would you be willing to take me up on this?
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
why are u doing that anyway
you can just filter out only cubes if you put layermask in Rayacast
but I want only cubes, not to filter out only cubes yk
what
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
Why is there no add 2d vector composite option?????????
based on which cube the laser hits is the cube that should be "highlighted"
Maybe it's got to do with the action type being a button?
this means I only care if the laser hits a cube, an object in the cube layer
so how do you not understand that you can already do that without the && layer == part?
how do i change the action type then?
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
It's in the action property on the right
well 1. rude and 2. thanks for the advice LOL
how would I do it without the && part
I'm still not sure I understand what you're saying
Im following this tutorial, and he's got the button property on
[SerializeField] private LayerMask cubeLayers;//assign cube layer in inspector
void Update()
{
if(Physics.Raycast(etc. , etc. , cubeLayers)){
}
}```
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
which one option of this list would match my options?
no that would be doing ~cubeLayers
which would hit everything BUT cubelayers
it has to do with bitmasks and how they work
right its a bitmask ofc that makes sense now
https://unity.huh.how/bitmasks#bitmasks-and-layermasks
this page explains it quite well
right so in Awake() I have _layerMaskCube = LayerMask.GetMask("Cube"); and then later on if (Physics.Raycast(ray, out hit, laserDistance, _layerMaskCube))
switch the action type, it will work
I mean sure it works but assigning it in the inspector without need for awake makes more sense to me personally
ok so I did this and my code looks better lol, but it's still the same result. It doesn't let me select/highlight from a distance still
I'm not sure I understand how this is happening
show ray origin point and all that
make sure to always draw debugs too with rays / overlaps
I'm not sure what you mean by that. My ray is always visible to the user, they always see it as a lineRenderer
Might be related to why the tutorial shows stuff you aren't seeing https://forum.unity.com/threads/no-option-of-2d-vector-composite-in-input-system-1-0-0.888607/
tldr change the action type to something that supports 2d vector (button does not)
my endpoints for my laser are always rayOrigin.position (the rightcontroller position) and rayOrigin.position + rayOrigin.forward * laserDistance
laserDistance scales based on user controller input (works for drawing it)
I trust Debug.DrawRay but anyway, are you certain the cubes all have proper layers setup?
is just at distance ?
hmm, could you explain what you mean?
first id draw the ray direction to make sure direction is correct using DrawRay not LineRenderer
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
wait i have an idea, may have spotted a mistake in logic
I fixed it, the problem was I had the wrong direction when initializing ray, thanks so much!
nice!
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
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
doesnt make much sense to me
what you need to use image for
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
where is the stats located
its in a script thats in the image
how do you distinguish different stats type then
yeah but how do you know which stat you want to pullup from specific image
i get the stat component and then use variable
wat
wdymn which stat
its a script with public string
sounds like you don't know yourself what you want to do lol
i do
cause what u sent doesn't make much sense
i domt knoq what youre asking
current script aside..
show more of your setup, and what ur trying to accomplish.
i have image and i want to detect when the player hovers over it and then show stats when mouse is hovering over it
you explained the script part, I meant your current setup
how many images ? each image different stats? how do you handle that
etc
i have image with stat script and a script in an empty game object (dript we were talkimh about)
the stats are serializec in script so i assign in inspector
I dont see anything about stats in your script tho 
ik cuz i cant even detect image yet
jutse use IPointerEnter interface
ik ow to do the stat part thats not the pronlem
didnt work when i tried
show what you tried, you probably did it wrong
let me redo it uz i deleted it
also do you have a canvas with Graphic Raycaster and do you have event system in the hierarchy
yws
wait
not ipointereter method?
i trird the method
huh which method?
thx
help me there if possible, thanks
public void OnPointerEnter(PointerEventData eventData)
{
print(eventData.pointerCurrentRaycast.gameObject.name);
}
why doesnt this qork tho
i use NGO
do you have the interface
sir yws sir
could you send whole script with link also screenshot which object has this script ?
yes
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
its im empty go
np! 
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
you mean you want Sprite to go above UI Image
also not a code question
ya
try sett canvas to ScreenSpace-Camera then play around with the proper Plane number
it works but not its pretty hard to work with lol
wdym
it looks wierd int eh editor
i need more coder friends
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);
}```
add * Time.deltaTime to the end
moveposition bad π
transform.Translate(); lmao
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)
can we see code
Raycast in front of you to see if the ground drops
Check the normal of the ground to see if it is a slope
I'm not entirely sure how raycasting Infront would help, wouldn't that always return false unless there's a wall?
Angled down
Of course but the movement is simply a velocity movement with horizontal input currently