#archived-code-general
1 messages ยท Page 348 of 1
Also please put a Debug.Log inside the methods and validate it's actually not called and not just the if statement not calling
the collider (sphereColider) who is trigger do not work and is never call even when the player (tag with player tag) to inside
so the camera who normally can be change, can't in this case
So is the method actually not called or is it the if statement that doesn't work? please debug
And perhaps follow this: https://unity.huh.how/physics-messages/trigger-messages-3d
i already try that, i put a Debug.Log("Collider is triggered"), but this message never appaired
this is sus because i use the same system for a quest and the quest work
Then consider following the first link and verify everything is set correctly. Specifically when it comes to actually receiving trigger messages https://unity.huh.how/physics-messages/trigger-matrix-3d
Considering your methods look fine it has to be related to the actual triggers. You haven't shared those so I suggest you validate those
i am here
my player is in the colider but nothing hapend, i do not have any message on the Log
and where is the component that should be receiving the physics message
this
is that just on a completely unrelated object?
because only the objects you screenshot before would receive the messages from the collision/trigger
ok, that work, thank
i juste put the script on the Left_Door_Final
I'm working on a rigidbody character controller. When it falls off the slope it gets stuck in the ground for a moment, i dont want that (see image) . So to fix it i have a variable called velocityBeforeCollision i update every frame, expect OnCollisionEnter() frame. And then i set the velocity to projected velocityBeforeCollision when it hits the ground. Is there an easier fix?
You should show code, and if this is kinematic because getting stuck in the ground like this shouldnt really happen in such a noticeable way unless you're doing something weird to begin with. I dont see the point of needing velocityBeforeCollision here
the body is not kinematic. It's not super noticeable, just annoying. There is a lot of disconnected code so dont want to show it. But i can try to isolate the issue
What I meant is that it shouldnt be noticeable at all, unless i guess you're falling from massive distances or possibly have a weird setup. Like one case (which I hope you didnt do) is a non kinematic rigidbody on the floor with locked positions.
Not much can be said if you dont show what you're doing though, anything would just be guesses as to what you're doing
thinking about it, what i described fits better for me anyway. I'm setting velocity every frame and i want to have control over it and not lose some of it because of the collisions. So let's just drop it
For some reason, my Input Action Asset isn't found by Visual Studio. I have the Input Action "Player_Input.inputactions" and .cs files under Assets/Resources, but they don't show up in my Visual Studio project, and as such I can't reference them. Do I need to add them to my Assembly somehow?
It used to work until I added Animancer in, not sure why that broke everything.
you're using assembly definitions and you don't have a reference to the assembly that generated class is in (likely due to it being directly in the Assembly-CSharp assembly)
Is it possible for me to "move" it to the standard Assembly?
it is in the "standard" assembly which is the problem. you cannot reference that from your asmdef, you need to put it into an assembly and reference that assembly, or put it into the assembly you are working in. or use an asmref
I see, thanks!
I'll look into putting it into the assembly I'm currently working in
It worked! Thanks a lot boxfriend ๐
I'm having a problem with the way the code positions my character. I want it so that when the player interacts with the mounted LMG, their camera will be set to the LMG's cameraSit, the player model set to the playerModelSit and the player parent be set in playerSit. I have set the transforms correctly in the scene and inspector and yet the player just mounts wherever
Here's all the code associated:
FPSController https://hastebin.com/share/buyanakoda.csharp
MountedLMG https://hastebin.com/share/ocaxayohod.csharp
your player has a CharacterController which cannot be teleported without disabling that component
Anybody who knows a bit about the Kinematic Character Controller?
I have a question about making AI move through it's motor
Anyone know where i could look for some beginnerfriendly help when it comes to programming for like an android phone? I have been trying for hours now to just grab the stepcounter-information from my phone into a textfield in unity, but im getting absolutly nowhere ๐ฆ
you can ask in #๐ฑโmobile if there is a built in way to access that info. if not, i imagine it's going to require some asset or you may even need to write a native plugin for that (which is not beginner friendly)
I just need to understand the function MoveCharacter in KCC.
Motor.MoveCharacter(new Vector3(Random.Range(0f, 10f), 0, Random.Range(0f, 10f)));
It basically just teleports the character instead of moving towards it, is that working as intended?
I have forgot the original KCC discord name so I cannot ask there
that method does not move over time, it moves the KinematicCharacterMotor to that position the next time it updates
Alright thanks for the answer
So i have a infinite loop somewhere in my code i cant find it so i question myself is there a way to check which line is executed in visual studio?
yes, you need to attach the debugger, then break all. you'll be able to check what is happening on each thread, you'll need to find the main thread and see where it is getting stuck
break all where is that function?
and youre sure this can also in vs?
yes
because breakpoints are not what i meant
i never said you need to use breakpoints. i told you to break all
Boxfriend told you how to do what you want.
yeah sorry i couldnt find it but i found it thx
Hey, I'm currently trying to create a virtual Microphone that can record in-game audio during runtime in a project using SteamAudio and save it to a wav file on my PC. My current solution involves using OnAudioFilterRead, which, if I understand correctly, essentially lets me record the audio that also arrives at my headphones. This works fine for having just one virtual Microphone, but since I want to have 3 active at the same time, I have to find a different solution. Each Microphone should only record the audio that would be played through my headphones if it was the active AudioListener in that scene, but I haven't found a way to accomplish that. If anyone has some advice or could help me with this, it would be greatly appreciated!
Yeah... This isn't possible with Unity's audio system. It only supports one audio listener at a time. You could try using FMOD instead. It supports up to 8 audio listeners, has Unity integration and Steam Audio supports it.
I was told before that there could be a way to modify Unity's Audio pipeline somehow, sort of like adding filters or some other audio-component to the Microphone objects and saving whatever goes through. Either way, that FMOD thing sounds like a solid option, I'll check that out. Thank you!
You can hook into various parts of Unity's audio system, but at best you can try to simulate multiple listeners with it by applying your own attenuation and 3D sound. But both Unity and Steam Audio will still work as if there's only one listener. I don't know for sure that Steam Audio will work with multiple FMOD audio listeners, only that Steam Audio has FMOD support and that FMOD supports 8 audio listeners.
Worst case scenario I guess I'll just have to let the simulation run 3 times to get the three Microphones' output, but it sound to me like FMOD is worth a shot
So I'm coding my own mouse cursor(for reasons) and I have the Cursor.State set to confined and Cursor.visible set to false. However my OS cursor is still visible until I click the window(at least in Unity Editor). Once I click the window everything works as intended until I press escape and my cursor becomes unlocked and I can move it outside the window..
This is working as I'd hoped, but my only issue is I don't know how to detect when the OS mouse has been taken over by Unity. When I launch, Cursor.State is confined and Cursor.visible is false, but neither are actually true until I click the window so that doesn't seem like an accurate method. Application.isFocused is also returning true initially so it doesn't seem to be a focus thing
have you tested in a build? that sounds like the normal editor behaviour
yeah I just did and it seems like escape doesn't release the mouse so I guess that is just an editor thing
yeah, it'd be easy to get stuck otherwise haha
Can someone help me? it says the term is ambiguous, when its not....? since there's only a single thing named rb in the entity class
Thanks!
I just thought of something.
What is stopping you from generating a tilemap, saving it as a PNG and just working off the PNG picture instead? Thus saving drawcalls and fps?...
Is there another class called Entity?
Yeah, i figured out already, that was the problem. I made a class a few days ago, and forgot about it!
thanks for helping tho
Fun fact you can hold Ctrl and it will turn into Hyperlink , if you click it it will take you to the definition
always good to verify you are going into the class you think you are
can also just right click and peek definition
oh yeah thats neat trick without going into the whole file
thanks for the tips!
anyone got any idea why my light is so dim, its the highest possible brightness it can go
this is a #archived-lighting
you're ina code channel
Check exposure settings maybe
Not a code question
also radius of 0 ? ๐ค
what exactly is this light supposed to bounce off with 0 distance oops
Radius is not the same as Range
It is the radius of the "bulb", larger radius gives softer light
Unity generate the solution. You cannot use another one.
ahh yes mb just realized this was HDRP so confused range for radius ๐
And yes, you can use "normal" C# in Unity.
does unity always build with the default shaders (sprites/default, diffuse, etc..)
Like any other assets - it only builds with assets that are used/referenced in your scenes
Hello, how can i make a button the interactable area when clicking/hovering/unhovering the image size of the button? i have searched a lot but haven't found anything useful, thanks a lot
no matter what i try its always using the transparent parts of the sprite when hovering over it, not using the sprite exactly (without the transparent parts of it)
is one of the things i tried, but its doing the opposite effect where the interaction area is in a inner part of the sprite
its like my image sprite but smaller the interaction area with that
so not sure what the issue is
then you need to look at your sprite and see what the alpha settings are on the pixels
im trying to make a fps game where you cans shoot, but i want the gun to be able to shoot real bullets, like spheres but i cant find a tutorial on it
its just composed of red/black sprites, so it would be really visible if there were transparent pixels i don't see, maybe there is an option in the settings im missing? no idea
also i remmeber watching a video on how to shoot with real projectiles, but i dont know what it is now
Rigidbodies on the bullets
AddForce(bulletDirection * speed, ForceMode.Impulse)
There are many physics based projectile tutorials out there
im new to coding, so how would i implemnent this?
Use the words physics based and rigidbody when searching tutorials
ok
pixels can have transparency between 0 and 1. Even pixels with 0.7 alpha dont look transparent
wrong reply, sorry
@fading hull
yea, i have checked them just in case, they are just plain red and black pixels
i still cant find any tutorials
then the alpha hit threshold should work
could you give me one?
Hey, I recently added some trees to my game but adding 180k tris/vertices visible at anytime and 2400 prefabs is really bad for performances lol
Anys idea on how to fix this issue please? I thought of billboard but they'll look weird won't they?
I'll just make bigger trees so I have to spawn less
can some one help rotate my ik target towards the floor when it is to far
When what is too far?
And how do these screenshots relate to your problem, is that what you want or what you currently have?
nvm i will use another way
Any ideas why asigning a float's value to Time.time might not working? This is inside my Timer struct, which is in an "Entity" class which is not a monobehaviour. This works fine with other times, but it doesnt work specifically inside the Entity class. Everything before and after seems to work fine, if Debug.Log's are something to go by
Here's the entirety of my Timer Struct, if that's helpful in any way
What do the logs say?
The log that returns the Time.time value works as intended, the one that checks the timer start time always returns negative infinity
How do you know which is which?
even tho i cann ResetTimer() which should change it from negative infinity to Time.time
The logs don't have any kind of label
Because i dont think Time.time can return a negative infinity ever?
Maybe some other log entirely
Do you have Collapse on
Add labels to your logs
whats that
Because if it is, both of those logs would collapse into the same one
Where identical logs go into one row and increments a count
instead of appearing twice
i do not have any other logs at the moment, i understand that adding labels is a good idea, but this isnt exactly helpful rn
No I think it's very helpful at the moment
okay, lets try
Debug.Log($"{gameObject.name}'s invuln start time is {invulnTime.startTime}. Time.time is {Time.time}", this);
Use this log instead of the two separate ones
this gives both values in one line along with the object whose values they are
Mhm, thanks
give me a second to add & check
Yeah, thats basically the same information i already had
it says negative infinity in russian now tho
Okay, now let's put a different log in ResetTimer, before you change startTime:
Debug.Log($"Resetting startTime, previous value {startTime}, new value {Time.time}");
The timer struct exists in other places too, so i wont know for sure which one is from the box specifically
i guess i'll need to add a way to label it
It'll be labeled by virtue of what logs happen after it
You'll get a reset log, then one of the logs above
that'll show which object just called it
The fact that it's a struct may have something to do with the problem, you're aware that you're copying the timers when you pass them around in/out of the methods, into other variables, right?
Wait it's a struct
Would changing it into a class help? i'll try
Oh, I missed this. This should almost definitely be a class
Okay yeah, that actually helped
thanks!
I had a reason to turn it into a struct, but i guess i'll have to deal with that problem later
anyway, thanks, it works as intended now!
wonder what exactly was the problem tho, the conditions for it not working seem kinda arbitrary
Structs are passed by value. If you have a variable that holds a Timer and you pass it to another object, that's an entirely different timer. So probably invulnTimer was an entirely different Timer instance every time you called it. Classes are passed by reference, so updating the value on that invulnTimer would actually affect the source it came from
Okay, that makes sense
i am aware that structs are value types, and classes are reference types, but i guess i didnt grasp all the implications of that, heh
thanks for explaining
Does anyone know why random range is always returning zero in my script? When I log both my min and max variables they return as zero. This shouldn't be the case though because when I load the player data it sets level to 0 so they should be changing to 1 and 4 but in the end report as 0 each
You are not showing the code that has the source of the error
I'm just trying to figure out why min/max isn't changing to the correct value if my "Level" is set to zero, console isn't posting any errors
Have you logged level?
Also Debug.Log(min + max) just prints the sum of min and max, noth both separately
Yeah I just figured that out, however that sum tells me both values aren't changing
Used the first level
Which is 4 - 8
No matter what level it's set to min and max aren't updating
Have you confirmed that Update is getting called?
I don't know how these snippets relate to each other, maybe share the full script(s)
{
PlayerData data = SaveSystem.LoadPlayer();
score = FindObjectOfType<Score>();
level = data.currentUpgrade;
Debug.Log(min + max);
Debug.Log("Level" + 1);
}
public void Update()
{
if (level == 0)
{
min = 1; max = 4;
}
if (level == 1)
{
min = 4; max = 8;
}
if (level == 2)
{
min = 8; max = 12;
}
if (level == 3)
{
min = 12; max = 16;
}
}
public void ImmaculateIron()
{
importValue = Random.Range(min, max);
Debug.Log("Immaculate Iron was chosen.");
importText.text = "Immaculate Iron " + "- " + importValue;
}
Start runs before Update, so it's normal min and max do not have the correct values when you log them
Log them in void ImmaculateIron(), where you pick the random number
As well as in Update to ensure it's actually running
We still don't know what min or max are
Nor what level is
It's at 1, according to the log, so it passes in the right path in Update
Just, too late for you to see it, since you log earlier
Wait I misread lol Debug.Log("Level" + 1); - that doesn't tell us anything
Log the actual value of level
Whoops I was testing that I'll fix that
You probably are calling ImmaculateIron on a different instance of this script than the one where Update is running
I.e. probably you've referenced a prefab or something
If you're not supposed to have more than 4 levels, consider adding
if (level > 3)
Debug.LogError($"Invalid level value {level}", gameObject);
So you have a trace on what the value is, and which object emitted the log
also using else ifs would be more correct and more performant
I'll try this to clean it up
What's weird is that level no matter what is set to 1, this comes from setting the starting value to 1 from the initial launch of the game
and update is running
Update is running, yes. On a different instance of the script than the one you are calling ImmaculateIron on.
Okay this makes more sense, update is only running for two frames on this script
Instead of blowing up the console with that message it just stops after two
then your script is being disabled or the object it's on is being deactivated or destroyed
or you have Collapse turned on in your console
Back to this: #archived-code-general message
If you get 2 logs while the messages are collapsed, they're probably from different instances
further evidence that it's two different instances
when collapsed it's only one message
Include the instance id in your log, GetInstanceID() will get it
does the two messages tell me there's two instances?
the two messages only show with the id, only one shows without it
I've also managed to get min max to update
to 1 - 4
now import value doesn't update
yes those numbers are the different instance ids of the two instances
and by two instances, it's two gameobjects with this same script??
two copies of the script
no indication if they're on different GameObjects or not
they could be
further logging could tell you of course
Or you can just start looking around your scene to find them
I just made my first script by following a tutorial on how to make player movement (i understood everything in it) what do you guys suggest i make next
make the same thing again but without using the tutorial
okay, thanks
Well this script wouldn't really be relevant
hey, what would be faster, using a dictionary with mapped functions, or using a switch statement and calling the functions for each case there? e.g.
using Dictionary<MyType, Func<T, R>>
or
using
switch(MyObj.MyType){//call functions for each type}
The script that actually spawns the text would be
The difference will likely be negligible. It will technically depend on the performance of your type's hash and equals functions as well as how many items are in the switch
lets say theres 20 items, will switch be slower? also does it evaluate every case each time
and in my case my type is just an enum
Profile it and see
The difference will be negligible, but yes, profile it.
If there's enough options in the switch it will use a jump table
I'm following this tutorial to try and instantiate a skinned mesh renderer on my character and I'm confused. It isn't quite working
https://www.youtube.com/watch?v=nSmEirb8JGM
public class EnemyBuilder : MonoBehaviour {
[SerializeField] float gearLevel;
[SerializeField] SkinnedMeshRenderer smr;
[SerializeField] Transform[] bones;
[SerializeField] Transform root;
private void Awake() { Build(); }
public void Build() {
smr.bones = bones;
smr.rootBone = root;
}
}```
I know this is because the bones are not right. How can I do this though
This is for randomly generated outfits
Just wanna comment on how good that ragdoll is
Games like Hitman 3 have perfect hitboxes, I feel like they arent even using physics, instead its some sort of Mesh/triangle detecting raycast. Wonder if thats possible
hi there, im adding a acceleration system to my player and so to do that i use this code but the problem is when i press for example the left right arrow 1 is always going to be * by my acceleration and i was wondering if there was any way of getting rid of that 1 so that its just the acceleration that is being added to the player and not a constant 1 (or maybe im doing things wrong and if so then let me know)
also im using getaxisraw instead of getaxis (in update function) because its gives the exact same result (-1, 0 or 1) every time instead of fractions which makes it easier to control for me imo
{
// horizontal movement
rb.velocity = new Vector2(horizontal * horizontalSpeed, rb.velocity.y);
/// acceleration
if (horizontal < 0)
{
horizontalSpeed += accelerationSpeed;
}
else if (horizontal > 0)
{
horizontalSpeed -= -accelerationSpeed;
if (horizontalSpeed > normalAcceleration)
{
horizontalSpeed = normalAcceleration;
}
}
}
basically what im trying to do is when i press right for axample, a force gets applied to my player constantly so it feels like theres zero friction and then i add a line of code to fradually slow the player down
i get this error (im trying to set an image to a certain sprite to make the dialogue person who's talking)
idk what to do
You probably imported the wrong namespace
I don't remember the correct one though. There are two, you need the other one
Can you share your imported namespaces?
wait whats a namespace
Top of your file, the list of using statements
They import namespaces
Monobehaviour?
Your code is also in a namespace, often manually specified
However, in Unity you mostly work in a default namespace and you don't specify it
No? Top of your file, list of lines that start with using
OOH LIKE using UnityEngine.UI
Try putting the following at the top of your file:
using Image = UnityEngine.UIElement.Image
If that fixes it, then UnityEngine.UIElement is the namespace you should use instead for your image, and you are likely using UnityEngine.UI
So the latter should be removed and replaced with the former namespace
you have the namespaces the wrong way round
Hi guys, I can't find a way to bake occlusion culling in a prefab....
I have a couple of big prefabs and would like to bake the occlusion culling to gain fps
Please use the proper channel, this is a coding channel.
oh well sorry
these are my namespaces
Change unityEngine.UIElements to UnityEngine.UI
Hi guys, I've got a strange issue with my code....
I'm using, i have the simple code here.
But whenever i build an addresssable asset (which should not be related to this code)
i have the following error
u need to write using UnityEngine.SceneManagement;
It probably builds the game. That error means that you're trying to include editor only code in a build.
SceneAsset cannot be used in a build, it is under unity editor
ohhh i didnt know SceneAsset was editor only
Try removing the UnityEditor namespace and see for yourself.
That shouldn't be included in a build either
ohhh okay
I been trying to get a collider to work with a line renderer, but for some reason the mesh is moved forward, it always happens and it multplies as farther aways as it gets from the first iteration, does anyone know how to solve this?
Maybe a world space vs local space issue?
you'd have to explain you're doing exactly and how
i cant manage to get the code to show in c in discord
it's been along time since i tried to post some code
IEnumerator branchR(GameObject previousRoad){
GameObject currentRoad = new GameObject();
currentRoad.transform.localScale = new Vector3( 1f, 1f, 0f);
LineRenderer lineRenderer = currentRoad.AddComponent<LineRenderer>();
lineRenderer.SetColors(Color.black,Color.black);
lineRenderer.material = new Material(Shader.Find("Sprites/Default"));
lineRenderer.widthMultiplier = 1f;
lineRenderer.positionCount = 2;
currentRoad.transform.rotation = previousRoad.transform.rotation * Quaternion.Euler( 0, 0, a + Random.Range(-1,1));
currentRoad.transform.position = previousRoad.transform.position - previousRoad.transform.right * 4f + currentRoad.transform.right * 2.5f;
lineRenderer.SetPosition( 0, currentRoad.transform.position);
lineRenderer.SetPosition( 1, previousRoad.transform.position);
MeshCollider collider = currentRoad.AddComponent<MeshCollider>();
Mesh lineMesh = new Mesh();
lineRenderer.BakeMesh(lineMesh, false);
collider.sharedMesh = lineMesh;
current.Add(currentRoad);
roads.Add(previousRoad);
current.Remove(previousRoad);
yield return null;
}
now
I am trying to recreate a system for procedural road patterns, and I need to know if a segment has something infront of it, so i can either connect it or adjust its position so theres no collision
ok so it seems like you are indeed mixing up world space positions and local space positions
meshcollider positions need to be in local space for the MeshCollider
LineRenderer positions will depend on whether th LR is in world space or local space mode
There's a second parameter to BakeMesh you should use
you mean the camera one?
no the useTransform bool
Seems like the LineRenderer is added to currentRoad
The docs only mention rotation and scale for the useTransform param..maybe it doesn't consider position
yeah its added to current road
Are you only going to have one collider per one line segment (two points)?
Might as well use a boxcollider if that's the case
yes
Anyways, is your LineRenderer using world space?
what i find strange its that as farther away it gets from the first interation of the system
the mesh appers farther away
You have to offset the mesh vertices in some direction, but I'm having massive brain fog atm so I can't formalize it lol
Subtract the road's transform.position from each vertex?
but i am able to modify the verticies of the mesh?
Try this cs var verts = lineMesh.vertices; for (int i = 0; i < verts.Length; i++) { verts[i] = verts[i] - currentRoad.transform.position; } lineMesh.SetVertices(verts);
Yes, you can modify meshes
oh ok
yeah it looks like it may work
let me try it out
it's not working but i'll keep trying on other setting to see if theres any effect
What happened when you tried?
it's seems like nothing has happened
You added my code after BakeMesh, right?
yeah
Because it should definitely do something
it dosent seem to have any effect
Try with useTransform set to true in BakeMesh
Does it still have the issue where it is offseted further on more distant objects?
@fresh notch Wait, try this but replace currentRoad with previousRoad
already did that
but its seems like sometihng changed
it's having some effect
yeah
no offset as further away as you get from first iterations
When subtracting currentRoad position or what?
Ah, I think you need to take rotation into account too
yeah subrstacting current
But I thought that useTransform would do that
You would either need to:
-Keep the rotation of the road object at zero and instead of using transform.right, calculate the currentRoad's offset in some other way
Or
-Counter-rotate the vertices by the inverse of the road's rotation
The issue is that your object is rotated and it the mesh vertices end up rotated too
ok i get it
This should work for countering the rotation (in the for loop):cs var v = verts[i]; v -= currentRoad.transform.position; // Remove positional offset v = Quaternion.Inverse(currentRoad.transform.rotation) * v; // Remove rotational offset verts[i] = v;
i may try to calculate the offset in another way
as for what i understand i wouldnt have to worry about this
if i just offset them in another way
Couldn't an InverseTransformPoint just handle all this position and rotation stuff
...Yes ๐คฆโโ๏ธ
v = currentRoad.transform.InverseTransformPoint(v);
ok thanks
i'll try it out
but i think i will redesing the entire system
as i will allow me to skip this calculations
Hello everyone I'm new here!
You could use multiple points in one linerenderer too. Unless you want these gaps in the corners
Can somebody help me with animating a simple camera?
yeah i already know about that
but i am just testing out
Also I'm pretty sure that a 3D MeshCollider with no depth won't really work for collisions here
I have camera and I want to make "cutscene" like for example you click an button and the camera will rotate 90 degrees in an animation how could I do that?
i'll just need to create a line renderer for each branch
when i looked it up
it seems it would work
but i still havent enabled collisions
so i'll test it out
Alright
that dosent seem to work
show code
Hello do you know why my vs code editor don't auto complete???
!vscode
Ok thx
Follow all of the steps
nevermind it's working i had selected branches which the code is not implemented
thanks for everything
but i think i will redesign everything
so it performs better
Thanks it works you're a lifesaver bc I had it broken for about 2 years
Is there a more efficient way to subscribe/unsubscribe to C# events for objects that are destroyed?
this can't be the best way
Nothing to do with efficiency your code will simply not work
how do you mean?
You are unsubscribing a completely different lambda instance
You can't unsubscribe lambdas.
it will not unsubscribe the anonymous lambda you subscribed with
UnityServiceManager.OnInitialized += OnServicesInitialized;
UnityServiceManager.OnInitialized -= OnServicesInitialized;```
For the parameterless one, this is what you would do
for the other one, I recommend making a function that takes the correct parameter
yeah i kinda just added the () from habit
and doing similar
yeah that's... not a good habit
nope v-v
it's creating a whole separate anonymous function
well great wonder how many times i accidentally made lambdas
looks like i dropped a cup of thumbtacks but the thumbtacks are a bunch of very tiny memory leaks
fun fun fun
I have a player, whose torso consists of Tilemap's Tiles.
The tiles are added and removed perfectly, but when recording PlayerController, Torso Tilemap and Face Tilemap on length decrease, and undoing the action manually, some Tiles just disappear randomly.
torsoTilemap.RefreshAllTiles(); // test
faceTilemap.RefreshAllTiles(); // test
Object[] dirtyObjects = new Object[] { this, torsoTilemap, faceTilemap };
Undo.RecordObjects(dirtyObjects, "Change player's length");
// Here:
// Add Tiles to Tilemap / remove Tiles from Tilemap
// Only testTile is drawn for test
// private void SetTorsoTile(Vector2Int position, TileBase tile) =>
// torsoTilemap.SetTile(position, tile ? testTile : null);
torsoTilemap.RefreshAllTiles(); // test
faceTilemap.RefreshAllTiles(); // test
dirtyObjects.SetDirty();
The extension method SetDirty enumerates through every Object and calls EditorUtility.SetDirty on it.
To ensure, RefreshAllTiles is called in Update. The issue happens in both edit and play modes
Tilemap's Tiles disappear randomly on Undo
How do I do that?

How do I spawn a skinned mesh renderer on a character?
I need to make randomized outfits
Hey, if anyone could help me out a bit Im trying to make a computer terminal in my game but Im attempting to have a UI element always be selected even after giving input
Unity's eevent system concept of "selected" is often pretty limited for anything except the most basic use cases. What are you trying to accomplish with this? It's often better to build your own system depending on the needs.
AddComponent
Im making a terminal where the player can approch (3D space) and interact with "E" to focus on the terminal, while focused I only want an Input field to be selected so all the player has to do is input numbers. The issue Im having is that when I finish inputing some numbers the inputfield goes back to being Unselected and Its just a little awkward
Thank you for this incredible insight, Navarone
But I am asking about how to make it work correctly. My character has a rig, and the skinned mesh renderer will not deform itself correctly until it has the right bones
But these bones are all very random, I don't want to do a loop searching for the same name of bone by string (yuck). What is an alternative?
so maybe try not to be so vague asking you probably wont get a vague answer? ๐คทโโ๏ธ
Okay, sorry for that
I had asked several times before with no response and got tired of typing
You know you can just copy and paste previous question too
It sounds like the server would not like it
Its okay, we are here now
I follow this tutorial here where he just uses the already assigned bones on the prefab character to spawn and assign the new one. I do not know why he does this, it removes the point of instantiating a new one.
https://www.youtube.com/watch?v=nSmEirb8JGM
โ
Modular Characters 50% OFF! https://cmonkey.co/synty_modularfantasy_charcustom
๐ Get the GameDevTV Code Monkey Bundle! https://unitycodemonkey.com/courses.php
๐ Learn Unity, Blender and Programming Patterns, from Beginner to Advanced!
๐ Click on Show More
๐ฎ Get my Steam Games https://unitycodemonkey.com/gamebundle
๐ด RELATED VIDEOS ๐ด
How to SW...
(14:12)
I would probably just not use an InputField for that.
or just disable anything related to selection for it
ohh yeah codemonkey doesnt explain things well. Ill take a look when I get back if anything
Thank you
I understand what is happening, just why is my question
The idea here is to spawn gear in runtime.. but you need reference to the right bones with the gear already on the object? Pointless
yeah not sure because I havent dealt with bone based customizations yet :\
How can I disable AssetPostProcessors for temporary?
!code
๐ 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.
I am trying to do my own implementation of the marching cubes algorithm. I think I am close, and some triangles are generating, but something has gone wrong somewhere along the way and I am kind of stumped. Anyone else see what is wrong here? https://paste.ofcode.org/GxHrk2bvzcSpSMvXKShPfd https://paste.ofcode.org/39cKH6B7CuqF8QhE4dFsDwu
Here is the result using a box collider
If you're working in WebGL, can you not use async/await at all?
you can use async await
you can't use threads
And this is a limitation of browsers themselves, less so Unity?
Ah kk. In that case I'm using a library to make a call to Parse Server.
https://github.com/parse-community/Parse-SDK-dotNET
Is there anything to keep in mind when making a web request from within Unity? Should I wrap this in a Coroutine so it has a similar flow to the UnityWebRequest documentation?
I assume the logic here is that I want to keep code executing at specific points within Unity's execution cycle. If I just do raw async then who knows when the code completes? Wrapping it in a coroutine at least lets you resume at a controlled point?
just curious why are you using this for ?
wdym it completes when you get past the awaits lol
async Task Something()
{
await Task.Delay(2000)
//done
}
similiar to how some coroutines operations can be stored in AsyncOperation you can store something in a Task for checking later
Task task = Something();
if (task.IsCompleted)
{
//done
}
Right but if I called the method Something without the await keyword, and Debug.Log("Hello") was after Task.Delay, then I don't exactly know when that Debug is gonna go off, right? Like swap Task.Delay with some API call. Who knows when that'll come back.
Check Unitask it mix of async and Coroutines
why would you call an async method synchronously , defeats whole point of async no?
Has anyone got an easy way to apply the rotation of arrow to the direction RootPhysicBody is forced? It's probably a pretty basic question but I just can't see how to do it
Is it not the same with Task.Run?
arrow.transform.forward = vector3;
Task.Run can be await because it returns a task but also can be a fire and forget
Ok I think I'm getting lost in the weeds here. I am making some Web Request. I don't know when that data is coming back because the internet is a series of tubes. How do I make Unity (assuming I am building for WebGL) happy while making sure I don't lock up the game? Do I wrap it in a coroutine and check task.IsCompleted? That looks similar to the UnityWebRequest flow.
yes exactly if you're using Unity imo its better to stick to coroutines because unity manages them better, but async works totally fine
the ugs sdk from unity is all async and task anyway
but WebRequests i would use inside unity
also you can use the observer (events) pattern here to alert you when something completed
Ok I'll wrap it in a coroutine then. I do want to ask for my own interest though. Why bother with a Coroutine? Why not just use the regular async/await flow?
there are a few caveats that need to be addressed thats why unity came up with the Awaitable class, this video explains better than I could
https://youtu.be/X9Dtb_4os1o
In this follow-up video, we explore the Awaitable class introduced in Unity 2023.1, which aims to improve asynchronous programming workflows.
See part 1: https://youtu.be/WY-mk-ZGAq8
Topics Covered:
- Learn about the new Awaitable.WaitForSecondsAsync, NextFrameAsync, EndOfFrameAsync & FixedUpdateAsync.
- Learn about cancellation tokens and s...
I've seen this video, and it seems to deal mostly with how Tasks don't really bother following Unity object life cycle rules.
Object was destroyed? Don't care.
Editor exited play mode? Don't care.
yeah basically thats why it mostly works fine
Check Unitask it has both functionality coroutines and C# tasks
now days, is it really worth the hassle of managing another library in your project
I think I only used Unitask once though so I cannot speak from xp ๐
I used it in production project to fix bug that wasnโt possible to fix it by C# tasks
wasn't awaitable class basically made to merge this gap and pretty much make libraries like that kinda moot?
Tasks is much clear in code than coroutines but coroutines can do much more because they are native to Unity 3d thatโs why I use Unitask since that bug in my each new project
Can someone confirm that setting a rigidbody to kinematic will also set its accumulated forces to a weird value ?
No idea - but accumulated forces won't have any effect on a kinematic body
Easy to test.
Wdym "easy to test"...? The entire point is to know if that weird behaviour happens on someone else's project
Of course I know they won't have any effect
easy to test. Set it up. Apply some forces, print the accumulated forces, set it to kinematic, print them again
see what happens
I did, and it sets them to a weird value, as written in my first message.
I'm asking for help to see if the same behaviour happens on another computer
Hi guys,can u send ur favourite videos on how to make a game menu?I am making a 2d game for android if that specifies the type of menu
did you need to crosspost this in a code channel ?
You should show what this weird value is, and also the code/setup used like if this is 2d or 3d if you're expecting anyone to put effort to copy your setup
guys more people could see it
And it s kinda relevant to code as well ig
crossposting is not allowed #๐โcode-of-conduct
Any idea if Muse Animate will be released for Unity 6 anytime soon?
The prerelease is available via the com.unity.muse.animate package. Also - not a coding question.
coding UI question: so I have an upgrade screen and I disable the upgrade button if the player uses it which works well enough, but then I can't really navigate past that button to other buttons because it's disabled. How do people normally handle something like this? Just don't disable buttons and I guess make sure my 'if statements' check for contingencies?
why can't you navigate past it? ๐ค
I believe because it's disabled. Here's a picture of the upgrade screen in question. Mouse and keyboard work fine. It's more of a controller issue. The controller - through the event system can't really see the next button over from a disabled button, at least that's what I think is happening.
if shield 1 is selected, the controller won't go to dash 1 if sword 1 is disabled
are you disabling it or setting it as inactive?
also if the keyboard works the controller should work
they use the same system for navigation
sorry, mouse works, not keyboard/controller
I'm setting interactable and enabled to false
it should only be interactable = false
not enabled = false
ok, I'll try that. Thank you
I'm back at it again with more questions ๐
I just set up a little script for referencing an array of skinned mesh renderers with the intent to change every renderers material emission as one, using a coroutine like so:
public IEnumerator Emissive()
{
yield return new WaitForSeconds(0.1f);
float tts = 1f;
float timeElapsed = 0;
Color toHitC = Color;
Color CurrentC = CurrentColor;
float tempR;
float tempG;
float tempB;
float tempA;
Color tempColor;
while (timeElapsed <= tts)
{
tempR = Mathf.Lerp(CurrentC.r, toHitC.r, (timeElapsed / tts));
tempG = Mathf.Lerp(CurrentC.g, toHitC.g, (timeElapsed / tts));
tempB = Mathf.Lerp(CurrentC.b, toHitC.b, (timeElapsed / tts));
tempA = Mathf.Lerp(CurrentC.a, toHitC.a, (timeElapsed / tts));
tempColor = new Color(tempR, tempG, tempB, tempA);
m.SetColor("_EmissionColor", tempColor);
timeElapsed += Time.deltaTime;
yield return null;
}
CurrentColor = Color;
yield break;
}```
is there a way I can group every material into one list and modify that? Currently m is just a single material which is no good.
yes... exactly as you said. Put them in a list or an array
loop over it
you can lerp colors with Color.Lerp btw ๐
How exactly would I get the materials from the SMRs in a list though?
Well you have a list of the SMRs already no?
Just iterate over that, no?
I did not know that, a friend just explained how through the method I have now. I'll have a look at that later on ๐
tempColor = Color.Lerp(CurrentC, toHitC, (timeElapsed / tts)); < replaces all 5 lines
Hmm, not sure I'm familiar with that
you're not familiar with.. iterating over lists?
Nup
for/foreach?
just a for/foreach loop^
I've used foreach loads, not all that familiar with it
foreach (var item in list) {...}
yeah you should really look up the basic loops of C# ๐
If smrs is already a list then I'm not too sure how I'd get like, smrs.materials, if that makes sense
foreach (SkinnedMeshRenderer smr in smrs) {
Material m = smr.material;
}```
I think I stopped watching tutorials just before stuff like that ๐
Only time I use foreach is when I'm getting a specific component in an array of other components, not materials on components
literally the same thing
Ah
I was doing a stupid
Thank you 
you should really go further into basics of c# then, loops are really like week one stuff.
Does that set m to be every material or just the latest one?
That'll hopefully be the last stupid question
The code in the loop runs once for each renderer
each time it runs, it's the specific material for that specific renderer
If there are 5 renderers in the list, the code will run 5 times
and m will be each of the different materials, in turn
only one at a time
"for each", it's straight up english
Is there a way to have all of the materials be one list that I can just modify with setColor?
i don't see how that would be any different than this
you would then just be writing a foreach loop over that list
and do the same thing you do here
you can make a utility function that just executes the loop and use that utility function ๐
You seem to have some idea that a list is "all the things at once", it's not. It's a collection of individual things
yes and this utility function would... again, just be a for loop over the list lol
If I start the coroutine each time it loops will it lerp the emission of each material in the way I think? I am watching a video on loops right this second
After I change Material m to m, that is.
Since Emissive doesn't take a parameter, it will start that many coroutines but they're not going to do anything to the particular material m there
you're ignoring the variable
you would want to pass m into the coroutine as a parameter
really though, you should pass the whole list into the coroutine
and put the loop inside the coroutine to loop over them all each frame
Yeah i know, just so he can have it out of the coroutine, and have his one pretty function he asked for ๐
Noted ๐
I will remove the wait, the full coroutine will be in a separate DLL
Thank you both!
by the way - just one last note here
If all the SkinnedMeshRenderers are using the same material, you don't even need to do this really
If you just get the material as sharedMaterial or reference it directly from the inspector, you could just modify the one material and they'll all be affected
Currently, my friend is still modelling everything and I expect it will be using more than one material
One material would be preferred and I'll make a note of this though, if I can just do that it would be far easier ๐
Oh and a note from me too, if you want to use SetColor directly on the List you can utilize Extension methods:
using System.Collections.Generic;
public static class MaterialListExtension
{
public static void SetColor(this List<SkinnedMeshRenderer> list, string name, Color color)
{
foreach (var skinnedMeshRenderer in list)
{
var m = skinnedMeshRenderer.material;
m.SetColor(name, color);
}
}
}
this way you can call list.SetColor("_EmissionColor", color); directly
but yeah not going to get around using loops ๐
I am going to save this.. I see it becoming very useful
Ah hang on, does this lerp or just instantly flip to the next colour?
Looks like it'd only flip to the colour
yes you need to lerp the input color and call that function every time you make a new step on that lerp
Can somebody help me with water
The low gravity zone is very slim, only a slim zone on the surface of the water. How can I change that so that it is always under it?
What does that even mean?
nvm I fixed it myself
bumpa
need help for spawning the skinned mesh renderer on a player in runtime
@raw token hello
I have python programming background and im new to unity and C#. I am following youtube tutorials on making a 3D fps game. I am trying to figure out the falling/dying + respawning part right now
I tried some forums and it didnt work
This is the code for my trigger
player have rigidbody
trigger has rigidbody and box collider and I checked the box IsTrigger
im not sure what I did wrong, but from what I understand, player.transform.position is the variable that holds the player position, transform is the category and position is under the transform category. By setting it to equal the respawn point I can teleport to the respawn point. I also tried setting it to a vector3 and it also didnt work
The camera should follow the player right? would it be that im just setting the gameobject player to respawn but the camera falls through?
for future reference, you should paste the code instead of screenshots
also your IDE does not look configured ๐ค
I can't even tell from this screenshot which one is the player
why does the respawn trigger have a rigidbody with gravity
I did tell them about that in #๐ปโcode-beginner
I told them to do the vs code link, so I hope that is right haha
ahh crosspost, very nice
only judging by colors rn does not look like it. at minimum classes should be green
Hi, when I try open the editor, I get this message
The GUID inside 'Packages/com.unity.services.levelplay/Editor/Analytics.meta' cannot be extracted by the YAML Parser. Attempting to extract it via string matching instead. Please verify the file does not contain unexpected data. how can I fix this please?
I am working on procedural terrain generation in unity using the unity job system
I am able to get 200+ fps in 5000 sqr unity unit map which is divided in 1600 chunks and per chunk 75 subdivision which is total 54 million tris , in order to optimise the rendering I added culling which will render depending on the distance and view angle ...
Similar results are in larger maps too.
|| Is it something great? IDK what you guys think ||
I tried both classic perlin noise and simplex noise from the mathematics Library and was able to notice 2 to 10 fps difference.. (snoise is more performant)
Currently the world is generated using simplex noise
||System specific in case
i3 9100f - 4 cores 4 thread
16 GB 2400 mhz ddr4 ram
Amd rx560 4gb GPU
||
You need to add tesselation base on distance as well.
Also, you should post in #1180170818983051344
Something like Level of detail?
Sorry for that, should I delete and repost it?
Search what is dynamic tesselation. Unity Terrain does that.
No need to delete, but if you have any update you should create a post there
I see
hello, sorry, i'm french and my english is not very good, where can i find a help for a script in unity and, i don't understand "privileges" in a unity forum, thanks for your help and again sorry ๐ฅด ๐
you can ask for help here. just be sure to check #854851968446365696
the forums are currently readonly since they are being migrated to the discussions site in the next few days
oh okay, thanks, but, you know the "privileges" for can read a help in the forum unity ? i could write before, but now, i don't can because i don't have "must privileges", i very don't understand
i just said why that is happening. the forums are currently readonly because they are being migrated to the discussions site.
#๐ขโannouncements message
ho sorry, i think your post it's for a discord discussion ๐
what? i am referring to the unity forums site which is currently set to read only. you cannot post on the unity forums site because it is read only now. this is due to the migration to the discussions site which is taking place over the next several days
ok, i understand, very thanks for your help and, sorry for my not understand your latest post ๐
you know help me for bug in video game 2D by chance ?
it's complicated, i'm new in the server, and my english is not perfect, so it's very not simple, i need to descripting my bug for you (it's i understand๐ ) ???
use a translator service if you do not understand.
yes, i use since before ๐
so i go to the #๐ปโcode-beginner because i'm beginner and i need help ?
it's logic in fact...
you need to actually describe your issue using the guidelines provided in #854851968446365696
ok i search
ok, i take a screen-shot and descript my problem, but, i don't have error script, look, my screen shot and the description please (thanks for your patiently)
my problem is :
my player stay hang of my wall when i go against in my wall, you know why and how to repar that bug, i don't very know how explain that problem becaus i don't know where is the problem source๐
Get rid of sticky walls in 2d platformers. Very easy and simple fix.
โ
Get my courses with discount:
๐ Unity 2D Master: https://www.udemy.com/course/unity2dmaster/?couponCode=SMOOTH-2D-MASTER
๐ Unity Mobile Course: https://www.udemy.com/course/unitymobilecourse/?couponCode=SMOOTH-MOBILE
๐ Unity Input System with Rebinding: https://www.udemy.co...
Trying to make a platformer in Unity3D? Rigidbodies keep sticking to walls? This could help! :)
Wishlist my new game, HexLands now! โค https://store.steampowered.com/app/2244650/HexLands/?utm_source=yt&utm_content=rigidbody
Join our Discord community โค https://discord.gg/6hKwSaCkwa
Some of you may also faced this problem when you were trying to ...
Do not know if they are talking about it in the video, but you can also RayCast/BoxCast before moving to prevent the player from moving if they would get in the wall.
very very very thanks, sorry, i've 16 years hold, i'm French and learn solo since 4 months, i've create very project for learn physics 3D, but 2D it's very different ๐ ๐ ๐
ok thanks for your advice ๐
I really recommend you to work on your English. Almost all resources are in English.
i know, it's very important for me, because i've a problem for learn a Language, but speak in English and read English every moment, it's cool for learn, that get used to speak English ๐
May I suggest you use Google Translate but in reverse, English-> French. Type in English, when it makes sense in French then it probably makes sense in English as well
yes i think too, but i writ in English without Google Translate, because i know about writ in English, but read it's must difficulty, because your vocabulary is must richer than mine
but your English is not good and it makes understanding you very difficult
sorry ๐
i know, i learn again ๐
and i very not first in my class room for that matter๐ ๐
Ne pas
not ?
sorry, hit enter.
ne pas problรจme
ok (ne ... pas = not ) (it's French) ๐
pas de problรจme*
my bad, I'm thinking in 4 languages at the same time, I get confused
@everyone
I am getting pink screen in AR webgl project on running camera
luck, my best language it's English (after a French because i'm French)๐ ๐
I am getting pink screen in AR webgl project on running camera
Anyone please suggest to correct this
has you a folder of your project (sprit and texture) ?
not a code question and pinging everyone is not a good plan
yes...
@barren edge I am building in urp and getting error
not ping please ! #854851968446365696
ok, it's 3D or 2D ?
WebAR
i don't know what is it, sorry, but, please, read #854851968446365696 for know the rules of the rooms ๐
it's a program Web ? search with #๐โweb , they can help you
#๐โweb
#๐โwebgl
#๐โwebar
I am getting pink screen in AR webgl project on running camera
Anyone please suggest to correct this
I told you this is not a code question. Please remove your post from here and post in the correct channel
Kindly share correct channel
you can use #๐โfind-a-channel to find the correct one but I suggest #๐โweb or #๐ฅฝโvirtual-reality
Hey, does anyone know how I can reference a variable in a script that is in Assembly?
Assembly has no concept of variables, so no. Your scripts also cannot read registers directly if you want to do that you need to use assembly and copy that data into a memory address a c# script can read.
they probably meant that the class that contains the variable is in a different assembly
and in that case they need to read the documentation for assembly definitions
I wanted to refer to SaveContainer, it is a public static variable, the script is in the Assets/Scripts folder, I did not add any assembly there
The script from which I want to refer to it is in assembly
if SaveContainer is in the Assembly-CSharp assembly but you are working from a different one, then i will refer you back to this: https://docs.unity3d.com/Manual/ScriptCompilationAssemblyDefinitionFiles.html
Ok thanks, I'll check this
How come I'm getting a nullreference exception at line 50 when I try to access the width and height of the texture2D? https://pastebin.com/fTgELayY
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
If I set the hotspot of the cursor as Vector2.zero the texture replaces the current cursor with no issue, though
Which means somehow accessing the texture itself is fine but not its width and height?
Its hard to fix something if you dont exactly know the problem, try logging some stuff and see which one is null
you don't assign to shootingCursor until after you attempt to use it (which means it never gets assigned since the NRE causes execution of that method to stop before it has been assigned)
Omg can't believe I missed this
Thank you

for future reference, check this out for how to solve a NullReferenceException: https://unity.huh.how/runtime-exceptions/nullreferenceexception
there was only one object on that line that could have been null, so it was simply a matter of seeing where that method was being called from since the null object was the parameter passed to it
Aye aye ๐ซก
/* Component Classes */
public class B : A {
public override void onFoo() {
Debug.Log("Foo B");
}
}
public class C : A {
public override void onFoo() {
Debug.Log("Foo C");
}
}
/* Parent Class */
public class OpSys_Clickable : A {
public virtual void onFoo() {}
}
/* Finder */
A findComponent;
foreach (RaycastResult i in results) {
if (i.gameObject.TryGetComponent<A>(out findComponent)) {
A.onFoo();
}
}```
If I have a structure like this, where I have a GameObjects with B/C scripts added as a component, is there a way that I can easily find all items that inherit class A and trigger their overwritten methods instead of looking for each instance of a B/C/etc?
that would be how
GetComponents<A>
Assuming it can have multiple
when you have a reference to an instance of type B stored in a variable of type A and call a method that has been overridden, it will run the override version fo that method
If each only has one then just a regular TryGetComponent works
it's only when you hide a method, such as with the new operator that it wouldn't do that. so for this:
public class A { public void Foo(); public virtual void Bar(); }
public class B : A { public new void Foo(); public override void Bar(); }
A a = new B();
a.Foo(); //calls the Foo method defined in class A
(a as B).Foo(); //calls the Foo method defined in class B
a.Bar(); //call the Bar method overridden in class B
can somebody help me with cosmetics in a VR game
this is a code channel
so wheres the help with VR cosmetics channel
i cant even talk in there ๐
alright thanks everyone, it wasn't triggering so I suppose there's some other problem with my code I gotta figure out
note that RaycastHit.gameObject would refer to the gameobject with the Rigidbody on it if it has one, if you are trying to get a component from the gameobject that has the collider (if it is a child of the rigidbody) then use the hit.collider
how about you put literally any amount of effort that isn't 0 into getting help for your issue instead of making everyone else do the thinking for you. finding the correct channel is literally brain dead simple if you just read the information provided to you
i did read it but I cant find a help with VR channel or cosmetics.
then you didn't read it
that depends, is your "VR cosmetics" question related to vr?
yeah
then what do you think
this all coudve been avoided if u js tagged #๐ฅฝโvirtual-reality
there are so many ways to handle dialogue there isn't really one "great" answer to this. I'd look into some of the popular dialogue system assets to see how they handle it.
though personally I would do something crazy like build a node based editor that allows me to create nice dialogue trees that i can then serialize to use in my code
this also could have been avoided had you put any thought into what you were doing instead of crying about how i wasn't spoon feeding you the answer to where you need to ask your question when i provided the common resource for searching for the correct channel
it aint spoon feeding, its being helpful.
that likely won't scale very well tbh, if you end up with complex dialogue trees, trying to find the correct scriptable objects in your assets folder might end up a nightmare
okay, next time you ask for help i'll be sure to get the bib and high chair ready so you'll be prepared to receive my answers
being helpful is showing you how to find the answer. Spoonfeeding is giving you the answer. So yes, it is spoonfeeding
or maybe js talk to me like a normal human instead of being passive aggressive in every message you send.
nobody invited you, steve.
you can stop dragging this shit on and go ask your question in the correct channel now instead of continuing to be a complete nuisance
I don't need to be invited to correct your misconceptions
i already did
congrats, your question had nothing at all to do with vr!
your issue is not related to it being vr in any way. it is just a question about parenting and positioning objects.
yes but its in a VR game
Either way it's unrelated here. You can leave it in #๐ฅฝโvirtual-reality and wait for an answer.
No need to keep this whole thing going.
Is gone because I've answered it.
but i dont wanna leave it in #๐ฅฝโvirtual-reality if its not the correct channel
It's fine, you can leave it there. Move on, this conversation is beyond unecessary at this point.
Is it a better implementation if I have a manager script that gives my homing missiles targets or should I put the logic on the missiles themselves, practically does it make a difference?
Practically it makes no difference. Organizationally, it's probably cleaner to provide the target to the missile from the thing actually tracking/doing the firing.
And then let the missile store the target and work the results on its own.
Where do i find the Client Secret (I have bought a Google Play Dev Account and made the app but i cant find the Client Secret)
did you google it
yea
so did you look where it says to look?
yea but there was only the Client ID not the Client Secret
iirc it gives you a json you were supposed to download with the sceret
havent touched google stuff in a while
when you created , pretty sure it gives you client secret too
no it did not i tried to look
the guides i saw on the website say you do idk.
this is more of a google question than unity code question
yea well idk where else to ask since i need the Client Secret for my unity game
Idk how to setup Google Play Games Login
so read the manual
its missleading since google remove the client secret
google for ya
their unity sdks are hot garbage
Unity has these instructions for their own Authentication login, but who knows if its the same still
https://docs.unity.com/ugs/en-us/manual/authentication/manual/platform-signin-google-play-games
Donโt trust web devs to make game stuff
Imagine a world where you can just assume you have infinite resources. Imagine giving people in that world a tool that makes it easy to solve easy problems. Imagine what happens if they use that tool to solve difficult problems.
I found out that you needed to make a web OAuth client ID for getting the Client Secret and it should have been in the docs
it says that though lol
is just you have to actually read and click the right spots
1.https://developer.android.com/games/pgs/unity/unity-start
but yeah they dont specify anything about generated keys/secrets and you kinda have to already know how these things work
google really doesn't gaf about unity anyway
they make so much money with their own services this is chump change
Is it common for prefabs to have an inactive RigidBody which is then activated later instead of adding the rigidbody when something happens?
Rigidbody does not inherit from Behaviour so it cannot be enabled/disabled. at best you could make it kinematic, but that isn't the same as disabled
You usually simply have a Rigidbody on prefabs and don't change it throughout the game
Note that Rigidbody is not running on a prefab if it's not spawned in the scene
right right, I had a problem where I needed something similar to that but I found out that addign the componentwhen I needed was simpler
The only reason I don't have rb on the prefab in the first place is that I wanted it to move with its parent
And when it later detaches I add the rb component via script
Is this an acceptable way of doing things or nah
You rarely add anything
hmm i see
Although, cannot answer the question without more information provided
How would you solve this then with an rb component?
If it moves if its parent, it doesn't need its own Rigidbody
Well, it rarely does
I see, in my particular case I wanted the child to detach later, which is why I added rb via script if that makes sense?
The thing, which comes to my mind, is a moving arena with the player as its child. Both have Rigidbody. The player can move on its own, and also moves whenever its parent, arena, does
Yes, it does
yea well i could not find it
guys, i'm trying to implement unity IAP in my project, in the test unity it works very well with the products i've registered for testing, but when testing in a production environment, UnityPurchasing is not initialized, i'm running UnityPurchasing.Initialize(); but it doesn't give me feedback if it failed or if it initialized and i simply don't have information about the products.
now read what you have written and ask yourself 'could I help some one with only that information?'
if anyone has ever been in the same situation, yes
you are a better man than I, you don't even say what build target you are using
My Authentication does not work
using System.Threading.Tasks;
using GooglePlayGames;
using GooglePlayGames.BasicApi;
using Unity.Services.Authentication;
using Unity.Services.Core;
using UnityEngine;
public class GoogleIntegration : MonoBehaviour
{
[SerializeField] GameObject gameManager;
[SerializeField] GameObject mainScreen;
[SerializeField] GameObject loadScreen;
public string GooglePlayToken;
public string GooglePlayError;
private async void Start()
{
await Authenticate();
}
public async Task Authenticate()
{
PlayGamesPlatform.Activate();
await UnityServices.InitializeAsync();
PlayGamesPlatform.Instance.Authenticate((success) =>
{
if (success == SignInStatus.Success)
{
Debug.Log("Login with Google was successful.");
PlayGamesPlatform.Instance.RequestServerSideAccess(true, code =>
{
Debug.Log($"Auth code is {code}");
GooglePlayToken = code;
});
gameManager.SetActive(true);
mainScreen.SetActive(true);
loadScreen.SetActive(false);
}
else
{
GooglePlayError = "Failed to retrieve GPG auth code";
Debug.LogError("Login Unsuccessful");
}
});
await AuthenticateWithUnity();
}
private async Task AuthenticateWithUnity()
{
try
{
await AuthenticationService.Instance.SignInWithGoogleAsync(GooglePlayToken);
gameManager.SetActive(true);
mainScreen.SetActive(true);
loadScreen.SetActive(false);
}
catch (AuthenticationException ex)
{
Debug.LogException(ex);
throw;
}
catch (RequestFailedException ex)
{
Debug.LogException(ex);
throw;
}
}
}
Its authentication for Google Play Games i have it installed at setup right with the client Id and things like that and no errors
!code
๐ 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.
yea well it fit on discord thats the authentication script
Steve is right. U need to say is it for Android or iPhone.
and, well yeah, large code is > 4 or 5 lines
fair but still it does not work
im sure this is a stupid question but does anyone know why this is getting a null refference exception
//Check if object is interactable
if (hitInfo.collider.gameObject.TryGetComponent(out IInteractable InteractObj))
{
// If Tooltip Is Text Get Tooltip And Assign it To The Tooltip's Text
if (useTooltipHUD && InteractObj.Tooltip != null)
{
tooltipText.text = InteractObj.Tooltip;
}
//Set The UI Elements As Active
TooltipObject.SetActive(true);
UpdateCrosshair(InteractObj.CrosshairIndex);
//Check for input then interact
if (inputDown)
{
InteractObj.Interact();
Debug.Log("Player Interacted with: " + InteractObj.ToString());
return;
}
}```
what line?
sorry let me double check
the first if statement
so what happens if nothing is hit by the raycast
then it is obvious the raycast hit nothing
can i make it so if it hits nothing its false?
its 5am ive been up all night
and my googling isnt helping
what does Physics.Raycast return?
what do you think Physics.Raycast returns ?
that makes alot of sense im sorry like i said im tired i think ima just try and do stuff tomorrow when i have a functioning brain ๐คฃ
public SceneAsset sceneName;
I get this error on VisualStudio but not on Unity: The type or namespace name 'SceneAsset' could not be found (are you missing a using directive or an assembly reference?)
This is ... irritating ๐
regenerate project files
Cool, thank you! ๐ป ๐
I get it, it's because when I will build the game the UnityEditor reference get lost!
well no, the issue was likely just that your editor didn't actually create a csproj file for the UnityEditor assembly and regenerating project files forced it to do so
So I will replace SceneAsset with public UnityEngine.Object sceneName; and I'll grab the name
but if that code isn't for editor-only stuff then you'll need to change that because SceneAsset does not exist in a build
Oh.. ok I get it, anyway the error pops out again after a few minutes.
did you restart visual studio after clicking the regenerate project files button?
yes, I closed it, regenerated the project files and restarted the editor.
Anyway I've fixed it by changing the type ๐
What's wrong with Application.targetFrameRate?
When I set 60 I've got 45 (in my 90HZ android)
When I set -1 I've got 30
When I set 90 I've got 70+ (good)
Optimized Frame Pacing is turned off
vsync is 0
Hey, is it fine to wrap the method in the UNITY_EDITOR condition?
#if UNITY_EDITOR
private void MyMethod() { }
#endif
Project for Android
Unity version: 2022.3.19f
Registered products are of the consumable type, below is a print of one of the registrations and a code snippet where I try to initialize UnitypPurchasing
yes, why not
When calling the wrapped method inside of the code, not wrapped in this conditon, is it just not called?
Yes, but make sure all places where you call this method are also #if'd, otherwise you'll get compilation errors.
You can also use #else to stub one out on build
#if UNITY_EDITOR
void Method()
{
// Editor implementation
}
#else
void Method() { /* empty */ }
#endif
it will not compile in this case
Got it, thank you both
Anybody know the syntax for referencing a sorting group component for 2d?
You need to configure your !ide beforehand
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
Once done, errors will be underlined red, and you'll be able to invoke quick actions to fix this error for you
Do not skip this step, it is a huge help, and also required to get help here.
Wow, I wish I knew that 3 years ago
i'm trying to update these Hosting fields through code, but if I iterate (both for or foreach loops) them and update the Hosting field to a new value, it does not seem to update at all. Is it needed to rewrite the array for updates? (During playtime, not in editor)
Are the elements here structs?
yes, indeed, i was just thinking, i most likely have to write the entire struct again right?
During iteration, you most likely accidentally create temporary copies of them. It's because when you assign a struct to a variable it assigns its value, not reference.
The easiest way of dealing with this problem would be changing this struct to a class. Another solution is to make sure you always refer to the struct's value directly.
cool, yeah making them by ref would be ideal because rewriting these array items would be a pain
thanks, changing the struct to a class worked ๐
Im trying to make a zero g player controller (like outer wilds) with fully axis independent movement. I need camera lerping for the smooth feel. Heres what I tried, but when the player goes upside down, the controls are inverted.
Quaternion yAxis = Quaternion.AngleAxis(pitch, Vector3.right);
Quaternion xAxis = Quaternion.AngleAxis(yaw, Vector3.up);
transform.rotation = Quaternion.Slerp(transform.rotation, xAxis * yAxis, drag * Time.deltaTime);```
Here is a sample code as an example to what I've written earlier:
struct Test
{
public int x;
}
Test[] tests = new Test[4];
void Start()
{
int count = tests.Length;
for (int i = 0; i < count; i++)
tests[i].x = i + 1; // It will update structs in array
for (int i = 0; i < count; i++)
{
var test = tests[i]; // It will create a copy of structs from the array
test.x = i + 2; // It will modify a copy of structs from the array, but won't modify original structs
}
}
That sounds like a movement issue rather than anything to do with your camera code. Is your movement supposed to be relative to the player, or to the camera - and does your movement code reflect that accurately?
oh the camera control - gotchya ๐. Looks like Steve has a better idea for you in #๐ปโcode-beginner
yeah i see! i must have done that var test = tests[i]; // It will create a copy of structs from the array when i was testing with the for loop that i thought would avoid creating a copy. I might actually switch back to structs instead of the classes and apply this fix
you have any ideas?
if anybody reads this later and wants to know how to do it, it like this for keeping the ref to the struct
for (int a = 0; a < AttachTo.Length; a++)
{
for (int t = 0; t < AttachTo[a].type.Length; t++)
{
for (int h = 0; h < component.Host.Length; h++)
{
if (component.Host[h].attachmentPoint != other.transform)
{
continue;
}
for (int ht = 0; ht < component.Host[h].type.Length; ht++)
{
if (AttachTo[a].type[t] == component.Host[h].type[ht])
{
Debug.Log($"Found compatible attachment {AttachTo[a].attachmentPoint.name} on {gameObject.name} to {other.transform.name}");
Attach(ref AttachTo[a], other.transform, ref component.Host[h]);
isAttached = true;
return;
}
}
}
}
}
I'm pretty rusty across the board... but are yAxis and xAxis just floats for your input?
ah right ๐
I'm much rustier than I thought. But I'll play with it a bit. I think Steve was on the right track - it seems like the rotation needs to be made relative to the player's current orientation rather than working in world-space
thats what i thought too, with the Space.Self in the transform.rotate
i just cant find a way to do that with quaternion.angleaxis
I wonder if you could just like
transform.rotation = Quaternion.RotateTowards(
transform.rotation,
transform.rotation * Quaternion.Euler( pitch, yaw, 0f ),
drag * Time.deltaTime
);
What's wrong with Application.targetFrameRate?
When I set 60 I've got 45 (in my 90HZ android)
When I set -1 I've got 30
When I set 90 I've got 70+ (good)
Optimized Frame Pacing is turned off
vsync is 0
Is this a desktop app?
https://docs.unity3d.com/ScriptReference/Application-targetFrameRate.html
Because Application.targetFrameRate causes frame pacing issues on desktop, if you are targeting a desktop platform, use QualitySettings.vSyncCount instead of this property.
Note that platform and device capabilities affect the frame rate at runtime, so your game might not achieve the target frame rate.
I test in on my android device
I don't get reason of this issue. I used it all time before and have no problem, but now Optimized Frame Pacing was added and etc.?
Not sure, this might not be a code question but rather a feature question. You likely get better support in #๐ปโunity-talk or #๐ฑโmobile than here.
Is there a good way to detect this sort of scenario? The character's circle collider on the corner of a square collider? I have some code to provide a little boost if moving to the right in this situation so you can climb onto the ledge instead of getting stuck on the corner, but right now I'm doing this with like, sending down a ray from each side of the character and testing distance and that's pretty gross and doesn't work in certain situations
I'm using the same raycasting technique to detect the slope of whatever ground I'm on and I assume there's gotta be a better way
a good way of getting a lot of information with only one cast would be using CircleCast, assuming you're in 2D.
Among other things, you get the normal of whatever surface you're on, which you can then use to detect edges and so on. Either testing with angle or dot product with the normal should be what you want to do.
I have a top down game and I made a object transparent but I only want the transparency to be for another specific gameobject is that possible to do easily? Like have it for example when a enemy goes through a powerup it will show the enemy through it but not the lines of my ground
Hi, so I'm completely stumped over an error Im getting exclusively in build. Im working on a sort of music playlist. It works completely fine within editor but when in build, it gives me index out of bounds in the array error
which makes no sense cus it works completely fine within editor
Console points me at this specific part of the code: ```
public void ChangeSong(int trackPicked)
{
//Tracks the clips that have been played and plays in random order.
if (!beenPlayed[trackPicked])
{
tracksPlayed++;
beenPlayed[trackPicked] = true;
playlist.clip = tracks[trackPicked];
curIndex = trackPicked;
playlist.Play();
DisplayTrackName();
//DEBUG SECTION
Debug.Log("Changed track");
}
else
{
playlist.Stop();
}
}
Set a breakpoint on the line that is giving the out of index error and observe the index (int trackPicked) and the list beenPlayed
Its saying that the line if (!beenPlayed[trackPicked]) is the cause
The list beenPlayed has less items than the value of trackPicked when you run the project
This can happen if beenPlayed is not properly initialized or is reset through another script
how is it that there's no error in editor then if this is a problem but only in build?
Set a breakpoint on the line that is giving the out of index error and observe the index (int trackPicked) and the list beenPlayed
There is likely a difference in how beenPlayed is initialized or set
Checking the debug information is the only way to tell for certain why the list access appears to be out of range
how would I be able to observe trackpicked since its not a public variable?
(sorry fairly new to coding)
By setting a breakpoint. Try this:
This pauses the execution of code at a particular line when that line is run
Then, you can observe the value of all variables while debugging
right but then unity freezes up for me so I cant really interact with unity in that state
That is the point
When it is frozen, that is when it is breaking.
You can also set a conditional breakpoint so it only stops when the integer trackPicked is greater than tracks.Count()
When unity freezes, you go into your code editor and observe the line of code that has frozen (as per the intention of your breakpoint) and then you can mouse over the variables to observe their values
ok
So it says trackPicked is 1
beenPlayed[3]
well
Bool[3]
is what its saying beenPlayed is
That should work.
Press continue and wait for it to loop around again.
It should do a loop and come back to beenPlayed when the trackPicked is a different number, and repeat this process until trackPicked is greater than or equal to 3, which should break the code by throwing an index out of range exception
trackPicked = 2
Continue once more, and note that 2 is the highest value that you can safely access the list beenPlayed
As soon as trackedPicked is 3, then the code should break.
Ah, I see your error
tracksPlayed++;
beenPlayed[trackPicked] = true;
It's actually this line
2 is the maximum
But you increment 2 to 3
And then try to access beenPlayed[3] which does not exist
hmmm but that shouldnt be an issue either
That should be an issue
I have this running too at the same time to counter that
{
if (tracksPlayed == tracks.Length)
{
tracksPlayed = 0;
for(int i = 0; i < tracks.Length; i++)
{
if (i == tracks.Length)
break;
else
beenPlayed[i] = false;
}
}
}```
If beenPlayed has 3 items
Then:
beenPlayed[0] is valid
beenPlayed[1] is valid
beenPlayed[2] is valid
beenPlayed[3] is invalid
int trackPlayed = 2;
You enter the main loop checking if beenPlayed[trackPlayed] is valid
beenPlayed[2] is indeed valid
Then you increment trackPlayed by 1, so trackPlayed is 3
Then you set beenPlayed[3] to true, but you can't because beenPlayed[3] does not exist, and this throws an out of range exception.
In this block of code:
if (!beenPlayed[trackPicked])
{
tracksPlayed++;
beenPlayed[trackPicked] = true;
// Rest of code
What happens if trackPicked is equal to the very last item in the beenPlayed array, and the 'if' statement evaluates to edit: true, and you enter the block?
It necessarily throws an error.
Basically. Check whether beenPlayed's length can support the index access attempt
If there are 3 items in beenPlayed, then the maximum index access value is 2, which is beenPlayed.Count() - 1
if (tracksPlayed <= beenPlayed.Count() -1)
{
beenPlayed[tracksPlayed] = true;
}
// Rest of code. Do not attempt to access beenPlayed at an improper index further in this code, such as later when you access another index similarly via playlist.clip = tracks[trackPicked]
how could i rotate an object towards velocity only on the y axis without changing the other values
it makes both x and z values 0
That little vector you made there for "velocityMag"
Use that in Quaternion.LookRotation
why are the borders thicker in some spots? I am using a tiled imaged btw.
Hey guys, I just wanna confirm something- There's nothing bad about putting biome scripts as monobehaviours in the scene, right?
What do you mean by "biome"?
Originally I thought to use scriptable objects, but since I decided that it's better to hardcode each biome's generation code, it feels very wasteful to make a class for a scriptable object if I'd only make 1 instance of it
So the other way would be considering them as a singleton (monobehaviour)
Right, forgot, the reason why I need those scripts to be scriptable objects/monobehaviours is because I want to be able to customize it in the inspector.
Is there a reason subscribing to events within coroutines doesn't work? I can subscribe just fine in the switch case but if I do it in a coroutine I just get a NRE for some reason. (I'm aware it says Event1, not Event. I'm only using that as an example)
It's not a problem, I'm just kind of curious
Basically the context is this:
- I've got a biome system
- All the biomes are different implementations of the same base class
- I want to be able to customize the biome settings in the inspector
- Each biome script only need 1 instance, or be a static class
- What should biome be? A singleton, scriptable object, something else?
What is a biome.
Just a custom abstract class, each implementation generates the terrain in their own way
What do you mean each biome script only needs 1 instance, is this something only for 1 scene?
I'd probably go the scriptable object route, but really you're gonna be plugging these into a monobehaviour somewhere. The scriptable object part just makes it so when you edit values, you're editing the asset and not some random component in a scene. Makes it easier to see in git history for example
Yeah, except having a create asset menu for... For example, the molten lands, is really wasteful if there's only 1 type of molten lands in the first place...
Wasteful in what sense?
Making a button that only ever would be clicked once?
Cus I only need 1 instance of it, ever.
By button I mean something like: 'Create -> Biomes -> New Molten Lands'
So? What resource is it wasting? The user will never see it. You'll never have to worry about it past doing it once
If you dont want the extra assets associated with creating a scriptable object script + instance for its data then simply dont use a SO. it's not some life changing decision here. You're basically choosing between having numbers on an asset, then taking the numbers from that asset, or just directly having them on the component to start with.
Fair enough...
Well, ig I'll go the scriptable object route
The git stuff is indeed a valid point to use Scriptable object... Considering that otherwise all modifications will be counted as scene modifications
The only other way, when using Monobehaviours is have it as a prefab, which would be very much comparable to SO, besides saving extra unnecessary data.
The use case does seem small enough that you could also just put these all in the scene with no issue. If you dont have any specific state associated with each biome during its generation too then you could get away with having 1 monobehaviour and N scriptable objects. The use case does seem small enough that you could even put these directly as monobehaviour.
Though if you ever need to reference these monobehaviours from like a game manager, I find that something tedious to do because now you have to use the find functions or have the instances register themselves somewhere
It happens when the area of an object doesn't allign with the area of pixels. Let's say that the border is 1,4 pixel wide. Since your screen can't split your pixels in half, it has to display it as 1 pixel wide or 2 pixels wide. Also each pixel displays whatever is in the center of the pixel. If some object happens to overlap with centers of 2 pixels, it's displayed as 2 pixels wide. If something misses the center of one pixel, then it's displayed as 1 pixel wide.
nope it should only change the y axis the original x axis was -90
an event has nothing to do with a coroutine, meaning its not related. Null errors are always the same, something is null and you must find out why. Maybe the object was destroyed before this ran
any fix to it?
The object wouldn't have been destroyed, the components attached to it all work fine anyway
Plus I was holding it in my hand while testing
any1 know how to make an icon out of this object but making it not appear like this:
it has the sky in the back even though I culled that out
Make the game pixel-perfect by perfectly aligning the size and position of every object with pixels on the current screen resolution.
๐คทโโ๏ธ i listed it as a possibility as to why you experience it in a coroutine. my statement is still the same, you must find out why the reference is null. I dont see any debugs in your code. You could debug if pierce is null before this coroutine is even started.
alr
Might be a longshot but what if you generated the icon inside of a prefab?
Wouldn't capture anything that isn't part of it
interesting you right i might
I did previously have a fair few debugs, pierce wasn't null and it listed exactly what I expected it to. Its just weird that I get an error ๐
I removed most of the code after I got it working in some capacity
it really isnt weird, you just didnt debug enough of it at the time. if there was an NRE then it is null at the point of you trying to use it.
unless you had other errors in the console (deal with errors top to bottom), theres always gonna be a reason as to why this happened. If unity randomly had these errors, itd be a massive deal. It told you something was null, because it was
how could i rotate an object towards velocity only on the y axis without changing the other values
Easiest solution I know:
Quaternion.Euler(0, Mathf.Atan2(velocity.y, velocity.x) * Mathf.Rad2Deg, 0)
You might need to add or subtract the rotation by PI/2.
Quaternion in a 2d game is really annoying
Eh, wait, it's 3d...
easiest way, create the quaternion, convert to euler and just use that y value
You have to do Quaternion.Euler(0, vel.eulerAngles.y, 0) for that
Eh, ig, it looks much easier
and the x axis is zero it should be - 90
Even though it's converting from quaternion to euler then back xD
you shouldnt rely on reading euler values in the inspector. First, its local rotation and 2nd its converting from the quaternion to show you euler.
Although in this case (-90,0,0) would be pretty different from 0,0,0 i think thats probably due to local rotation
ik
but the x axis has to be -90
Oh, right, reminds me, for my character I just normalize the vector to be flat in the y axis and use that instead
Maybe it gives an extra idea
why, nothing youve shown so far would relate to this
Just make it -90?
also i forgot to say it dosent even rotate at all it just sets the x axis to 0 which is the exact opposite of what i want
i am trying to make procedural animation
Erm, that formula is certainly totally valid...
well yea you copied a solution which sets X and Z to 0, while only using the x and y of the vector. Did you try what i wrote above?
wait let me try
also ...
Ah also, you copied mine directly which used x and y haha
You needed to use x and z
Because you cancelled y out yourself?
So essentially the result is that the formula is working with (x, 0)
Wait... No I'm confused fr
oh wait now it works but it rotates the spline opposite of what i want it to be
i want is to be like this when walking forwad
How to turn it around you think? :)
Eh... Like, if you mean it's 180 deg off, add pi radians to it (Which is essentially 180 degrees)
If you mean it's turning towards the opposite direction, then you just have to add a negative sign to the rotation
ok wait let ad pi radians (sorry for late respons my laptop ran out of battery and shut off i had to plug it in)
