#💻┃code-beginner
1 messages · Page 553 of 1
If using transform.position to move, make sure to use Lerp, MoveTowards, or a coroutine to interpolate its movement . . .
Though, you'll still have a problem with collision. You'll need to handle that manually using raycasts and physics checks methods . . .
place it like this [ Lerp.transform.positsion ]
No, don't just guess. Look up the methods and tutorials on how to use them . . .
ok
Anyone I don't know what to do ?
Once you confirmed that the package is installed, you proceed with the next step
Select the Help > Check for Updates menu.
If an update is available, the Visual Studio Installer shows a new version. Select Update.
Can't add script component 'TRIGGER script' because the script class cannot be found. Make sure that there are no compile errors and that the file name and class name match.
does anybody know how to fix this?
it is actually clear
You have compiler errors, please share those
did you do what the message tells you to do
Check your console
in c#?
i started today so im very new
No, In the Unity editor console
it doesnt say anything
The issue is somewhat clear already, your editor is probably not configured. However, you should share the exception to confirm
Show a screenshot of your console.
Alternatively it just didn't compile, which is the same problem
i did now
also try not to include the nvidia overlay in your screenshots
If the console is empty, then it's probably, like the error said, that your filename and class name do not match
Given the name of this script file seems to have a space in it, then it's pretty clear the filename and class name do not match
So you need to fix that
there is no space now and it still doesnt work
what is the class name?
public class <?????>
for example
in a file called Goldfish.cs, you would name your class public class Goldfish
the tutorial i followed didnt do that and it was working for him
oh
it doesn't work if you don't do that
Unity generally handles the names for you, but if you decide to add a space initially it's going to mess up
Again read your error message - which is very clear about the script name and class name needing to match
i mean seeing as it STILL has a space in it, it's definitely the problem
because class names cannot have spaces
It's already up to date and nothing happen
for some reason unity think that [ target.position ] didn't exist and i can put that in. why is this happen?
how do i change it?
how do you change a filename?
well how do i just fix it
click on it once to select it, then click it again and wait. You can rename it
You have done all the steps then. Try double clicking your script from the editor and it should open it in Visual Studio
Or right click and rename it
Refer back to my example #💻┃code-beginner message
it worked tysm
yall gonna be hearing alot from me bc im THIS stupid
thanks alot!
quick tip , if you want ot rename a script inside unity go into visual studio (if you are using it) and rename the classname from the context menu, it will also rename your unity script
can i use pyton for scripting beacause i feel like it would be easier
oh
Hey so I am a total beginner, I know how to use unity itself but for the coding part I have 0 knowledge. I am more interested in making 3D games than 2D. How can I make myself get better at coding? I tried watching some tutorials which didn't help at all any advice?
then imma learn c#
I recommend going through this stuff https://dotnet.microsoft.com/en-us/learn/csharp
let us make a deal, unity implements python and unreal engine implements c# 😉
Thank you but I'm still confused I don't see anything to guide me anyway I finally solved the problem
It should point out the issue. If it still doesn't work you should download VS manually instead
I strongly suggest you configure it properly. It's a pain in the ass to work without it
It might be just me but judging this screenshot above is it install for you ?
no
Okay I have to doanload it manually then ?
no, you just have to follow the configuration steps exactly
I did it and it doesn't work
then you did it wrong, it's worked for 1000's of other people
I suggest you just install VS manually since it's less tedious
So I download the recent update manually ?
I have this code running in update, however only the first weapon that gets added to the list equippedWeapons is activating its Fire function. I have tested that multiple weapons are in the list, it's just that only the first to be added is calling the fire function. Weapons are added through the second function.
//running in update, firing logic happens in the WeaponBase
foreach (WeaponBase weapon in equippedWeapons)
{
weapon.Fire();
}
public void EquipWeapon(WeaponBase newWeapon)
{
if (!equippedWeapons.Contains(newWeapon))
{
upgradePool.weaponPool.Remove(newWeapon);
equippedWeapons.Add(newWeapon);
Debug.Log($"Weapon {newWeapon.weaponName} equipped.");
newWeapon.player = gameObject;
}
}
This code is in the WeaponBase class
public void Fire()
{
if (Time.time >= timeSinceLastShot + 1f / fireRate)
{
timeSinceLastShot = Time.time;
PerformFire();
}
}
protected abstract void PerformFire();
Has the velocity changed to linear velocity?
yeah use linearVelocity now
Gotchu, so instead of velocity.x itd be linearVelocityX
Add Debug.Log lines to check:
- how many elements are in the list
- Every iteration of the loop
pretty sure both work
is it necessary to add Time.deltaTime in this code line [ transform.position -= (Vector3.MoveTowards(a, b, moveSpeed)); ]
yes
the third parameter should be moveSPeed * Time.deltaTime, yes
beacuse if i add deltaTime the collision doesn't set in
assuming this code is running in Update
This code is completely wrong if you want collision
you should not be moving via transform.position at all
and it has nothing to do with deltaTime or not
You need to move via the Rigidbody if you want collisions to work
yeah but like if my frame rate was high then the object would move faster without delta time right?
true
btw i run [ transform.position -= (Vector3.MoveTowards(a, b, moveSpeed)); ] in fixedUpdate
not good
Hey guys, I need help with this error. I got Photon Quantum working, but Photon Voice 2 isn't being imported and this keeps popping up
FixedUpdate avoids the framerate issue so no, but it should still use deltaTime because speeds should be expressed in distance per second not distance per frame
Anyway you should NOT be moving via the Transform regardless
2 elements are in the list and both are being called in the update
as mentioned several times.
Then it's working fine
what makes you think it's not working
Did you make timeSinceLastShot static or something?
yes
put logs inside Fire in and out of that if statement
well then it's pretty clear what's going wrong
all your weapons are sharing the same cooldown now
for some reason, my jump animation isnt initating or doing anything actually, does anyone know how to resolve this issue? I genuinely cannot see my mistake
is ther any method to keep collision on object while also not making it update everyframe that make object go so fast
hello?
how about i use transform.Translate
For like the 5th time, no, Do not move the object via the Transform
Move it via the Rigidbody
how is the transition configured between any state and Player_Jump?
oh
i see
if i use Rigidbody then disable gravity then i will keep collison on on my spike
start by opening your console window
and then never close it again
you should always have it open
Then, like it says, fix all your compile errors
yeah i did that on accident
Assets\scripts\triggerscript.cs(8,26): error CS1002: ; expected
Assets\scripts\triggerscript.cs(9,6): error CS1513: } expected
what are these type of errors?
hoe do i fix them?
By opening the scripts they are pointing to
and looking at the line they are referring to
and fixing the code
You wrote invalid C# code.
In this case in triggerscript.cs on lines 8 and 9
The first one says " ; expected" which means you forgot a semicolon
The second one says } expected which means you forgot a } but it couold also mean you just generally wrote things improperly and it's confused.
wrong transition
THe one I asked about is between Any State and Player_Jump
oh sorry, I missread
i have good and bad news
the code was rewritten for me
but there is now a extra error
Should not be capturing when there is a hotcontrol
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
like they changed my code
unity i think
Unity doesn't change or rewrite code for you.
maybe this hobby is not for me
this shit is making me soo confused
like tf is this
That is very confusing indeed
Hii everyone
The pins of this channel have C# beginner courses if you wanna actually learn
can i use kinematic character controller to help make a dragon/bird controller
Do you mean KCC from the asset store ?
yea
or is it for humanoid characters only
what could i use instead of private
bc thats my last error
@wintry quarry could u help me?
Well you could make it work for a flying character as well, it’s kinematic it just goes where you tell it to.
ok
i do it like this:
targetTransform.localRotation = Quaternion.Euler(targetTransform.localEulerAngles.x, rotationReference.localEulerAngles.x, targetTransform.localEulerAngles.z);
You don't unlock the mysteries of coding and game dev in a day. It's an adventure: a journey of perils, with trials and tribulations waged upon your character. It's not an afternoon stroll through the park . . .
Just take it one step at a time: one tutorial/article. Redo it again. Make sure you understand every line of code before continuing. Most of all, discipline over motivation . . .
Hello , Im trying to learn about gpu instancing. Im following some simple yt tutorial, but it doesnt work. I tried to google the error but idk what to do with it. Can someone give me an advice?
here is the code for it
3 nested for in an update is crazy...
your runtime complexity is like non exsistant xD
But eh, im new myself when it comes to unity, sorry, maybe ask chat gpt
it seems very reasonable given that you have three dimensions to work with...
I hardly understand anything from it, i just followed simple unity tutorial 😄
These things can be a bit fussy
DrawMeshInstanced is obsolete, according to the docs
you want to use RenderMeshInstanced
@swift crag something like this ? Graphics.RenderMeshInstanced<Mesh, 0, material, metrices>; it gives me erors
well, definitely not with that syntax...
Try the examples on this page https://docs.unity3d.com/6000.0/Documentation/ScriptReference/Graphics.RenderMeshInstanced.html
@swift crag It worked. Thank you. Do u know maybe some good tutorial on gpu instancing ?
hm, not really -- https://catlikecoding.com/unity/tutorials/ has a ton of useful information about shaders and rendering, but I don't see an entire tutorial on instanced rendering
@swift crag ok , thanks 😉
local
Euler angles are tricky.. You could try something like targetTransform.forward/up/right = rotationReference.forward/up/right depending on how those things are oriented
Edit: Made the variable names match your example
There are better ways to do this but brain fog is real right now
yeah, I try to avoid directly working with Euler angles when I can help it
You could also try additively rotating the hand around an axis with RotateAround, assuming that the character is animated every frame
there's public and protected too for example
what is the actual problem?
im trying to make this script reusable for other objects too. is there any other solution?
well, presumably, you'd assign different references each time...
tho rn im trying to set this one x axis
You could specify the axis in the inspector
the up/right/forward is broken for me
its like rotating other axis
yeah a good reusable script would be to define in the inspector which axis it should be rotating around
i want to do that and i almost did but rn im trying to figure out how to rotate
the axis is locked on 180 because quartenion
this is part of why you shouldn't be fussing with euler angles
they produce interesting behaviors
im just trying to rotate by x axis tho 😭
like theres no way its that hard 😭
Instant Unity Tips is back!
Let's kick this off with a simple but versatile C# script to rotate any object.
Car model by Kenney (Free - CC0) https://kenney.nl/assets/car-kit
Transcript:
Let's make an object rotate infinitely on any axis you want and at any speed you want. First, let's go add a component. Let's name it Rotate and open it up i...
2 minute video
wont work for me. im trying to make an object rotate using my VR tracked hand
how does that work?
Show the orientation of your hand object
Select it with gizmos in local and show us
The orientation is slightly weird, I usually expect bones to have the Y or Z as forward, not X
Not sure if that matters here tho
it doesnt
i've seen some WEIRD bone rolls and orientations
Z would be preferred since euler angles are applied in the order Z > X > Y so the Z wouldn't interfere with the other axes
im so tiredddddd with thissssss 😭
so what do i do
What else is rotating the hand? Does it have an animator running?
theres an armature
but i think it doesnt really matter since the problem is that the rotation is limited?
hello ! i 'm trying to make a 2d game on unity but i have a problem, i want an enemy to follow the player when he attacks for the first time, the player has a sword and a variable called "HasAttacked" in the sword script and i call it to the enemy script by typing "public Sword sword;" and if (sword.HasAttacked) {
isFollowing = true;
It works but when i put my enemy in the prefab folder the script of the sword (and the player) disappear and i can't put them back in. Picture of the prefab enemy here:
does someone know what to do ?
Just thinking about this #💻┃code-beginner message
exact same settings, but only one key glows. Am I doing something wrong
nah i tried it does it constantly
The enemy having a direct reference to the player's sword is... crazy, and unnecessary
what should i do then ?
like it rotates constantly
Or have the enemy spawner pass it to the enemy
Try targetTransform.forward = rotationReference.forward
how can i do that ?
Depends on how your game works
But I'm thinking something like in a Raycast or a collision callback
basically it's a 2d game but it's really to learn, it looks like that for now
i just need the big foots to be notified when the player attacks for the first time
yeah
Sounds like a perfect opportunity to use an event
@wintry quarry @verbal dome can one of u help me with this after ur done with @mortal cedar
k but it didnt really change anythin
okay i'll try
Doesn't seem like a coding issue
alr ill post it there
Does anyone know why I can't add my script to anything
nvm im so done
Now it's facing the correct way in the Z axis but it doesn't know which way to face the X axis
WHY IS IT SO HARD its supposed to be easier 😭

Yeah I'm not going to help someone who's constantly on the brink of giving up
im not
im just tired and brain fog is coming
as well as my wifi is DYING
make sure your scriptname and classname match, you might have renamed one of them, also make sure you don´t have any errors in the console, if so fix them first
anyone know how to fix these
Yes, remove the Version Control package from your project if you are not using it
Pretty sure you were told that already
What way is it best to achieve the following. I have an ability system where player clicks an ability then a target. The selected character shoots a projectile or a spell from character toward the target. The game is turn based and enemies are static (3D). Should I still spawn gameobjects and projectile them and check for colliders, or should I use particle system? You can't miss if you click incorrectly. I need a projectile travel effect and one effect when it hits the enemy. Particles can't detect collision so I should use some kind of duration timer calculated by range? It seems more complicated than spawning gameobjects. It's basically like Baldurs Gate 3 when using a spell or ability.
IMO depending on particle collisions for anything that affects the gameplay feels wrong
yeah
Right, so using gameobjects the only way to detect when I should initiate the explosion effect is to check the collider hit?
You could do a ray/spherecast also
You can't miss if you click incorrectly.
Clarify this part a bit?
Is it like arcadey in the sense that it's not about aiming
It's not an aiming system, you click a target or you don't, if you don't click the enemy collider you can't shoot anything, IE the ground
More about stats/dice rolls
So you don't need accurate collisions here?
Kinda like in final fantasy where you use a little hand to select the target
No I just need to make sure the projectile whe it travels has an effect, like a fireball and when it arrives on the target it needs to explode
And you determine if it hits or not, right when you shoot?
Yeah
I should use some kind of duration timer calculated by range?
I think you are on the right track here
You could use colliders and physics for this, I just think calculating it yourself is more reliable/aligns better visually
Is it turn based?
How do I make the projectile arc when traveling with particles? Can I arc a raycast and make it follow it?
You could make an arc of multiple raycasts, but what is the point of the raycast then
chat question about instance ID, is it ideal to use it for find and search or should i make a different ID. Example searching through an Inventory System for a dictionary that uses it as the key?
You could just calculate like a parabola and move the particles along that path
Ah yeah I know the pos of the character and the enemy, so I can just move the particle along the arc
Instance ID's don't persist between sessions, so if that's an issue then no you can't use those
oh wow they are different every session, ok thats good to know. What if its on a Scriptable object ?
like i have an ItemDataSO that has the id
public int ID => GetInstanceID();
Also unusuable.
Doesn't matter what the Object is, it will be problematic if you try to have persistence
The ID changes between sessions of the player runtime and Editor. As such, the ID is not reliable for performing actions that could span between sessions, for example, loading an object state from a file.
https://docs.unity3d.com/6000.0/Documentation/ScriptReference/Object.GetInstanceID.html
If you want to be able to identify an asset, consider copying its asset-database GUID into a field on the object!
I use this all over the place in my game
I should probably do that too instead of having a component with an ID on everything
I also use GUIDs on a few non-assets
like specific components in my entity prefabs
in that case, I just generate one
System.Guid, right?
Right
I want to rename the fields in my guid class
that's going to cause so many goddamn changes
How does this work if you have a diablo like loot system where things are randomized?
I do have an "UniqueID" class that contains a hash
The hash is generated from a Guid
Should probably use long instead of int tho..
An ID is necessary if you want to refer to a shared "thing"
Randomly generated loot will still probably point at a template
(and the modifiers might also point at templates of their own!)
There is a scriptable object as the base, but it has ranges, how would you store the ranges it spawned?
but the actual modifier data would be part of the item itself
[Serializable]
public class Item {
public ItemSpec specification;
public List<Modifier> modifiers;
}
extremely rough example
This is always scary
Seems like you need to store the entire thing no?
it's not scary; i'm going to reserialize all of my assets afterwards
unity will update every single damn guid properly
it's just going to be one hell of a commit
ItemSpec would serialize as a GUID to look up later
Modifier might also contain some GUIDs (e.g. a modifier that adds a stat bonus would need to identify which stat it affects)
and stats themselves can be assets!
no need for them to be an enum that you're terrified of rearranging
I am thinking composable, SwordSO, FireModSO, ColdModSO ?
I would not have a separate class for every kind of elemental effect -- that's too granular
I'd have ElementSO (defines a kind of element) and an ElementModSO (defines a modifier that adds an element to a weapon)
actually
nah, scratch the latter
there would be a plain old class called ElementalModifier that stores:
- the strength of the modifier
- a reference to an
ElementSO
(this is great for preventing random version control churn -- I just get it over with all at once!)
are you making a Buff Debuff SO for your Sword?
Probably, I am just speculating at this point
I do want the weapons to affect the characters attributes
i am doing something similar but i am using a ModifierSO, its like a Single modifierSO with a list of StatModifier serializable struct object
Also on particles, if I create an arrow particle that I want to stick to an enemys head permanently once it hits, is there any downside to have it linger for infinite duration?
You mean an actual particle from particle system? Not sure how you'd make it stick
With a gameobject it's very doable tho
The downside being the rendering cost of the stuck arrows (probably negligible)
Unless you let your character pincushion its enemy with 1000 arrows
Might wanna add a limit
I saw a vfx video where they shot a projectile at a wall and it stuck on it for like 3 secs after hitting
The wall doesn't move!
that's the hard part 😉
I've been fussing with kind of thing for VRChat
You could certainly spawn an object to replace the particle, then parent it to the appropriate bone
Oh you cant have the particle as a child of the object or something?
No, you can't do anything like that for individual particles
I see
You could attach a particle system to the enemy's head bone and play a particle in the same spot
but that sounds a bit silly
Yeah might as well just use a GO at that point
Well, meshrenderer+meshfilter to be more specific

If you need to stick a LOT of arrows to a lot of different things, you might look into more advanced rendering techniques
you could store a list of transforms and Matrix4x4s -- one four each arrow
then you could compute the correct matrix for each arrow every frame and then render them all at once
but that's quite a leap
Anyone got any idea why this doesn't work? Basically I want 1 of the first 2 conditions to be met and the third one. Every single one works on their own, but not when bundled like this.
what is velocity?
consider logging the relevant values to find out if they're all true at the same time
It's calculating mouse velocity
They are, I tried, unless clicking disables mouse movement calculations???
maybe clicking is causing a tiny mouse movement (I have no idea how much "1" is here)
It wouldn't matter, basically it's like calculating if a flick or fast mouse movement happens
I had it be without clicking and it worked
But clicking on it's own also worked
Log all of the values together to check
Debug.Log($"Velocity: {velocity} /// Mouse: {Input.GetMouseButtonDown(0)}");
string interpolation, yum
Doesn't print just work?
Yes, they do the same thing!
You are correct, but Debug.Log works inside of any class. Print is only available when the script derives from MonoBehaviour. That's why you'll see most people use Log instead . . .
Interesting
i also don't like how print is lowercased
For some reason I'm getting mouse true only when spamming and not holding
Yes
It makes sense
GetMouseButtonDown returns true for one frame
Me neither, lol . . .
why the fuck would it do that
that is very stupid
because that's...what the function is supposed to do
Because it only captures during the frame it was down . . .
https://docs.unity3d.com/ScriptReference/Input.GetMouseButton.html
perhaps you want this
Oh yeah this is better thanks
But also I think it's just weird behaviour of the function.
The point is to detect that you just clicked the mouse
so that you don't, for example, fire a gun every single frame
makes sense, but the labeling is a bit confusing
How many of these should I have checked in everyone's opinion?
This determines which kinds of packages your code editor will be told about. I have it set like this
To be honest, I just picked these arbitrarily
Fair. Wasn't sure how many of these were crucial but at cursory I think it's fine this way.
mines just default
how can i check when an animation has finished playing?
you can trigger an event at the end of the animation (not sure if theres an easier way; best to ask in #🏃┃animation )
''' private void OnCollisionEnter(Collision collision)
{
if (collision.gameObject.CompareTag("Enemy"))
{
Destroy(gameObject);
loseText.SetActive(true);
}
}'''
anybody can help why this is not working when colliding
is it even being executed?
How do you know that?
because when i debug the function is called oncollision but not the if
Then the thing you're hitting doesn't have the tag Enemy
yes it does
Not according to your code it doesn't
Try logging the tag of the object you hit before the if
found the problem thx for the quick help!
public class PlayerMovement : MonoBehaviour
{
public CharacterController2D controller;
public Animator animator;
public float runSpeed = 30f;
private float _horizontalMove = 0f;
private bool _jump = false;
//bool crouch = false;
void Update()
{
_horizontalMove = Input.GetAxisRaw("Horizontal") * runSpeed;
animator.SetFloat("Speed", Mathf.Abs(_horizontalMove));
if (Input.GetButtonDown("Jump"))
{
_jump = true;
animator.SetBool("IsJumping", true);
}
}
public void OnLanding()
{
animator.SetBool("IsJumping", false);
}
void FixedUpdate()
{
controller.Move(_horizontalMove * Time.fixedDeltaTime, false, _jump);
_jump = false;
}
}```
I am having a slight issue with my setup, I want to play a 3 framed jump animation, the first frame to go up, the second to start falling and the third to land.
But with this code, it obviously starts the animation, and even if I havent landed yet, it switches to the running anim, is it possible for some way to play the 3rd frame until my character has landed?
Sounds like you want to enable "has exit time" on the transition out of the jump anim state
Hi. After a year long break I'm getting back to Unity.
I'm trying to get an UI element to appear above a game object. While it does appear on the game objects, I can't get it to appear above...
Vector2 infoPanel = Camera.main.WorldToScreenPoint(gameObject.transform.position);
panel.transform.position = new Vector2(infoPanel.x, infoPanel.y + 5);```
this is how it looks like right now
Consider adjusting the RectTransform's pivot point!
If you set the pivot to X=0.5, Y=1, then its "origin" will wind up being at its bottom-center
(or was it X=0.5, Y=0?)
turn left! no, the other left!
You are also now working in pixels, so your + 5 is probably that part of the cube showing
yep yep
yep, that was the problem
mb
works now
thank you both
hi, im currently making a doodle jump clone and im having a problem with the cracking platforms. below in my script, i start my FadeOut() coroutine but for some reason in runtime my cracking platform neither goes down or becomes transparent? however, it DOES destroy itself after the while loop is over
hm, the code looks sensible enough
Yep
make sure nothing else is controlling those properties
Does it have an animator?
yes, after you said this i removed it cuz i had forgotten too from before and it solved the problem. thank you so much!
Noyce
yeah if the animator has animations that modify those properties then it will hijack all control over them (unless you change the properties each frame after the animator updates)
(even if the current animation state doesn't control that property!)
Yeah, by default
I think that can be changed with "Write defaults" on the animator and/or in the state
You'd think, but no!
"Write Defaults" controls what value you get for properties that don't currently have a motion that's controlling them
when enabled, you get the value that the animator saw when it turned on
when disabled, you get whatever value was last set by a motion
If you want to go clinically insane, try replacing all of your game's code with an Animator (i.e. create a VRChat avatar)
(WD On is generally more predictable)
I had a hilarious problem where an animation state that controlled a screen shake effect could exit slightly before it reached zero
I had WD Off, so the effect just...stayed there
random people would see their screen rattling near me
Are you talking about "Write Defaults" in the animator's inspector, or the state, or both?
the animator component does not have a "Write Defaults" property
this is a property on animation states
Oh, someone mentioned it some weeks ago when I brought up Write Defaults in the state
I have been bamboozled
apparently the animator starts freaking out when you mix WD On and WD Off states
Ok I wasn't insane :D #archived-code-general message
ah, debug mode
Yeah I'm slowly transitioning into using Playables instead
why is my navmesh not working
"Not working" is too vague. What's not working about it?
its just not moving
Note that the path may not become available until after a few frames later. While the path is being computed, pathPending will be true. If a valid path becomes available then the agent will resume movement.
Think the problem is calling that in update
to start with you are setting the destination every frame so Unity never gets a chance to calculate a path
so how do i make it work then
dont do that
Don't call it if path is pending
don't set the destination every single frame, do it every x amount of time instead
Just check if the path is pending currently, and only do it when it's not
like this?
because its not working
Have you assigned everything in the inspector? target and agent
sure. What isn't working about it?
If you didn't, you should be seeing errors
Have you checked your console to see any errors etc?
its not moving
hi, can i get some help?
im doing the pathway for beginner programming, making a door trigger, followed everything literally to a tea and still no trigger is happening
i have this but the navmseh has nothing to do with the camera
To a T*.
But - presumably, you didn't follow everything properly.
Show what you tried
IIs your code even running at all? Did you attach it to the correct object(s)?
clock that T, thanks for the correction, here is what i gots
maybe you forgot to add the Player tag to your player
And the player object?
how do i do that?
guess you missed it in the tutorial then?
Tutorial shows you
untagged, damn i didnt see it
😔
works now, i mean....... let me sit my stupid a** down
actually, im looking the word tag in the tutorial its now showing
maybe its in earlier tutorials?
omg i skipped to "more things to try" by mistake without doing all the beginning lmao
hi, what function can work for delay? Cuz im trying to make an assault rifle, and it fires countless of proyectiles in a milisec
{
if (Input.GetMouseButton(0))
{
rifle_shooting();
}
}```
a simple timer can work.. or a coroutine
so, what script i have to put above rifle_shooting();?
oh, ok
a courutine?
yes, 1 second
a simple timer would look something like
public float fireRate = 0.1f;
private float nextFireTime = 0f;
void Update()
{
if (Input.GetMouseButton(0) && Time.time >= nextFireTime)
{
nextFireTime = Time.time + fireRate;
rifle_shooting();
}
}``` you'll need to track the `nextFireTime` in the update loop for example
for using a coroutine its something along the lines of..
void Update()
{
if (Input.GetMouseButton(0) && !isFiring)
StartCoroutine(FireCoroutine());
}
IEnumerator FireCoroutine()
{
isFiring = true;
rifle_shooting();
yield return new WaitForSeconds(fireRate);
isFiring = false;
}```
but i suggest u see my [previous comment](#💻┃code-beginner message) and take the time to read up on the documentation, and the other site i sent to learn what they are and how they work (or rather when to use them)
try out each.. see what works for you,
if u need additional help afterwards w/ specifics or issues feel free to ask
you'll need some additional using statements:
using System.Collections;
when using Coroutines
Did a bunch of testing with my threading system (in build), these are the results:
6 threads, no transforms:
100 fps
1 thread, no transforms:
120 fps
no multithread, no transforms:
110 fps
I dont even know how to understand this
Threading isn't magic and comes with a cost. It's not something you 'just do because it's good', you have to look at your game and figure out which pieces actually make sense to parallelize
well im trying to understand how 1 thread does better than no multithreading at all
like it makes no sense
the main thread waits for that one thread to finish every frame
right, it's not magic. If you have sequential dependencies, those still exist
they run in parallel
wait what? isn't (1) thread and no multi-threading the same thing?
especially in unity where a lot of the importnat work must be on the main thread
yeah exactly
as someone that doesn't use threads.. just basing it off semantics
ok I think I am losing my mind
1 / Time.unscaledDeltaTime should be the fps, correct?
I am relatively new to unity and c# and was wondering if anyone could help me get my collisions to work
shouldnt it be 1.0f / Time.deltaTime, not unscaled
but 1.0f / Time.unscaledDeltaTime should also work
interesting
unscaled is correct
So what is the difference of "1 thread" and "no multithread" here? What do you mean by those?
no multithread means it runs on the main thread, 1 thread means it creates one job and waits for it to finish
anyway after using deltaTime instead of unscaled the numbers changed quite drastically
i guess u could think of it like this then..
🧑🍳 Imagine a bakery with:
- 1 baker
- several assistants
if the bakery has just enough orders for 1 baker to handle efficiently adding more asistants wont help. thy'll just get into each others way..
worse the baker has to:
- spend time managing the assistants (overhead)
- and waiting for assistants to finish tasks that they might not have needed to do
sometimes its better to let the baker work alone.
- use multithreading like if the baker had to handle a large catering order. In this case, having assistants (threads) to manage different tasks, like baking and decorating, would allow the baker to focus on other things while others work in parallel.
- use none when theres more of a costs/savings thing if chef has to wait for a cake to bake in the oven or the baker wait for it to be decorated before it’s sent out.. they'd equally be standing around
So your timescale is not 1?
It should be, I never change it
maybe something else was wrong and I accidentally fixed
anyway it seems to make more sense now, fps becomes better with more threads
Then unscaledDeltaTime is the same as deltaTime
fps in general? or multiplayer?
frames per second, in my singleplayer game testing with multiple jobs is probably better to say than threads
The more tasks you can split into threads the better, because tasks not split into threads have to wait for each other to be complete (In sequential order)
Though becareful with threads, as they introduce the issue of one task potentially getting too far ahead, or one task locking up other threads
You cant just throw any code in there either
it needs to make sense to run it simulatnous
the code in question was causing 20% of the frame to be taken up by vector multiplication, seemed to make sense to me
vector multiplication ?
Wasn't it the moving transforms part?
what are you doing that a vector multiplication eats 20% if a frame
that took 20% as well
but for testing I disabled it
Im making a bullet hell game, updating positions of 10k objects
well I think things are finally starting to work, multithreading seems to have taken me from 42 -> 150 fps
which if thats really true is amazing
this is without updating transforms though
Is the collission checking on your bullets or on the characters?
Having 10k objectives constantly checking collissions would slow it down
collision is non existant for these tests
Oh, this test is just about making them move then
yeah
and to avoid fps annihilation i was gonna make my own data driven collision system which only checks bullets near the player, as we dont care about most other interactions with bullets
I think that would be event based collision, which unity uses by default, so don't worry on that end
It's all about finding which setting effects the things the most xD
Hello
I measured a ton of job counts
and wanna see if someone can give me insight on results
the fps seems to oscillate like almost a sin wave,
near multiple of 6 pretty close to its max, and at non multiples of 6 lower, The highest recorded was at the first multiple of 6, 6
I am not sure I understand the question, but I do not think there is correlation between optimization and multiples of 6 for FPS
hi, im making a doodle jump clone and translating my player whenever they touch the jetpack but it feels a bit too instant. how can i i ease it in and out like doodle jump?
so im trying to create like an Action Bar that allows items and skills, i want to make it similar to how in farming games the item on the action bar decrease while also having the same in the inventory. A simple idea of what i did is basically the following UML. Is there anything else i should consider. I am currently only focusing on single player so my assumption is SO is not ideal for a inventory System in a multithreaded environment.
could someone help me with this the codes not working im a begginer
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class playermovement : MonoBehaviour
{
public float speed;
public float jump;
private float Move;
public RigidBody2D rb;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
Move = Input .GetAxis("Horizontal");
rb.velocity = new Vector2(speed * Move, rb.velocity.y)
}
}
Read #854851968446365696 then try posting your question again
OK
im trying to make a 2d movement controller for unity and ive been making this for like 2 hours but every tim i go back to unity it says error cs1002; expected do you have any ideas what i did wrong like did i not capitalyze smthing?
this is the code
It means you have a missing semicolon, at the end of the line rb.velocity = new Vector2(speed * Move, rb.velocity.y)
you put semicolons after ) ?
The error message has a message and a line number. You should be reading those and looking at your code to see what you did wrong. Ignore the cs1002 part.
"; expected" is pretty clear about what you missed here
A semicolon goes after every statement in C#
Do you have your Visual Studio configured?
Is it showing you red squiggles under your errors like that
whats cofigured?
umm no
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
• :question: Other/None
Trying to write code without that is a fool's errand.
thysm
Translate moves the xy co-ordinates directly. If you want gradual acceleration followed by gradual deceleration, I suggest looking into rigidbodies for physics and velocities.
Hey, I'm currently having an issue where my prefab that has a worldspace overlay of a text input field not taking any input even when I click it. This doesn't seem to be too common of an issue, but I've been stuck on it for the past couple hours on how to fix it. Can someone help me possibly debug this issue?
anyone know why i get "Type Mismatch" in the unity inspector when i select a text mesh pro text to go to this variable?
public TextMeshProUGUI prompText;
oh ok
idk how to fix that
my character stops moving in random areas, she stays in the move state but the xVeocity keeps switching between moveSpeed and 0 so she doesn't move but when I change direction then it goes fine, how can I fix it?
anyone know why the "step" button is ghosted out?
hey guys, i am trying to get my ads work in my game but i keep getting this error
Assets\Scripts\AdsManager.cs(72,45): error CS0426: The type name 'Builder' does not exist in the type 'AdRequest'
No one seems to know how to solve this, i ended up joinig here
hmm u got a screenshot of code and ide error
this is the code
this is the error

seen this?
argh unity6 is so jerky, need to restartedl iek 10x a day
oh nah! let's see
!code
📃 Large Code Blocks
Use links to services like:
https://paste.mod.gg/, https://hastebin.skyra.pw/ , https://paste.ofcode.org/ , https://paste.myst.rs/
📃 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.
whats this?
Posting code
📃 Large Code Blocks
Use links to services like:
https://paste.mod.gg/, https://hastebin.skyra.pw/ , https://paste.ofcode.org/ , https://paste.myst.rs/
📃 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.
whats what?
Exactly what it says; use paste sites to post code or inline small code blocks correctly by formatting . . .
You inserted a text file (to download) instead . . .
yo! i need help, i get this message out of the console:
NullReferenceException: Object reference not set to an instance of an object
UnityEditor.Graphs.Edge.WakeUp () (at <a31f1ba8e689484984b8d32e3f901c80>:0)
UnityEditor.Graphs.Graph.DoWakeUpEdges (System.Collections.Generic.List1[T] inEdges, System.Collections.Generic.List1[T] ok, System.Collections.Generic.List`1[T] error, System.Boolean inEdgesUsedToBeValid) (at <a31f1ba8e689484984b8d32e3f901c80>:0)
UnityEditor.Graphs.Graph.WakeUpEdges (System.Boolean clearSlotEdges) (at <a31f1ba8e689484984b8d32e3f901c80>:0)
UnityEditor.Graphs.Graph.WakeUp (System.Boolean force) (at <a31f1ba8e689484984b8d32e3f901c80>:0)
UnityEditor.Graphs.Graph.WakeUp () (at <a31f1ba8e689484984b8d32e3f901c80>:0)
UnityEditor.Graphs.Graph.OnEnable () (at <a31f1ba8e689484984b8d32e3f901c80>:0)
what do i have to do to make it gone
that is an editor error. you can pretty much ignore it
i think thats a unity bug
sure?
if it bothers you then close any windows that use the graph editor like the animator or shader graph editor
yeh i see it sometimes
ok thanks
whats "a waypoints script"
uhm i call it like that but basicaly a script that make an ennemi travel from a point A to B and goes back
what did you try so far
not everyone handles waypoints the same way
i tried a script from someone online, but didnt work lol
trying to follow a tutorial
all you're doing is setting the current waypoint, use Distance or timing, go to the other waypoint . Rinse and repeat
and having a 60% kb is a fking shit show for scripts
huh?..I use 60 no issues with scripts
im not having issues, i just dont know the keys combo to do the things
idk how to do that man its my first video game, its an optional class i took
they dont teach us scripts
there is no such thing as "teaching scripts"
scripts/code is just a tool. The code starts in your brain
You have to figure out the design of what you want to accomplish, then you find which pieces code helps you do that
yeah nvm imma just ask snuffer if he wants to make one when he get online
like i said, idk shit about making a game so telling me to guess things isnt helping x)
who said anything about guessing lol
forget making a game in the beginning, you have to learn the starting building blocks to get going
I suggest you go through the pathways on unity !learn
:teacher: Unity Learn ↗
Over 750 hours of free live and on-demand learning content for all levels of experience!
break down each thing you need into smaller goals, start getting comfortable
i have to give my game tmw, forget it. my ennemy is my last step
yeah goodluck with that then lol. Whoever told you making a game was a "overnight" thing might have mislead you
you're asking today about making an enemy AI for something due tomorrow 🤷♂️
Ill find a way
Worst scenario i give my game without the ennemy moving, all good its worth 15% and i have ~98%
its possible to do but if you don't understand the implementation it won't work.
You can store Store waypoints in an array of transforms then cycle through the array through an index that gets increased each time you reach a waypoint using Vector3.Distance, or use a timer.
then reaching the end of array you either cycle index back to 0 (first) or go back the other way doing --
WOuld anyone know why my player is bouncing for no reason.... its only happeneing in one level but the same ground and same players are being used..
Ive added debugs for the jump methods but those are not being called so its not a jump being called
Im so confused as this is only happening in one level.
I had that same issue happen to me. You’d track the state of jumping using a boolean and set jump request to false when your jump keys aren’t pressed basically
this is a coding channel
where should i ask my question?+
thanks
But its not bouncing because of my jump code I thought it was, but i also commented out ALL jump code to see if that would make it stop and it didnt I also took the jump animation from the controller and it still bounces and the way i do call my jump in the animator is if isgrounded is true but a button has to be pressed for it to work
wydm by "bouncing"
Check if any scripts (if any) are acting upon your player by toggling an animation at an unwanted time. Also, check physics material bounce value if you’re using one. Other than that, not exactly sure as to why. You’d have to dig into your set up deeper
are you sure your JUMP method isn't being called somewhere else?
what would should i start with as a projekt, im just started to learn coding and know basicly nothing, but still would like a little projekt to start with. know idk if i should go into 2d first, because people said that the change from 2d to 3d is hard
Or check if one of your animations have a loop enabled.
2d/3d more or less are similiar in unity
the best projects are the usual simple ones, break out, flappy bird, invaders, etc.
yeah I only have 2 references on my jump method, and i commented everything out that had to do with my jump methods, but the weird thing is its only happeneing in this level and no others..
i made sure and it wasnt on loop
use this its great https://assetstore.unity.com/packages/tools/utilities/waypoints-free-143216#description
no physics material
lock the rigidbody and see if it still jump
when i put it in static it didnt bounce
i already made like a platformer but its still hard with all the code, and i don't want to get it all from youtube. On the other hand it's hard to remember what code does what (and english is also not my first language). is is there any kind of website that like idk, shows you what what code does?
ok so now you can narrow down to the fact that something is adding that velocity to your RB
Find all scripts that reference the RB and go from there,
you know it was the RB and not Transform.position otherwise static would not affect it
use something like the corgi engine
hmm okay.. I guess i just need to check though all my scrips to see if something is changing it
itll either be some force being applied or your jump getting called.
or an animation?
If it’s happening in one scene only, it seems to be something in that scene is affecting it. Check all scripts in that scene
its easy to narrow down with IDE search. Usually you can search for all the Rigidbody components, then each script that has one see what they're doing with that component and whatever name you gave it
will check all this and report back
first thing just turn all scripts on that player off
if it stops u know its one of them
thats what i was thinking but before i made other levels this scene wasnt doing this
well mostly the API and manual. They explain those.
You have practice more the same things you DO already know somewhat
if you are not remembering it means you're not doing it enough
you're not gonna learn say, how to make a raycast then use it once and expect it remember how to do it again next time..
you have to engrain it into your mind until its pretty much easy muscle memory almost
so basicly get a code and then use it as often as possible?
exactly, not just "a code" but the process you used that code for
put the code into meaningul method names too, then its easy, buttechnically by reading code you should be able to see what it is trying todo
the code is just the tool to achieve a solution to a certain problem
thats why the syntax is very much the least important part, its important to you WHY that code is being used , what problem is it solving
Physics.Raycast, what does it do? Makes ray that can hit colliders, what problems does it solve? Detecting Objects etc.
u should be a teacher 🙂
Im still a newbbb
he is teaching
I looked at the Unity certs, hella expensive
maybe one day I also have my Udemy course lmao
hehe, i never seen anyone even care about certs really
very rarely does anyone care if u even have a masters
I'm sure its a good look for places that care about papers, school
I'd only teach if it was a school that offered gamedev
im stunned ppl get into google after taking one of their exams lol.
need to be a savant to understand the question.
basically either almost genius with problem solving or a machine.
yes exactly, being a great coder with 30 yrs experience wont cut it..
yeah year is important, but showing off what problems you can solve for them is everything
also i cant see a single enjoyable job at google anyway, all boring nightmares.
thats most jobs now days, all machine learning and data science
I think mastery in C++ demonstrates a lot of that considering you’re working with a lot of stuff more manually that .NET already handles
yeh i thin ki have a test laterfor "alignnr" bet thats too hard
anyway lets not veer offcourse to unity programming topics lol
OMG I got it THanks to all that helped me
it was in my enemy script where i have the player jump on an enemies head and then the player jumps somehow that was trigging it
thanks @rich adder @keen owl @sour cape
np good luck,
Nice job! Make sure to look out for small mistakes like that next time as they can get annoying to deal with lol
I sure hope you don't have everything Public everywhere lol
they forreal do..
i once took 2 yrs to fix a bug, and i cried when i finally did lol
private void OnTriggerEnter2D(Collider2D other)
{
if (other.CompareTag("Player") && this.gameObject.CompareTag("Slime") || this.gameObject.CompareTag("Bat"))
{
currentHealth--;
if (currentHealth <= 0)
{
// THE LINE COMMENTED BELOW IS THE ONE CAUSING THE PLAYER TO JUMP ON START //PlayerController.instance.theRB.velocity = new Vector2(PlayerController.instance.theRB.velocity.x, PlayerController.instance.jumpForce = 13f);
PlayerController.instance.jumpForce = 13f;
PlayerController.instance.anim.SetBool("isDoubleJumping", true);
PlayerController.instance.jumpForce = 19f;
}
}
else if (other.CompareTag("Player") && this.gameObject.CompareTag("Kidnapper"))
{
PlayerHealthController.instance.DamagePlayer();
}
}
So this is my code for if the enemy's health is 0 then is makes the player jump is there a different way to do this..
holy shiiiiiittt...... this insane im so sorry lmao i woulda have def cried myself!!
seems alright, id prob put brackets around this.gameObject.CompareTag("Slime") || this.gameObject.CompareTag("Bat")
yeh then i was so happy i drank a half bottle of whisky, carried on working and somehow lost the solution lol, took another 6 months to find
no point in setting jumpforce twice btw
hardest bugs to solve for me are usually timing issues, race conditions or actual differences in timing on hardware
but once u fix one u are aware of the hell 🙂 this was 2 identical phones behaving different in same game.
but
PlayerController.instance.theRB.velocity = new Vector2(PlayerController.instance.theRB.velocity.x, PlayerController.instance.jumpForce = 13f);
this line of code is whats causing this bounce for no reason
would u know why this could would do this?
oh wow haha yeah youll def not forget that mistake!!!
i remember being on my knees in the garden nailing whisky, screaming.... before backing up lol.
always back up before celebration 🙂
if i put these [ ] around that could i just get red line
use ( )
what are you trying to do?
just so its IF THIS && (THIS OR THIS)
It seems weird to handle it all with tags, and that the slime, bat, and kidnapper share this implementation
I'd make a separate script for damaging the player on hit
i dont find it that weird
you shouldn't have to check what tag this object has. it should already be known . . .
but
PlayerController.instance.theRB.velocity = new Vector2(PlayerController.instance.theRB.velocity.x, PlayerController.instance.jumpForce = 13f);
this line of code is whats causing this bounce for no reason
would u know why this could would do this?
Trying to figure why this line of code is making my player jump even thought the enemys health is not a 0 or the player did not go over the trigger for it to be called
The value of components is that you can compose them instead of writing a monolithic implementation that switches between different logic
the health must be 0, print out what health is after u do the --
maybe u forgot to initialise health and it starts 0 ?
WAIt NVM doing this fixed it
IF THIS && (THIS OR THIS) @ @sour cape
why are you assigning jumpForce? do you mean to use the value instead?
so the player dont jump as high as a normal jump
Jumpforce is the value of jump
good yeh there was some ambiguity there without brackets
What you mean?
they meant the parentheses (). they separate the logic in your expression (if statement) . . .
it was saying if other one is a player and this one is a slime OR if this one is a bat
hard to explain, think maths style, like 5 x 10 x 10 is different from 5x (10x10)
ahh okay kinda makes since when u explain it like that
i wrote a collision code so i can kinda push objects around. but they just dissapear instread
maybe the force is so much they appear to disappear but theyre miles away
reduce pushPower to like 0.01f to test
ok wait
niiice.. np
looks like something turns off your camera, or the parent of it
check in hierarchy if its off
When i start, my player,celling check,ground check and main camera turn grey in the hierarchy@sour cape
Okay i fixed it
dark grey, somethings turning them off yeh, start by trying to find which script it may be, turn off likely candidates then start game again until u narrow it down
That was weird
cool
Thx for helping
dont crosspost next time and this is not a coding question
lol
Anything about Crosspost in the rules? I didnt see it. And yup , you got it there's no coding. Congrats. Mod can warn me if they want
Ill make sure to ask in code-advanced next time
How do I fix this?
I managed to fix some through this but now it’s grayed out
It’s an official Unity project btw that I imported
pink is usually unsupported material due to using the wrong graphics pipeline
its in the #📖┃code-of-conduct
also no need to be upset at me about it, I'm just telling you what the community rules are.. Same post, multiple channels especially unrelated to channel, is crosspost
so you need to convert the materials to support
How do I do that?
which pipeline is the sample?
Where do I see that?😅
window->rendering->hdrp wizard is "semi" good at converting materials to HDRP
hehe where did u get the sample from whats the name
i downloaded the "Challenge 2 starter files"
it also messed up some other textures on the tutorial project
hmm, im assuming thats built in or urp
yeh i guess thats only ther ein hdrp projs
open the materials drop down select one of the materials
then click on that see what it says
yehi get it, its all confusing as heck in the beginning
You mean the materials folder?
doesnt help that i can barely type because every keyboard i get breaks within a week
in mesh renderer theres a merials dropdown
Having the same problem😭
if u click o na metial in there itll show more info about the merial
Is it a Razer keyboard
I have a double monitor so it always captures the other monitor too
i break spacebars for a living
Hahaha
haha yeh, i got 7 here
thats fine, its better than cancerous phone pictures
I have a BlackWidow v4 and it has a double clicking issue it’s the third already
its like being in a tanning salon just using pc
You wouldn’t be able to see anything, and discord doesn’t let you zoom in on pictures
basically the material u need to change the "shader" to compatible one
you seriously think this is better than an actually screenshot of your desktop..no..can barely see shit
yeh whats it say under shader
what option should i select here?
the pink one
ah ok theyre URP and u must be on BIRP,
Ok dad, like i said they can Warn me
I mean at the bottom right after I opened the shader list lol
so u can either convert them to BIRP or move to URP
How do I do that haha🥲
yeh or use the pipeline converter
its on standard but nothing changed
oh yeh ur right the green works and is URP
the red ball got fixed for some reason lol
cause Standard is wrong
even tho i didnt pick it
Standard = BIRP
ohh
Rendering -> Pipeline Converter
it will change material but then you have to re-link texture
its usually better to convert
unity haveconfused the whole situ with all this
what do i do here?
tick the boxes? hit initialize and convert
Let’s see if I can get the challenge done now🤣
btw next time is #💻┃unity-talk question as its not really code lol
It’s fun they give you a game with many bugs and you gotta fix them
sounds like my last job 🙂
Oh I thought this is the channel for beginners
Haha that’s a fun job
code-beginner
I love finding problems and find solutions
then coding is for you
Well yeah but people treat people here like beginners and I need someone to explain like I’m 5 to me when it comes to this😭😭
huh? how's that change anything lol the #💻┃unity-talk channel is also aimed for beginners, if anything more who know unity but don't code also hang out there.. so more visibility 🤷♂️
Ohh I thought that’s like for people who already know Unity lol
nahh read description
Sweet, I’ll ask there when it’s not code related then
Ohh!
It’s like the general channel
yea
Thank you😄
Hi. I have stumbled upon a problem regarding in app updates.
{
// Wait a brief moment to let the scene fully load
yield return new WaitForSeconds(0.5f);
InAppStatus.text = "Checking for updates...";
PlayAsyncOperation<AppUpdateInfo, AppUpdateErrorCode> appUpdateInfoOperation = appUpdateManager.GetAppUpdateInfo();
yield return appUpdateInfoOperation;
if (!appUpdateInfoOperation.IsSuccessful)
{
string errorMessage = $"Update check failed: {appUpdateInfoOperation.Error}";
Debug.LogError(errorMessage);
InAppStatus.text = errorMessage;
updateCheckComplete = true;
yield break;
}
var appUpdateInfoResult = appUpdateInfoOperation.GetResult();
if (appUpdateInfoResult.UpdateAvailability == UpdateAvailability.UpdateAvailable
&& appUpdateInfoResult.IsUpdateTypeAllowed(AppUpdateOptions.ImmediateAppUpdateOptions()))
{
InAppStatus.text = "Starting update...";
StartCoroutine(StartImmediateUpdate(appUpdateInfoResult));
}
else
{
InAppStatus.text = "No update available";
updateCheckComplete = true;
}
}```
this is my code.
The code stops at Play async operation for unknown reason. can someone guide me regarding this issue.
is there anything in the console?
No. The console is not showing anything. The app works fine. just this script stops at this point
What is appUpdateManager.GetAppUpdateInfo()?
Also, does your code hang the application or does it just not continue when you say it stops?
Also, how did you determine this is the issue? Can you confirm by logging before appUpdateManager.GetAppUpdateInfo() and after to see if truly only 1 log is printed?
It checks if new version is available for you app and returns information about available update.
The app doesnot hang it works fine. I am showing status of this process on my screen. InAppStatus.text = "Checking for updates..."; The screen shows this status. In the code provided above I am updating this status in multiple instances but it just stops there.
Okay but did you actually check if it stops at appUpdateManager.GetAppUpdateInfo()? Put a log message after that
Also, I still don't see what appUpdateManager.GetAppUpdateInfo() is. Is this user code?
If it hangs on appUpdateManager.GetAppUpdateInfo() and it's not user code, there's not much you can do. At best I'd check if it ends up timing out, or if you can somehow make it time out. If that's the case your credentials are wrong
I will put a log and check if it is the issue here.
https://developer.android.com/guide/playcore/in-app-updates/unity I am using this documentation for implementation you can mor details about appUpdateManager.GetAppUpdateInfo()
Add logs to see if the async operation starts correctly and whether it still waiting.
PlayAsyncOperation<AppUpdateInfo, AppUpdateErrorCode> appUpdateInfoOperation = appUpdateManager.GetAppUpdateInfo();
Debug.Log("gettubg update info");
yield return appUpdateInfoOperation;
Debug.Log("got update info: {appUpdateInfoOperation.resultsOrSomehting?}");
how do i set angle limits for a hinge joint 2d . there is very little documentation for it anyways heres my snippet
vent = collision.gameObject.GetComponentInParent<HingeJoint2D>();
JointAngleLimits2D limits = vent.limits;
limits.max = 0;
limits.min=90;
if JointAngleLimits2D is a struct, you need to assign the limits back to vent again.
Did it work?
I added new logs. It still stops at log checking for updates... I am thinking of changing the version of library.
InAppStatus.text = "Checking for updates...";
PlayAsyncOperation<AppUpdateInfo, AppUpdateErrorCode> appUpdateInfoOperation = appUpdateManager.GetAppUpdateInfo();
InAppStatus.text = "After PlayAsyncOperation...";
yield return appUpdateInfoOperation;
InAppStatus.text = "After Yield reuturn...";
it is logging like this
That's weird, I would expect it to stop at the yield
So After PlayAsyncOperation... would be displayed
The yield would explicitly drop the coroutine until it's finished. If it stops at GetAppUpdateInfo as soon as it's called I would expect it to block the application
Is it stuck in getupdateinfo?
If you're running this on an android device(not unity's emulator) try to run the debugger there
Some errors only show when tested natively instead of unity editor
yeah. it is weird
How to fix this UI problem?
There's a chance that getappupdateinfo is throwing smth but unity doesnt catch it or doesn't respond
I upload it on internal testing and check the status with txt
ah the art of scalable UI
Different screens have different sizes, the position of some elements may be different. See how to build UI menus to counter this change:
https://youtu.be/QnT-2KxVvyk?si=fnhl-LXqi9rD4OGl
Master Unity UI! Start here ➡️ https://cococode.net/courses/master-unity-ui?utm_source=youtube&utm_medium=video&utm_campaign=5
This tutorial/guide will show you how to resize your Unity UI canvas, GameObjects, text, button and images. You will learn:
- How to fix Unity UI for every resolution
- How to adapt UI for mobile devices
- How to change...
To be on the same page, are you actually starting CheckForUpdate as a coroutine?
And is it actually Enumerator? Or was it just a typo in the copied code?
This is a coding channel #📲┃ui-ux
Also, absolutely no clue what problem you are indicating
The message is visible in the Scene but not in the Game
see the video I sent
Ask in #📲┃ui-ux
Where did you get this AppUpdateManager from?
I'm only seeing results for android studio
Its just typo in copied code
using Google.Play.AppUpdate;
using Google.Play.Common;
It is coming from AppUpdate packege
erm
is this package from unity package installer? googles website?
could you link the documentation? all the results are for android studio in java which doesn't exactly help here
Well that didn't change anything but thanks
ok how about this
resize your editor window
what happens?
like try dragging the border around
look at how your chat box moves
The code is from documentation. https://developer.android.com/guide/playcore/in-app-updates/unity#import-from-github
Can you share the actual code, including the place you start the coroutine?
this is the file for in app updates functionality.
The best I can think of is that it doesn't work in the editor.
Aside from that maybe google similar issues.
I downloaded the packege from github.
I will try downgrading the packege or installing from the unity packege manger. let's see how this goes. @teal viper @eager spindle @burnt vapor thanks for giving your time
Can you step into the api code in the debugger?
Honestly it's a shit library if it doesn't incorporate at least some sort of a timeout for this
Many things can stop a connection
It seems to be calling into a java api internally, so I wouldn't be surprised that it doesn't work in the editor.
what does Is Kinematic in Rigdbody mean?
It disables many features of what rigidbody provides like forces, but this is one way of creating your own character controller if you're looking for collision detection but with your own physics logic
my navmesh isnt moving my object
Can some expain how slerp works pls
is it fine if i use python for unity?
Unity uses C#
Okay
hloo
can we?
ik
Lerp interpolates (moves along the shortest path) from a to b in a straight line
Slerp interpolates (moves along the shortest path) from a to b on a sphere
It uses directions instead of a point in space. Imagine picking two cities on a globe. Your finger will move in an arc (spherically) around the globe between both points. That's how it will move
In Unity, the interpolation (movement along the shortest path) is based on the angle between both directions, therefore, noting it rotates from one direction to another
Basically, imagine moving your head from left-to-right; that's sleeping . . .
can i send tutorial links here?
For what purpose?
Vector3.Slerp is the unpopular younger brother of lerp, but it doesn't need to be that way! It has a load of utility once you learn how it works.
I'll teach you what slerp is, how slerp works and how to use slerp... slerp
I used 'Shapes' to make a few of these effects, you can check it out here: https://assetstore.unity.com/packages/tools/part...
If to help, or show what you need help on, sure . . .
thanks
Well, as this is a coding channel. You need to find the proper channel for that . . .
You'll find better help in one that is suited for level design than us keyboard warriors . . .
um can u tag the channel for it?
Oh, I wouldn't know. I only code; not design or build levels . . .
Maybe #⛰️┃terrain-3d , #🛠️┃probuilder , or #💻┃unity-talk
