#π»βcode-beginner
1 messages Β· Page 481 of 1
using UnityEngine;
public class RealtimeHierarchy : MonoBehaviour
{
[SerializeField]
private GameObject Scene;
[SerializeField]
private HierarchyFieldConstructor constructor;
private void Initialize(GameObject Object)
{
int count = Object.transform.childCount;
if(count > 0)
{
constructor.CreateField(Object.GetComponent<SceneExpand>().isExpanded, Object.name, Object);
if(Object.GetComponent<SceneExpand>().isExpanded == true)
{
for(int i = 0; i < count; i++)
{
if(Object.transform.GetChild(i).childCount > 0)
{
Initialize(Object.transform.GetChild(i).gameObject);
}
else
{
constructor.CreateField(Object.transform.GetChild(i).gameObject.name, Object.transform.GetChild(i).gameObject);
}
}
}
}
else
{
constructor.CreateField(Object.name, Object);
}
}
private void Start()
{
Initialize(Scene);
}
}
i wrote this code for creating elements in scroll rect that mimics how the real hierarchy works in editor
but for some reason
the loop never break
it just goes on for infinity
i dont know why?
put breakpoint and step through it , see what the values are vs what you expect
my brain is cooked and cant think anymore
thats why i resorted here
thats what debugging is for π
sounds like you have circular logic or initializing the same object over and over somehwere
yea
well we can't debug values for you , start debugging , print name of object being processed, etc
i disabled the initialize again from here
{
Initialize(Object.transform.GetChild(i).gameObject);
}```
i removed it
but still it is showing the same error
sorry my bad
Debug.Log("Processing: " + obj.name);
SceneExpand sceneExpand = obj.GetComponent<SceneExpand>();
int count = obj.transform.childCount;
if (sceneExpand != null)
{
constructor.CreateField(sceneExpand.isExpanded, obj.name, obj);
if (sceneExpand.isExpanded && count > 0)
{
for (int i = 0; i < count; i++)
{
GameObject child = obj.transform.GetChild(i).gameObject;
Initialize(child);
}
}
}
else
{
constructor.CreateField(obj.name, obj);
}```
not sure if this will work
the problem is in here
public void CreateField(bool isExpanded, string Name, GameObject refObject)
{
GameObject Object = Instantiate(Field);
Object.transform.parent = Content.transform;
int count = Object.transform.childCount;
if (isExpanded == true)
{
for(int i = 0; i < count;)
{
if(Object.transform.GetChild(i).gameObject.name == "Expanded")
{
Object.transform.GetChild (i).gameObject.SetActive(true);
}
}
}
else
{
for (int i = 0; i < count;)
{
if (Object.transform.GetChild(i).gameObject.name == "Expand")
{
Object.transform.GetChild(i).gameObject.SetActive(true);
}
}
}
for (int i = 0; i < count;)
{
if (Object.transform.GetChild(i).gameObject.name == "FieldInfoText")
{
Object.transform.GetChild(i).gameObject.GetComponent<TextMeshProUGUI>().text = Name;
}
}
Object.GetComponent<HierarchyField>().refGameObject = refObject;
}```
i removed everything
and then just run this method
now i cant understand that there is no loop in here
but still it is causing the trouble
you have no i++ btw
wdym?
it happens π
Let the VS/VSC write th loop for you
I'm surprised that doesnt throw an error without another ;
in such cases
the for loop doesnt end
unless you break it
just like a while
you can leave out any of the 3 iirc
but if you want to skip the first you do need the first ;
is there a way to duplicate an object with code
like duplicate a gameobject
without using instantiate
Instantiate literally clones π
it does
but keeps the default values to the world transform
not the local transform
or is there a way to instantiate within a parent object
without instantiating first
yea look in the Instantiate
and then assigning parent
how do u post the code in that format?
just write csharp on top
!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.
π
if (Input.GetKey(KeyCode.W))
{
if (transform.rotation.eulerAngles.y != 0)
{
if (transform.rotation.eulerAngles.y > 180)
{
transform.Rotate(new Vector3(0, 0 + 10, 0));
}
else if (transform.rotation.eulerAngles.x < 180)
{
transform.Rotate(new Vector3(0, 0 - 10, 0));
}
}
transform.Translate(Vector3.forward * speed * VertiGo * Time.deltaTime);
}
if (Input.GetKey(KeyCode.D))
{
if (transform.rotation.eulerAngles.y != 90)
{
if (transform.rotation.eulerAngles.y >= 360)
{
transform.Rotate(new Vector3(0, 0 - 10, 0));
}
else if (transform.rotation.eulerAngles.x < 360)
{
transform.Rotate(new Vector3(0, 0 + 10, 0));
}
transform.Translate(Vector3.forward * speed * HoriGo * Time.deltaTime);
//-----MOVE BACKWARDS-----//
if (Input.GetKey(KeyCode.S))
{
if (transform.rotation.eulerAngles.y != 180)
{
if (transform.rotation.eulerAngles.y > 0)
{
transform.Rotate(new Vector3(0, 0 + 10, 0));
}
else if (transform.rotation.eulerAngles.x <= 0)
{
transform.Rotate(new Vector3(0, 0 - 10, 0));
}
}
transform.Translate(Vector3.back * speed * VertiGo * Time.deltaTime);
}
if (Input.GetKey(KeyCode.A))
if (transform.rotation.eulerAngles.y != 270)
if (transform.rotation.eulerAngles.y > 90)
{
transform.Rotate(new Vector3(0, 0 + 10, 0));
}
else if (transform.rotation.eulerAngles.x < 90)
{
transform.Rotate(new Vector3(0, 0 - 10, 0));
}
}
transform.Translate(Vector3.back * speed * HoriGo * Time.deltaTime);
}
There's a problem in this code and no clue how to fix it
So I'm trying to get the player to rotate to any direction while still moving
Example: If I press D, it'll rotate to 90 degrees,
But for some reason, when I press A, it refuses to go left, if I press D, it keeps spinning
(ignore the curly brackets, reached message limit
then use a paste site
!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.
Problems: Doesn't turn left when pressed A, D does inf turns, S in inverted
first thing, never read values from transform.eulerAngles
What shall I use then?
you keep your own calculation of rotation in eulerAngles and then use that to set the transform.rotation
Ah, I get it
Alright, ty
I have 2d box collider on player and 2d box collider on border, when player touches border it will start to slide around map why is that happening? I want to make him in box so he cant leave area, can I do it somehow by script so he doesnt slide when he collides with wall?
@golden ermine Don't cross-post
in which channel is this most appropriate to post?
You already posted in appropriate channel, just didn't provide any relevant details
well idk what more to add, I have box collider 2d on player and on wall, both of them have rigidbody2d component, when player collides into a wall player will start sliding in one way like im moving him there but i aint.
Ask in the relevant channel
I have a question
lets suppose i have an image that acts as a viewport
and i have some other images inside it
@snow warren Post code
and now i want a component that expands the viewport depending on how many other images are inside it
not code
its more like a scroll rect
like where the content size fitter fits itself for the image it is in
i want a content size fitter that fits itself based on the images inside it
anything like that possible?
This is a code channel
arent components also C#?
ok
other.gameObject.SendMessage("OnCollisionExit", selfColliderPart, SendMessageOptions.DontRequireReceiver);
...
public enum SendMessageOptions
{
//
// Summary:
// A receiver is required for SendMessage.
RequireReceiver,
//
// Summary:
// No receiver is required for SendMessage.
DontRequireReceiver
}
I have this code. Even tho i set "DontRequireReceiver", i still get MissingMethodException.
For a reason, I have two types of that tho. Likely:
private void OnTriggerExit(Collision);
private void OnTriggerExit(Collider);
But still, i dont want any exception for that.
Okay, there are a few exceptions that you cannot suppress. The MissingMethodException is one of them. You will need a special handling for that.
I've heard that Unity.Plastic.Newtonsoft.Json namespace doesn't work outside of testing - is this true and if so what other namespace is required for the Newtonsoft.Json functionality?
I am using normal Newtonsoft.Json package that provided by Unity. I think you shouldnt use Plastic.Newtonsoft no matter what.
I can't seem to find it in the package manager. Do you have to install it yourself?
Yeah you need to install yourself i just updated my answer as link given
System.Text.Json is an option too
Yep but Newtonsoft is likely an upgraded version of that. He can downgrade to System.Text.Json later on if he wanted to.
com.unity.nuget.newtonsoft-json copy paste that to
The only reason I'm getting it in the first place is for custom serialization. JsonUtility seems to serialize everything no matter what. Any suggestion of which one I should use?
For example, choice nodes don't need a speaker, dialogue text, or jumptonodeindex:
{
"dialogues": [
{
"nodeTypeString": "Dialogue",
"speakerPath": "Alison.asset",
"dialogueText": "Hey Jason!",
"jumpToNodeIndex": 1,
"choices": [],
"index": 0
},
{
"nodeTypeString": "Choice",
"speakerPath": "",
"dialogueText": "",
"jumpToNodeIndex": -1,
"choices": [
{
"playerText": "Hey, Alison!",
"jumpToNodeIndex": 2
},
{
"playerText": "What do you want?",
"jumpToNodeIndex": 2
}
],
"index": 1
},
{
"nodeTypeString": "Dialogue",
"speakerPath": "Alison.asset",
"dialogueText": "Nothing!",
"jumpToNodeIndex": 0,
"choices": [],
"index": 2
}
]
}
I gave up on a custom GraphView implementation so I'm trying to make these as readable as possible
There is no exact answer "What do i should use?". You should test one by one until you found the best one for your uh coding style. Some uses SimpleJSON, some uses System.text.json or some uses newtonsoftjson like me. There are other json serialization systems out that you should search them up.
I think the answer I am looking for would be if they both support custom serialization, then I can go from there. If one doesn't then there is no point in looking at it I assume
Let me show you an example code for Newtonsoft.
public sealed class NewtonsoftQuaternionConverter : JsonConverter<Quaternion>
{
public override void WriteJson(JsonWriter writer, Quaternion value, JsonSerializer serializer)
{
JObject obj = new JObject
(
new JProperty(nameof(Quaternion.x), value.x),
new JProperty(nameof(Quaternion.y), value.y),
new JProperty(nameof(Quaternion.z), value.z),
new JProperty(nameof(Quaternion.w), value.w)
);
obj.WriteTo(writer);
}
public override Quaternion ReadJson(JsonReader reader, Type objectType, Quaternion existingValue, bool hasExistingValue, JsonSerializer serializer)
{
JObject obj = JObject.Load(reader);
return new Quaternion
(
obj.Value<float>(nameof(Quaternion.x)),
obj.Value<float>(nameof(Quaternion.y)),
obj.Value<float>(nameof(Quaternion.z)),
obj.Value<float>(nameof(Quaternion.w))
);
}
}
If the above is possible with either I will definitely do my research on both
That is interesting, so you're basically able to use it to convert quaternions into Json by making it into a json object with different properties? I can see how that is useful
I can even use another converter. I would suggest you to try newtonsoft for first. Because it has so many community support for searching and finding an answer. Look at their docs, search it, do your first tests by serializing a normal class, test the attributes they gave and try to create a basic converter like i did. There are multiple techniques to create a JSON in newtonsoft. You could even handle whole json by yourself. I just showed you the "Linq" way.
just FYI, there's a package for premade converters for unity types so you don't have to write your own https://github.com/applejag/Newtonsoft.Json-for-Unity.Converters
made by the same person who made the fork of the newtonsoft.json package that unity forked
Okay, I can see it definitely supports custom serialization, that's good to know. Thanks Wilhelm I will check this out.
Yeah I already have it working, this is great. +1 to Newtonsoft.
Am i missing something on how setting presets work or are they just not that useful? For instance i am trying to create a FBXImporter setting that automatically converts to humanoid, then sets the animations to looping, however the preset is saving the name of he clip as well which is just renaming all my clips to the exact same as the one from the preset.
Nvm found a forum post about it:
https://discussions.unity.com/t/fbx-import-presets/697661/7
Seems you can manually add it via editing the preset file itself in your IDE. Seems like a massive oversight on the system imo
hey i need some help, how do i add a forward movement for the jump script thank you
// Jump
if (input.jump && jumpTimeoutDelta <= 0.0f)
{
verticalVelocity = Mathf.Sqrt(JumpHeight * -2f * Gravity);
Hey all,
I have a method in my player class
if (moveDir != Vector2.zero)
{
lastNonZeroMoveDirection = moveDir;
Debug.Log(lastNonZeroMoveDirection);
}
}```
I am trying to access that lastNonZeroMoveDirection Vector 2 in a different class script.
``` private Animator animator;
[SerializeField] private Player player;
void Awake()
{
// Get references to the Animator and Player components
animator = GetComponent<Animator>();
player = GetComponent<Player>();
}
// Update is called once per frame
void Update()
{
Vector2 moveDirection = player.lastNonZeroMoveDirection;```
I feel like I am definetly doing something wrong here. I dont think I am understanding how to access variables from other scripts.
You need to set the lastNonZeroMoveDirection variable to be public if you wish to access it from other scripts.
Sorry, I should add to this that Debug.Log gives the right lastNonZeroMoveDir that I am expecting. While if I debug log it in the different class it just shows (0, 0)
It is public in the player class
If it the variable is public, and it is being set correctly in the CheckNonZeroMoveDirection() function, but not reflecting so in your other script, then you need to check that it isn't being set somewhere else, or that you are accessing the correct copy of the player on you gameobject because it should be the same value.
also if its serialized it might be setting the value from the inspector instead of the script
Am I laying this out wrong? Method at the bottom.
{
[SerializeField] private float moveSpeed = 5f;
[SerializeField] private GameInput gameInput;
public Vector2 lastNonZeroMoveDirection;
private Vector2 moveDir;
// Update is called once per frame
void Update()
{
MovePlayer();
CheckNonZeroMoveDirection();
}
private void MovePlayer(){
Vector2 inputVector = gameInput.GetMovementVectorNormalised();
moveDir = new Vector2(inputVector.x, inputVector.y);
// Rotate input to match isometric view
moveDir = new Vector2(moveDir.x - moveDir.y, (moveDir.x + moveDir.y) / 2);
// Move the player
transform.Translate(moveDir * moveSpeed * Time.deltaTime);
}
public void CheckNonZeroMoveDirection(){
if (moveDir != Vector2.zero)
{
lastNonZeroMoveDirection = moveDir;
Debug.Log(lastNonZeroMoveDirection);
}
}
}```
Should lastNonZeroMoveDirection. Be accessable?
From that code, you if you access the Player component you should be getting the correct value. The issue is likely in the other script, or in your component setup
Okay, thanks. I thought as much.
I have the component set up like this with the player GameObject in the field.
PlayerVisual (where the Debug log doesnt work right) is a child of Player.
this is tricky problem with multiple solutions. You could use rigidbody velocity to carry your forward momentum into the jump, you could add movement/velocity directly in your jump, or implement a way to move in the air similar to how you would on the ground. All are viable approaches depending on use case.
is there something simulur to addforce?
set rb's velocity by urself
I am uncertain without seeing the code in player animinator but one thing that is a issue, is you are setting the Player script two ways: one via the inspectors serializedfield and 2 via the awake function
What's the issue? I didn't understand
im not using rigidbody for the character
Why are you trying to find smt similar to addforce?
To move the character or something complexer?
i just want to add a forward movement with a jump
Using a rigidbody seems perfectly fine for your case
Quick question about prefabs. When I reference a prefab within another GameObject, like for example, my player character references a bullet prefab to shoot. It works when I use [SerializeField] on a GameObject variable in the player script and drag the bullet prefab in and reference it like that
but when I try to do it manually using code, which is better practice, it fails
what exactly is unity doing when I use [SerializeField] and drag a prefab in?
wdym when you "try to do it manually using code"? how are you doing that?
Hello, i newbie with unity i made a movement for 2D platformer so far now i added sprite for player and i wanted to animate it but for some reason it behaves really weird - Idle animation on my screen is so fast and i can't figure out why (when i created the animation it looked normal, but when i play the game it looks like it is rapidly repeating), i would take a video but on video it looks different to what i see in editor... i don't understand what is going on, can someone help me fix this please ? if needed i will share whatever screenshots are needed
first I did bullet = GameObject.FindGameObjectWithTag("Bullet") which didn't work
well GameObject.FindGameObjectWithTag searches the scene. prefabs are not in the scene
then I did bullet = (GameObject)Resources.Load("Assets\Prefabs\BulletBasic");
(I made a prefabs folder)
that's using Resources.Load incorrectly
either way though, the SerializeField option is the superior option and you should use that when possible
I just want to know what SerializeField is actually doing in code
Since I heard it can be performance inefficient to just use it for everything
maybe that's not true though
it serializes the guid of the asset so that when the game is run unity can do whatever hidden magic it is in the c++ side to provide that reference.
also i need a source on that last claim about it being "performance inefficient" because it is more efficient than using shit like literally any of the Find methods
at most it will slightly slow down object initialization, but not nearly as much as using Find which has to search the hierarchy
no, that would be horrible. and wouldn't work anyway considering Find can only get active objects in the scene
which, naturally, prefabs and other assets are not
i'll just use SerializeField then, thanks
YIPEE IVE DISCOVERED ANOTHER BUG I DONT KNOW HOW TO FIX :D
What bug
every time i make progress something random appears
What happend
i have a script that allows the player to pick things up and drop them, but i now realize that i need a way to tell it that if something is already being held
then it shouldnt allow the player to run the event to pick up another item
i didnt even think of that being a problem
I have already script for pickup
So I can help
create a simple bool
isBeingHeld = false at default
Ye
I assume u set parent so when setting it just set bool to true
would it be an else thing?
When setting object parent set bool to true
And when picking up
Check if bool is false
Or true
in the pick up method, check if isBeingHeld is true
if it is dont pick up
so you know how you figured out how to check if nothing is being held like 12 hours ago? do the exact opposite of that to see if something is being held
if it's false, pick it up and set isBeingHeld to true
Ye that's what I said
there is no need for an extra bool for this. use the data you already have
i will attempt and report π
But using bool is easier
it's literally not
How
they've got a variable that they can just null check already. if it is null then nothing is held (which they discovered last night)
how come
Makes sense
oh
I mean are they going to pick up only a single thing throughout the game?
i did have a random "SomethingIsEquipped" bool that i didnt use
Then use it
i mean it just gets turned on and off
But name it better
my own script is confusing me i need to put more comments down π
I don't use comments lol
one of the times i dont go for a tutorial and somehow i counter myself 
U can send me ur script in dms and I can do it for u
i gots to learn it
Or I can give mine script
Ok
GOT IT 
now i just got to fix how it picks up objects
i got the location right, but im not sure how to set it to where it maintains its original size because it seems the object comes out just a bit smaller after i drop it
oddly though the new size stays consistent even when i pick it up and drop it again π€·ββοΈ
Hey there, I know that having raycast target enabled on images consumes some performance, so I want to disable it in a default preset. Works well for TextMeshPro as well, but when I create a button, it needs to have RaycastTarget enabled on its image. Is there a way to change how objects are created via the right click menu in the hierarchy?
I am having some trouble
dont just leave it at that. explain
I have made a runtime hierarchy
now i have some code that defines how the hierarchy works
public class RealtimeHierarchy : MonoBehaviour
{
[SerializeField]
private GameObject Scene;
[SerializeField]
private HierarchyFieldConstructor constructor;
public RectTransform content;
private int index;
private void Initialize(GameObject Object)
{
index = index + 1;
int count = Object.transform.childCount;
if(count > 0)
{
constructor.CreateField(Object.GetComponent<SceneExpand>().isExpanded, Object.name, Object, index);
if(Object.GetComponent<SceneExpand>().isExpanded == true)
{
for(int i = 0; i < count; i++)
{
Initialize(Object.transform.GetChild(i).gameObject);
}
}
}
else
{
constructor.CreateField(Object.name, Object, index);
}
}
private void Start()
{
index = 0;
Initialize(Scene);
}
}```
this is what i used to initialize it
now in this code
constructor.CreateField(Object.name, Object, index);
the index tells that this gameobject is a child
so the constructor adds that component as a child component
but i want to know exactly if that object is a child component or not
not like a specific index + 1 everytime i call it
in this picture
the cube (2) should not be inside cube (1)
it should be outside with the simple Cube
but it shows all components as child object
any way to fix this issue?
ok let me try
ideally you should know your position when you create an object, such that you further the search into the newly created child
but cache the parent for when you cannot search deeper
i was trying to do that what you said
but i ended up writing this piece of shit
lol
private void CalculateIndex(GameObject Object, GameObject Object2)
{
if(Object == Scene)
{
index = 0;
}
else
{
int childCount = Object2.transform.childCount;
for (int i = 0; i < childCount; i++)
{
if (Object2.transform.GetChild(i) == Object)
{
index = index + 1;
}
else
{
index = index + 1;
CalculateIndex(Object, Object2.transform.GetChild(i).gameObject);
}
}
}
}```
doesnt work
brain.exe not working
i really dont know how to calculate the correct index
caching parent is too annoying
seeing i am not generating a list
i just getting values and adding them to scene
so its a bit fast
and less complex
you're just mimicing a tree and reconstructing it right? My idea would be just construct a temporary tree of references, then construct this newly created tree after iterating over the scene object
yep
but what you are suggesting is a lot more complex
in my case
everything is complete
all i need is to calculate the index somehow
Anyone know how to make games for mobile on unity? Im just confused whether to load a new project with 2D mobile to make the game or I can make the game in the basic 2D engine and add mobile controls later
2d and 3d are pretty much the same
aside from the 2d template you are provided with
U recommend 2D mobile template or just regular ?
2D mobile is better
you need to download the android, iOS or WebGL addon (depends on your target)
how can i check if unity Relay is giving me an error?
im currently using Relay to add multiplayer and it works but if my inputfield is empty i get an error telling me that its not supposed to be empty then freezes my game, how would i
- Unfreeze my game
- Check if this is true with code
i would also like to do the same if there is no Valid lobby id
so i could let my player know that the lobby id they inputed is not valid, also when its empty it freezes the game which is not good
The Error Isnt the issue, its the freezing of the game mostly, and i would also like to again let the player know that there is no Game with that lobbyid
then dont let the code run if its empty?
check the input field first, THEN do the multiplayer stuff
If two objects have oncollisionenter, which one gets called first?
both at the same time i guess?
you can debug.log and see the Time the message gets logged
Hey, its me again. You guys have been very helpful and are helping me learn a lot also.
I have some code where I run
return playerInputActions.Player.Jump.triggered;
}```
To get the input from a spacebar press.
This is read into
```public void UseDigMechanism(){
digButtonPressed = gameInput.IsJumpPressed();
// If the player is digging, set isUnderground to true
if (digButtonPressed){
if (!isUnderground)
{
// Trigger the burrowing animation here
isUnderground = true;
}
else
{
// Trigger the unburrow animation here
isUnderground = false;
}
}
//Debug.Log($"Digging: {digButtonPressed}, Underground: {isUnderground}");
}```
Within my animation script I have this:
//Debug.Log($"Current state: {currentState}, moveDirection: {moveDirection}");
bool isUnderground = player.isUnderground;
// Handle the burrow and unburrow animations
if (!isUnderground & player.digButtonPressed)
{
//animator.Play("burrow");
//Debug.Log(player.isUnderground);
Debug.Log("burrow");
}
else if (isUnderground & player.digButtonPressed)
{
//animator.Play("unburrow");
//Debug.Log(player.isUnderground);
Debug.Log("unburrow");
}
Which I would expect to show "burrow" first then unburrow on a second space bar press. But it seems to be flipped around. unburrow shows on the first space press and burrow on the second.
then maybe its set to true and not false
Debug log in the method where I change isUnderground shows it working correctly though
Starts as isUnderground is False then changes to True when I press the button.
Even if I set isUnderground to false in a start method it doesnt seem to work.
So something must be wrong with my logic in the animator class
// Handle the burrow and unburrow animations
if (!isUnderground & player.digButtonPressed)
{
//animator.Play("burrow");
//Debug.Log(player.isUnderground);
Debug.Log("burrow");
}
else if (isUnderground & player.digButtonPressed)
{
//animator.Play("unburrow");
//Debug.Log(player.isUnderground);
Debug.Log("unburrow");
}```
can you before these if statements
Debug.Log(isUnderground + " " + player.digButtonPressed);
Hi, I have a short script that moves the camera with a certain offset to the player but for some reason the game crashes after moving a distance away from where the charecter started from. The larger the y value of the camera offset is, the less the player need s to move for the game to crash. Does anyone know why this is happening?
using System.Collections.Generic;
using UnityEngine;
public class camera_follow_player : MonoBehaviour
{
public Transform player;
public Vector3 offset;
// Update is called once per frame
void Update()
{
transform.position = player.position + offset;
}
}
wdym by "a distance" is it really far? or just close?
also i would suggest naming the class something like CameraFollowPlayer instead with capitals
are you making ur own game engine??
it depends on what the y value of the camera offset is, if its at 18 it crashes instantly, if its at 17, it crashes like 5 units from the start, if its 16, it can go a bit further
alright!, how would i then also check if there is no lobby with that specific lobby id?
i dont think this code should crash it tbh, unless its a Unity version bug or something?
doesnt the method for joining lobby already do that?
if you use a try/catch then in the catch you can just return to the player theres no lobby or something, i think thats how it works
You can try checking the editor logs for some details about the crash
where can i see them?
You can see them by googling "unity editor logs" and clicking on the first link which would open up the docs
how can i set the color of a text to a Hex Code?
all i saw is Color.RGBToHSV and Color.HSVToRGB, but i dont need either i just need to set the color of a text to a speficic hex code
Hey guys. I have three scenes, menu, game, and end screen. I made a score manager script with a singleton that manages the score values. The Game Manager, loads the scenes. The end screen has a canvas with some text to display the score of the previous run. My question is, what would be the best way to update the text according to the value in the score manager script once the end screen scene is loaded? should I add an end screen script that gets the value in score manager and displays it in Start()?
or maybe just check if the name of currently loaded scene is "end screen" in the score manager and if it is, find object of type canvas, find the text in its children, and update it?
Keep it simple
end screen talks to the UI Manager to update text
If you already have a singleton then make a use of it
so I should make a new script called UI manager?
I understand how to implement this but I'm not sure how to it in a clean, scalable way
if what you're doing works then just do it honestly
I usually like to have a singleton class for the canvas
if you have a singleton class for the canvas would the canvas have to be in every scene?
it's an overlay for all scenes, yes
it's used for fade transitions and all that jazz
that's an great way to do it yeah
trying to make it so i 'pick up' an object, this is as close as i can get it to be, all i need is for the new object to be a few spaces out from the parent object but ive completely forgotten how to do that
add a Vector3 to it to use as an offset
not sure how
+ new Vector3(x, y, z)
can someone pls teach me how to correctly set up cinemachine for a 3d camera follow thingy (like minecrafts f5 non facing yourself pov)
the offset that you want
oohh right yeah oops
!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.
not working how
it does not move the player when the button is pressed, however the debug.log in the ienumerator does show when i press the roll button
so it works to that point atleast
you should probably do that in Update or use a Impulse add force
i use ienumerator so i can change exactly how long it lasts for
this script did work before implementing the new input system
what does a coroutine have anything to do with it?
your using a timer
you can do the exact same thing in Update
didnt see your using a while, but you can just use an if statement like a normal timer in Update anyway
how do i do that
the same way you do this code just if instead of while
that makes sense
and wrap this all under the isRolling bool of course
if im doing a timer in update should it be fixed update
I finally Got my acceleration to work
so Now how Should I go about a SHARP Decrease in speed when moving from one Direction to the other Really fast?
with this code as reference:
{
}
// Update is called once per frame
void Update()
{
inputvalue = Input.GetAxis("Horizontal");
movement = inputvalue < 0 || inputvalue > 0;
}
void FixedUpdate()
{
inputPhysics();
}
void inputPhysics()
{
if (movement)
{
acceleration();
}
else
{
deceleration();
}
data.text = inputvalue.ToString();
data2.text = movement.ToString();
accelerationData.text = body.velocity.ToString();
}
private void acceleration()
{
float physicsAcceleration = accelerationRate * Time.fixedDeltaTime;
Vector2 new_velocity = new Vector2(top_speed, 0.0f);
body.velocity = Vector2.MoveTowards(body.velocity, new_velocity * inputvalue, physicsAcceleration);
}
private void deceleration()
{
float physicsDeceleration = decelerationRate * Time.fixedDeltaTime;
body.velocity = Vector2.MoveTowards(body.velocity, Vector2.zero, physicsDeceleration);
}
}
you can compare the directions with the dot product https://docs.unity3d.com/ScriptReference/Vector2.Dot.html to see how similar they are. Then scale how fast you change the speed based on the value
I'm going insane, this makes no sense
you can see from those debug rays that it properly sees the enemy location, the player location, and the line between them
however in the VERY NEXT LINE it shows the vectors as way above where they are
the player is only at 6
and likewise that CanSeeLOS method, the last parameter tells it to draw a ray
can you send the testraycast method?
yet the magenta line doesn't even appear (even before the red line was there)
you could maybe be using hit.point?
I Don't see how the TestRaycast method could even affect anything
it doens't get called until after the debug log gives an incorrect output
oh maybe I'm misreading your code sorry
it draws the yellow line where I expect, starting at the player's location
ok I think that's because the player is technically the child of an object so that explains the weird values, kind of
but why would one line work while another doesnt
its the exact same values
yes that would do it. the values in the inspector are the localposition, not the world position
transform.position is in world space, transform.localPosition is in local space
is there any way I can make the inspector show world position
nah, you can change the local space/world space gizmo for moving objects in the scene view though
but oh well, I still don't understand why the raycast isn't working or even showing the debug line
idk what version you're using so it may have changed what it looks like
which debug line are you referring to? the cyan one?
I call it with the exact same values as the red debug draw line
but the red one works, while this one doens't, and it appears to mess up my code as well as a result
when it appears, the enemies "see the target in the expected location" which I expect
they don't both show if they have the same values, only 1 does
I added that one because i was going insane
LOL
I will comment out the red line and paste it directly into that method
ok I can't cuz it uses variables but still
its the same values exactly
still no magenta line?
perhaps it's getting rendered over by another gizmo? like the navmesh
no because sometimes I see it
the enemies coming from the other side show it just fine
isntead of using drawline
use drawray
and pass the direction vector
then multiply it by like 50 and make the time be something ridiculous
then try to find it
ok are you still using drawline?
you should probably debug the parameters in the method too
yeah there seems to be some kind of issue
the coordinates in the debug though dont seem to match what I see
because they are pointing to 0,0,0
is first notice inside of that method?
I'm saying debug.log inside that method, to make sure that those values are matching
it's one line before the call
AHA
I have NEVER seen a value change from being passed into a method
yeah I've got no idea what's modifying that
if you want, you can try caching the agent.destination value into a local variable, and then pass the local variable to the method
like:
Vector3 cache = agent.destination
then pass cache to the method
and see if those match
no it still sets it to nearly zero
im gonna try it on a line of its own directly after
before you perform the subtraction
yeah that's a good idea too
idk if it's possible but it could a race condition?
I've seen weird stuff like that happen with debug.log before
how would I even fix that?
its not just debug log, it actually seems to affect the code
maybe I shouldn't be using agent.destination directly though idk
I assume agent is a navmeshagent, but yeah that should be fine
yeah it appears to be that subtraction
the debug looks fine now, but hte ray is all wrong
SOMEHOW that is messing with things
even tho its - not -=
note that direction is (endPosition - startPosition), so your direction goes from origin to targetLoc. however your DrawRay starts at targetLoc
I think you have an issue in the DrawRay
hm true I will try that and see what I can find
ok I THINK that did fix the drawline, tho that still doesn't explain why the subtraction changed it... maybe I can work around that though
you're passing them in backwards also
but that could be intentional
it shouldn't matter what direction, im just testing if theres free LOS between those locations
what wasn't making sense is how the second parameter became basically zero
What second parameter?
I think it works as expected now, I stopped using agent.destination directly and I put the draw before I did the subtraction and it seems to work
There is no shortcut for UnityEngine
!ide
If your IDE is not autocompleting code
or underlining errors, please configure it.
Select one:
β’
Visual Studio (Installed via Unity Hub)
β’
Visual Studio (Installed manually)
β’
VS Code
β’
JetBrains Rider
β’ :question: Other/None
need to configure it
ugh... getting more stupid nonsense..
@real falcon If you don't have anything constructive to say, don't post it here.
nvm I figured it out, this time it WAS because the parameters were reversed
Anyone know how to get a 3d vector that is 30 degrees between 2 3d vectors that are 90 degrees apart?
I really just can't get my head around the math or code required to do so
Pick any of them as starting point and rotate towards another by 30 degrees?
yeh I don't know how to do that in code
So put that in a search engine and find a manual page https://docs.unity3d.com/ScriptReference/Vector3.RotateTowards.html
Thank you! π
How do I turn a json like this into a dictionary / list
Specifically, how do I format the class (Root) so it converts it properly
You can't deserialize a custom format and you can't deserialize a dictionary with JsonUtility by default.
To deserialize dictionary you need something like Newtonsoft. Also all serializers have unique format, you need to make sure it is correctly formed. Might have to make custom parser to convert. (Or find out the one that was used and use that)
So what do I do
What Fogsight said.
Or reconsider the input json file structure.
The difference is that this is a compatible format and what you shared earlier is not.
You shouldn't be writing json by hand anyway
!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.
ok, so I want to make a script where when void "SnowballMaker" is executed an object is spawned as a child of another object. How do I make this
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SnowBallTrigger : MonoBehaviour
{
public GameObject Snowball;
// Update is called once per frame
void Update()
{
}
private void SnowBallMaker()
{
}
}
This is my script
Just instantiate the object, and then use yourInstantiatedGameObject.transform.parent = yourparentGameObject.transform;
.tranform.parent =
ok
instantiate has a parameter so you can specify what the parent is
https://docs.unity3d.com/ScriptReference/Object.Instantiate.html
You'll have to use = parentObject.transform
i have moved this to update as instructed but it is not working still
it seems to be working the same as it was beforehand
my guess is that i havent done inputDirection correctly
since i am using the new input system and am not knowledgable on it
Hi, off my last piece of code nothing seemed to work, I would do it, and notheing would happen
something similar
Please use codeblock next time
How?
Use ``` then after these 3 (no space) ur language name like CSharp
Paste ur stuff and create new line that ends with ```
God dammit
Use these `
3 times
U can also use name after these 3 like CSharp for syntax highlighting
Can someone help me out really quick?
It was just working fine yesterday
PlayerSetup script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Pun;
using Hashtable = ExitGames.Client.Photon.Hashtable;
using TMPro;
public class PlayerSetup : MonoBehaviour
{
public Movement movement;
public GameObject camera;
public string nickname;
public TextMeshPro nicknameText;
public Transform TPweaponHolder;
public void IsLocalPlayer()
{
TPweaponHolder.gameObject.SetActive(false);
movement.enabled = true;
camera.SetActive(true);
}
[PunRPC]
public void SetNickname (string _name)
{
nickname = _name;
nicknameText.text = nickname;
}
[PunRPC]
public void SetTPWeapon(int _weaponIndex)
{
foreach(Transform _weapon in TPweaponHolder)
{
_weapon.gameObject.SetActive(false);
}
TPweaponHolder.GetChild(_weaponIndex).gameObject.SetActive(true);
}
}
RoomManager
using Photon.Pun;
using UnityEngine;
using Hashtable = ExitGames.Client.Photon.Hashtable;
public class RoomManager : MonoBehaviourPunCallbacks
{
public static RoomManager instance;
public GameObject playerPrefab;
[Space]
public Transform[] spawnPoints;
[Space]
public GameObject roomCam;
[Space]
public GameObject nameUI;
public GameObject connectingUI;
private string nickname = "unnamed";
public string roomNameToJoin = "test";
[HideInInspector]
public int kills = 0;
public int deaths = 0;
private void Awake()
{
if (instance == null)
{
instance = this;
}
else if (instance != this)
{
Destroy(gameObject);
}
DontDestroyOnLoad(gameObject);
}
public void ChangeNickname(string newName)
{
nickname = newName;
}
public void JoinRoomButtonPressed()
{
Debug.Log("Connecting to room...");
PhotonNetwork.JoinOrCreateRoom(roomNameToJoin, null, null);
nameUI.SetActive(false);
connectingUI.SetActive(true);
}
public override void OnJoinedRoom()
{
base.OnJoinedRoom();
Debug.Log("Connected and in a room");
roomCam.SetActive(false);
SpawnPlayer();
}
public void SpawnPlayer()
{
if (spawnPoints.Length == 0)
{
Debug.LogError("No spawn points assigned!");
return;
}
Transform spawnPoint = spawnPoints[Random.Range(0, spawnPoints.Length)];
GameObject _player = PhotonNetwork.Instantiate(playerPrefab.name, spawnPoint.position, Quaternion.identity);
PlayerSetup playerSetup = _player.GetComponent<PlayerSetup>();
Health health = _player.GetComponent<Health>();
if (playerSetup != null)
{
playerSetup.IsLocalPlayer();
}
if (health != null)
{
health.IsLocalPlayer = true;
}
PhotonView photonView = _player.GetComponent<PhotonView>();
if (photonView != null)
{
photonView.RPC("SetNickname", RpcTarget.AllBuffered, nickname);
}
PhotonNetwork.LocalPlayer.NickName = nickname;
}
public void SetHashes()
{
try
{
Hashtable hash = PhotonNetwork.LocalPlayer.CustomProperties;
hash["kills"] = kills;
hash["deaths"] = deaths;
PhotonNetwork.LocalPlayer.SetCustomProperties(hash);
}
catch (System.Exception ex)
{
Debug.LogError($"Error setting custom properties: {ex.Message}");
}
}
}
theres a photon server pinned in #archived-networking but also when you ask there, you should specify whats not actually working. you'll get more help when people dont have to go through a video to see whats wrong
I fixed it
Alright thanks
Any ideas why unity doesn't seem to respect my pivot point when displaying a sprite in a UI image?
how to delete a gameobject through C#?
whenever i use Destroy(Object)
it tries to destroy only the rect transform
Object.gameObject ?
It destroys whatever you pass in as the parameter. If you want to destroy the GameObject, pass in the GameObject
Im using SCEMA-Runemark Studio and i cannot load scene pls help
πππ
No one knows what SCEMA is. Maybe ask in their community or the author of the asset.
im a beginner idk how to fix ;-;
the "MainMenu" is ticked and still not loaded
and loading the "MainGame" got the same problem
Share the code that loads the scene
what?
The code where you load the scene.
SceneManager.LoadScene(0);```
If they do loaf it, they should probably know that.
I'd assume that they're relying on a feature of that assed they are using without actually understand it
wdym? ;-; (i didnt write that code)
same as writing code with youtube tutorials
lol
Then we can't help you. This is not unity related at this point.
wait why?
Because you're relying on the feature of that asset.
You'll need to read it's manual and learn how to work with it.
i read the manual and their works fine ;-; https://assetstore.unity.com/packages/tools/utilities/scema-scene-manager-and-loader-154316#publisher
Then you missed something π€·ββοΈ
No one here knows about that asset, so we can't help you.
You'll need to ask the devs or in their community
The errors really are quite clear also. If you're reading an error and you stop at the first word, consider reading more of what the magic machine is trying to tell you
Well the scene error that is
Also, the error talks about a different scene. You got me confused there.
wait lemme see
wait i js realized that i cant load the scenes that i got online as assets
OMG ITS WORKING TYSMπ₯°
Next time pay attention to the errors.
vc anyone ?
When I disable the canvas' graphic raycaster, the OnPointerDown event on my Image stops triggering.
But when I reenable it and set the Blocking Mask to Nothing, the OnPointerDown gets triggered. Does anyone know why this is happening?
What would you expect to happen, considering the fact that the Graphics Raycaster is responsible for interactions with UI elements
Since I set the blocking mask to Nothing, it shouldn't be blocked by anything (it should fail)
Nothing means, nothing, so nothing is blocking
Then why do i only trigger the OnPointerDown once, when I have two overlapping images?
because the top image picks up the hit
So the top image blocked...
no, that is not blocking
what's blocking?
blocking is when you have 2 overlapping images and you set the top image not to block so the underlying image gets the hit
anyway this conversation belongs in #π²βui-ux It is not a code question
That doesn't seem to be the case. I have two images with different layers and set the blocking mask to one of them. The detected click is only decided by who's bottom in the hierarchy
My bad, I'll move it there
Hi, is there any way to create a variable in editor mode to centralize some references.
I have several text mesh pro objects and a font asset.
If the font changes I have to change the reference to all text mesh pro objects, a bit cumbersome.
You can make a dictionary or an array and just find all of them on runtime if you want
Something I'm trying to figure out is how would I go about making a script that is constantly changing variables (GameObjects in this case) and then having it look for a specific script
But the specific script would be different to each object
Whenever I want to reference one script from another, I write the actual script name but in this case it's going to be looking for... well I'm not entirely sure exactly
What would I be having it look for because surely I can't name every file the same thing or have every event be the same name
ps there a way to make a 3d model solid exactly to fit it
hey so for a game im working on i added a grapling hook and i want to add like a jetpack / boost for that graplling hook that basically allows you to go faster when swiging with it allowing you to basically make loops around a object
anyone know how to add the jetpack / boost feature
(the game is 2d btw)
Try rephrasing your question. It doesnt really make sense
Yes I had thought via script, dynamically.
I was hoping for something from editor, though.
@steep rose @marble hemlock
Doesnt seem like it unless you wish to manually place them there
Are you asking about colliders? @gusty topaz
yes
There is MeshCollider
i tried that but it didnt work
Or if 2d then polygoncollider
In what way?
Would I have to have it check for every single script π
its
If it is invisible, then it's doing its job
it has 2 parts and its a prefab
That doesnt answer the question "in what way it doesnt work"
Show us more details
I feel like we're talking about different things mb
I don't really understand your use case. π
Well show us the collider preferably in #βοΈβphysics
I have a completely different problem
To be simpler, it's a pick up script. When it gets picked up, it takes up a variable slot called ItemHeld. But some items will actually have uses when you pick them up that you can use immediately
For example if I wanted the object to be a card reader, I'd just need them to check if item held matches the keycard name or tag or whatever.
Okay so do that?
That's not really the problem
The problem is when it becomes multiple scripts, because different objects will have different scripts attached
I don't know what I would have it be looking for. I can't have it look for a specific script because then it wouldn't work, but surely I wouldn't need to have it check for every single script type.
I don't know what component it should be getting told to try to get
That would be a lot of scripts to check for ;-;
I mean that's what getcomponent does
If you have a lot of scripts you best bet is to check them in batches probably if you are worried about performance
If all this scripts have something in common, use a base class for them.
Then you just need to check for the base class
Or this β¬οΈ
Or an interface
Back to learning classes again 
how do i add force in the direction the character is already moving
Using its velocity
Get the rigidbody, its velocity, and normalize that vector. That is the direction you're moving in, you can then multiply that with a single value (a float) to add more or less force
yo anyone got any general direction to how to create a skill system in a turn based combat rpg game?
like you can have 4 skills equiped each time and the ability to switch the while not fighting
Well I know there are plenty of tutorials leading you in the right direction, if that doesnt suite you. You can look up how to make chess and implement your skills and things
I couldn't find any tutorials for that
Because your question is very specific
A skill system can be anything
If you want to hold skins, then I guess you have an array on your player that can hold them. Your skills can be defined by an enum, or maybe an SO if you want more control over what they do
But what should the two values for dot Product be?
Hey,
is someone available who can take a look on my animator and codes??
Well if it is code related then shoot it here, if it is animation related go to #πβanimation
Also !ask
:thinking: Asking Questions
:mag: Search the internet for your question!
:book: Use the API Scripting Reference and User Manual and this troubleshooting site for commonly posted issues.
:wrench: Attempt to debug your issue.
:thought_balloon: Find an appropriate channel by reading the name and description in #πβfind-a-channel
:grey_question: And don't ask to ask, ask a full question illustrating with screenshots if needed.
-# For more posting guidelines, go to #854851968446365696
I want my character to move foreward and jump like a subway surfer game but it also has animations as well and I need a code, Everytime I use chatgpt, samething screws up but no that is finally running there are some tiny problems which I'm not able to solve. Soooooooooo help me anyone plssss
First off do not cross post, second off dont use chatgpt since it will lead you astray most times
Third, please !learn how to use unity
:teacher: Unity Learn β
Over 750 hours of free live and on-demand learning content for all levels of experience!
I am working on that but I have a deadline as well that's why I some help and guidance if any
I have a player script which is controlling a bool isUnderground which changes from False to True depending on a space press. This seems to be working fine.
However, in an animator script I have the issue where the burrow animation is not working, it is flipped and when I push space it says "unburrow" when I would expect burrow as my first animation
if (player.isUnderground == false && player.digButtonPressed)
{
Debug.Log("burrow");
//Debug.Log(player.isUnderground);
if (lastNonZeroMoveDirection.x >= 0 && lastNonZeroMoveDirection.y > 0)
Debug.Log("burrow_NE");
//animator.Play("burrow_NE");
else if (lastNonZeroMoveDirection.x < 0 && lastNonZeroMoveDirection.y >= 0)
Debug.Log("burrow_NW");
//animator.Play("burrow_NW");
else if (lastNonZeroMoveDirection.x > 0 && lastNonZeroMoveDirection.y <= 0)
Debug.Log("burrow_SE");
//animator.Play("burrow_SE");
else
Debug.Log("burrow_SW");
//animator.Play("burrow_SW");
}
else if (player.isUnderground == true && player.digButtonPressed)
{
//animator.Play("unburrow");
//Debug.Log(player.isUnderground);
Debug.Log("unburrow");
}```
If I debug log
Debug.Log($"animator: {player.isUnderground}");
At the start of the update I get false, which is what I expect. And pressing space changes the debug log to True. Again expected.
And so this part
{
Debug.Log("burrow");
Of my method should be right, but it isn't and I am confused.
if(player.digButtonPressed)
{
if(player.isUnderground)
{
// pressed dig button and is underground
}
else
{
// pressed dig button and isnt underground
}
}```
try something simpler like this and see if it debugs correctly
Well stringing animations with movement is easy so that's why I told you to learn
Have you used the animator before?
This doesnt debug correctly either
This
{
if(player.isUnderground)
{
// pressed dig button and is underground
Debug.Log("unburrow");
}
else
{
// pressed dig button and isnt underground
Debug.Log("burrow");
}
}```
Unless I am being completely stupid with my logic here.
nah thats it.. just very less formatted
so it debugs backwards? or just wrong all together? what logs do u get when u do what?
It shows unburrow as the first log and then burrow on the second. It's flipped
ohh its flipped
But I dont get how:
Debug.Log($"animator: {player.isUnderground}");
At the start of the start of update shows false then space bar press changes it to true.
yeah, I get that I can do that. But I dont really understand why.
well what does that parameter start as in the animator?
does it match the state u assume in the logic
I am not sure, how do I find that out?
in the animator (on the object being animated)
should show all ur parameters on the left.. you can see all mine start false.. but i could just as easily make them start as true
just a guess tbh
I guess this is not ideal set up.
no thats fine. click the parameter tab
at the top left.. right now its just showing ur layers
but yea, it appears that its not really set up for transitions like mine is..
your code must be just calling animation clips manually
I just have isIdle_NE in there. So that might be an issue?
Maybe I need to set that up as a parameter.
π 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'd like to see what these booleans actually are
i think im assuming some things that arent true lol
From the animator script?
the script ur working w/
this one..
i just wanna see the references..
what player is.. what isUnderground is etc
well that'll work.. but for future reference.. use one of the paste-bin websites..
mobile guys can't see that type of embed
u copy the link after u paste it
and share the link.. not the entire code again
yes
that what i was trying to figure out
can u share it as well?
w/ both codes together it's alot easier to help debug
https://gdl.space/umedifayim.cs < Player script
Thanks for this
Banging my head against the wall
dont thank me yet.. im just looking for now.. and i just woke up
not the brightest me present lol
well, theres not much there in the player script ```cs
// This method is called when the space bar is pressed
public void UseDigMechanism(){
digButtonPressed = gameInput.IsJumpPressed();
// If the player is digging, set isUnderground to true
if (digButtonPressed){
if (!isUnderground)
{
// Trigger the burrowing animation here
isUnderground = true;
}
else
{
// Trigger the unburrow animation here
isUnderground = false;
}
}``` this part looks fine to me..
when ur underground and u press dig -> u set it to not underground
and when ur not underground and u press dig -> u set it to underground
thats it yeah
alright. soo it can't really be the player script.. must be something going wrong in the PlayerAnimator script
alrighty. let me stare at it for a minute now
And yet pushing space first time gives this
ya i see what u mean.. that first log should be burrow
Yes
hmm, interesting
void Awake()
{
// Get references to the Animator and Player components
animator = GetComponent<Animator>();
isUnderground = player.isUnderground;
Debug.Log($"Starting state of isUnderground: {isUnderground}");
} ```
what happens if u log it right after u assign it in the awake method
should be Starting state of isUnderground: False
and ur not messing w/ or changing that playerscript from anywhere else?
somethings not adding up.. and my coffee intake isn't high enough yet to understand what I'M missing
I have gameinput that is being read by the player script
ya, but i looked at ur player script.. ur not changing the bool except in that if/else Button check conditional
yeah
ya, im missing something too.. let me look a bit closer at it and find what im overlookin
OHHHH i know
isUnderground = player.isUnderground; this is only setting the *first state of isUnderground i think
since it only runs in the Awake()
what happens if u set it before each time u check it
nvm, i just realized ur checking it str8 from the player
soo this line doesnt even do anything lol
b/c u dont ever use the isUnderground from the PlayerAnimator
just player.isUnderground
I see that if I debug log
{
Debug.Log($"animator: {player.isUnderground}");
``` I get
So I guess I am assigning the isUnderground to true before the debug log can say burrow?
yea it has to be something like that
the top two logs should match
unless something changed it between the 2
Yeah, I cannot figure this out :/
ya, me neither.. theres nothing ur code that i see that could change the bool from the little time it takes to run Awake to the function that logged it that 2nd time
im trying to recreate the problem in my project right now.. and well.. lol (its not working like urs.. its working correctly)
https://gdl.space/umedifayim.cs <- Player Script
https://gdl.space/eyulotiwum.cs <- Player Animator Script
heres ur two links for safe-keeping b/c u may have to wait for some more activity in here and ask someone else.. b/c im not seeing the issue.. sorry my guy
Okay cheers
good luck
Hey dudes, i've a problem. I've 2 game objects: Grid object and Tile Object. Grid object creates two 2d arrays: int gridArray and GameObject tiles, both arrays are getting filled with ints/objects at grid object create() (it's get's created and filled at scene start). in Tile object i have a script
if (Input.GetKeyDown(KeyCode.Alpha0))
{
Debug.Log(grid.GetComponent<Grid>().gridArray);
Debug.Log(grid.GetComponent<Grid>().gridArray[0,0]);
}
and console logs "System.Int32[,]"
"0"
but the thing is, the 0,0 position's value is "1"
if i try to log tiles array then im Getting
"UnityEngine.GameObject[,]"
"Null" but the object is in there on position 0,0
im going insane because it seems to me like the Tile object sees default values for arrays instead of actual values
The first log you're seeing is just printing the type of the array
if i log the arrays from grid's script then it actually shows correct values
The second log tells you what's in that position
If it says null, then it's null
Null is the default value for an element in an array of a reference type.
if i do the same logs from grid's script then it shows the correct value in 0,0: in case of tiles array it's "Tile(Clone) (UnityEngine.GameObject)"
why doesn't Tile object's script see actual values inside the arrays?
Sounds like you're referencing two different arrays.
Or you're doing so at different times
When the array contains different values
if (Input.GetKeyDown(KeyCode.Alpha0))
{
Debug.Log(this.GetComponent<Grid>().tiles5);
Debug.Log(this.GetComponent<Grid>().tiles5[0, 0]);
}
this is executed at the same time from Grid and Tiles objects
(for Tile object put "grid" insead of "this")
It can't be "at the same time"
Nothing happens at the same time, Unity is single threaded
But as noted, it may also be that you're simply referencing two different Grid component instances
how can i check if im referencing the correct instance?
do you have a class called Grid btw ? be careful with that, unity has its own Grid component
Compare them with == or print their Instance ID
actually, yes i do
oh okay, usually it grabs yours since its prob in same assembly but just something to be aware of, incase you're not seeing the props/methods you expect
Hello guys, I have 2 Input Fields and I want to change one of em to nickname's Lobby. I've tried this but its not working. Would appreciate if anyone would helps me.
put debug.log inside make sure the function actually runs
logic looks wonky
What do u mean by that? Where should I put dubug.log?
which one is the function ?
I only see 1 , this is a 50/50 chance question 
public void changeLobbyName(){
Debug.Log($"{name} is calling change lobby name");
if (nickname.text != "Player 1's Lobby"){
LobbyName.text = nickname.text + "'s Lobby";
Debug.Log($"{name} Changing lobby name to {LobbyName.text} ");}}
I'm sorry, I've never used Debug.Log before, no idea how it works and I'm new to coding
well now its time to learn then, it should've been the first thing you learned / wrote
!learn
Should I start the Program now?
:teacher: Unity Learn β
Over 750 hours of free live and on-demand learning content for all levels of experience!
thx
It says "The type or namespace "UI" is not in namespace "UnityEditor" available"
well none of that is what I sent so you have to show what you wrote and where it says that..
is there a way to make a dialogue window i made (which is a jlg canvas with text) disappear without disabling it? because when i disable it i can't enable it again to use it
rb.AddForce(rb.linearVelocity.normalized * 10);
would that work
Yes
Weird coincidence, you replied the second I logged on, I was away for a few hours
same lol you replied before right as i had to leave for a few hours
now i gotta get back to work on my game for brackeys game jam
although my grappler is really buggy
No, your script is on the wrong object
hey so these are my 2 scrips for my grappling hook and i could use a little help because its really easy to gain way to much speed and if you hook onto like 3 things in a row you basicallcaly become faster then light any ideas on how i can fix this
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.
?
Iβm a bit confused bout this
if you are disabling the gameobject, you don't need to. Just disable the Canvas component
and i can re enable it in that case?
of course
Can someone give me a basic rundown on why I should initialize variables? Im a little confused on their purpose, and ive tried googling it and its given me some confusion. Thanks π
Sounds like you need to look at some basic programming or at least C# tutorials
You initialize variables so they have a value which you can then use
its not a requirement , most variables have their default initilized values
but having a null object is not very useful is it..
depends on the situation. Gnerally - the variable isn't useful unless you've initialized it to some useful value.
I initialize values when i need them initially to have a value
or if its a value that i might read before any code assigns it a value
else i don't care i let it be null, zero, or w/e
Im following through Unity's programming stuff. I figured it would make more sense to set them as a float which i could change in the editor, but i wanted to see if theres like a reason its better. (Thanks BTW)
you public exposed in inspector ? rather than just assigned in code ?
data type float makes no difference
I have no clue which way is generally better, tryna iron this stuff out early
The exposed in the inspector variables are assigned with the initialized values, assuming they're not inside of the array or list.
If, outside of the list, you have an intention on making the value different than its Type's default, you should consider initializing them
depends on the situation, sometimes you want to change it in the inspector, sometimes they are kept private without SerializeField to change only in code
So correct me if im wrong, basically if i plan on changing and tweaking, use a public float, but if im happy with the value use it as a private initialized value?
also keep in mind Inspector values always takes precedence
unity also lets you expose private just by using the [SerializeField] attribute
but yeah generally its great for tweaking values and whatnot in inspector ofc
you dont have to keep compiling every change
Yes, but you have to keep in mind that non-serialized values aren't persistent across game sessions, assuming you want to change them somewhere in your code
Alrighty i get the jist. Big thanks to the coding dudes π
I asked around a bit yesterday about Newtonsoft vs. Json Utilities. I wanted a solution that would work for Android, PC, and WebGL at the same time, but it seems like Newtonsoft might have some issues with that whereas Json Utilities works across all platforms out of the box.
One problem I am having with Json Utilities is that as I create more dialogue options in my editor and save it to Json to deserialize and use in my game later, each node becomes increasingly large and cumbersome (since I cannot ignore fields with Json Utilities like I can with Newtonsoft). In this case, I still have yet to add character controls (show, hide, move), item awarding/removal, money modification, dialogue options, etc.
**Does anyone have suggestions of what I should look into to make this more scalable? **I don't work directly in the Json itself - instead using a custom editor window - but I think you'll see that when I do have to look at the Json, it's going to be harder and harder to do so with more options.
{
"dialogues": [
{
"nodeIndex": 0,
"speakerPath": "Assets/Resources/Characters/C_Alison.asset",
"dialogueText": "Hey, Jack! How are you doing today?",
"endNode": false,
"pathEnded": false,
"pathEndedText": "",
"jumpToNode": false,
"animationClipPath": "",
"sexSpritePath": "",
"talkSpritePath": "",
"backgroundImagePath": "",
"audioClipPath": "",
"musicClipPath": "",
"choices": [],
"nextDialogueJson": "",
"jumpToNodeIndex": 0
}
],
"dialogueType": "Talk"
}
You could always use scriptable objects
Make an IDialogueEvent interface. Have each dialogue hold a collection of them and invoke them when the dialogue is displayed.
Make sure to use [SerealizeReference] if you are using Unity JsonUtil
Those both sound like they are worth looking into
Scriptable objects are just another way of storing the data
I will say I'd like to keep the data searchable though. With Json I'm able to quickly ctrl+f mispellings or mis-connected nodes for example
Yea but you can create new scriptable objects in your projects folder with a lot of readability
What issues were you having with Newtonsoft? Havent used JsonUtility myself but iirc it will serialize the same fields that unity does. Usually for saving to json, you should create a separate class that contains only the information you want to save.
Depending what you're doing here, scriptable objects might not be good. Saving to file (whether that be using json or anything else) is completely different from scriptable objects.
Are you actually trying to save new data when the user is playing, or using this kinda as a database to read only at runtime
Thanks for the reply bawsi. I haven't personally run into issues regarding Newtonsoft, but reading some comments didn't inspire me to use it over the built-in option of Json Utilities. I can definitely be swayed back toward it, and maybe I should give it another shot since what I actually need it for is relatively simple.
What you're looking at is a dialogue file to be read by the dialogue manager. It's read only and doesn't need to be modified during runtime whatsoever. Any conditionals inside the Json are handled by outside scripts (ie., the player purchasing items, item removal, character movement)
You might wanna just try using Newtonsoft then, it is a bit better. Swapping between either one should only change a couple lines in total. Ideally all that code for writing/reading is in one place and other classes just use that code.
And yea if its read only you could just look into scriptable objects but it's not searchable out of the box like you wanted. Json might just be simpler here.
Okay I'm definitely going to give it a shot with some test builds on different platforms and see how it goes. This is probably where I want to be in terms of documentation for this, right? Just making sure I'm using the right resource for Newtonsoft https://www.newtonsoft.com/json/help/html/SerializingJSON.htm
Yea JsonConvert should be fine there. If you create separate classes that contain only what needs to be saved, you dont really need to mess around with the attributes either
Great. Thank you for your time I appreciate it.
Someone take a look at this code, it works fine but the results aren't what I'm looking for, I tried various fixes but nothing worked, what this script does is generates a 2d map using perlin noise, the problem is falloff doesn't work properly so the land is in the edges and not the middle, I tried gradually amplifying the strength, added a min and max value, and even tried setting limits because some seeds don't generate any land
So the falloff acts like it is inverted?
Psst. If you ask people to debug a large chunk of code, maybe stick around for a while.
i just noticed what was wrong thats why i deleted
i wanna propel my player backwards but every method i use doesnt work; any tips?
2d or 3d
show what you've tried and explain what it isn't doing that you are expecting it to do (or what it does instead)
3d
these r just placeholder values ive been messing with but i expect it to push the player back; instead it just does nothing
_cc.Move(transform.forward * _moveSpeed * Time.deltaTime);
heres the method i use to move
well first, !code π
second, that loop completes entirely within one frame. but if it isn't moving the player back at all then it depends entirely on what else is controlling the position
π 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.
but these are tank controls so idk if it might help as an example
it sets the player's velocity to zero but this is after that
Also are you sure that Launch is ever getting called?
I think animation events can be missed if they are on the first or last frame and you have transitions
"it" does not tell me anything. show the actual relevant code. but if you have a rigidbody on it, then why not use the rigidbody instead of attempting to override what the rb does by modifying the transform?
ah yeah, this is also a good point. they need to actually make sure the method is being called
shrug pretty sure i tried to AddForce but it didnt work as intended
will look @
ah yes "didn't work as intended" so descriptive about what is happening!
You can confirm with a simple Debug.Log in Launch
i dont understand why you have to be passive aggressive about it. AddForce did not move the player
rb.AddForce(-transform.forward * 2000f * Time.deltaTime);
well that's incorrect anyway
hence why i asked π
but if you want to play this game where you don't provide any useful info about your issue until i point out that you haven't then i'm not going to help you so good luck
im literally giving you the relevant script ?????
after i had to point out that you didn't actually provide any information and you got pissy about it and decided i was being passive aggressive. you can get help from someone willing to put up with that nonsense. i will not be helping you further
oookay
the thing i noticed didnt solve my problem
https://hastebin.skyra.pw/zagenotone.csharp
ok so what im trying to do is change the footstep parameter based on trigger
if you are wondering this is done in fmod
have you confirmed that OnTriggerStay is being called?
let me check with a debug
While you're at it check the tags of the thing you're colliding with
also might i suggest you change your system to instead use physics queries like a raycast and maybe a specific component attached to objects that tell your system what sound to play? that's what I do in my project, I've got a simple component that just holds data about what kind of footstep sound to play, then anything that can produce a footstep sound just fires a downward raycast each time a footstep should play (primarily from animation events), and if something is hit by the raycast i just use TryGetComponent to get that data component to get the relevant data i need to decide on what footstep to play
this would end up being a bit more accurate than using OnTriggerStay, especially in cases where multiple different objects that create different types of sounds overlap, it will actually get the top most one instead of whatever was more recently calling OnTriggerStay
Pretty much
And there are some seeds that don't generate any land, idk how to fix that
prove it
use this to debug why that is: https://unity.huh.how/physics-messages
Have you visualized the generated maps to see if they look correct?
Other than just the result
More than you believe, I checked multiple times and everything seemed normal, the way it works was what i intended it to be and everything, i tried various ways to fix this and while it had interesting impacts none of them solved the problem
Should I just scale it to the max and maximise the falloff map?
Wdym by scale? Like remap it into the minmax range for better visualization?
No literally make the plane as big as possible, scale up the perlin noise and maximise falloff strength
Not sure, you can try that if it helps you debug
Maybe showing us some images of the results and the maps would be helpful
It's more of an inconvenience
I don't know how to copy and paste a screenshot since I'm not on my pc rn, it is in #π»βunity-talk
Wait I can just ss.....
I was expecting min falloff to be less than max falloff
What if you swap those?
If I am trying to make isometric animations so a different animation for NE,NW, SE, SW should I be using state machines for this? Transitions for each of the 4 mentioned idle animations to their respective walk animations?
I am struggling to get a specific animation to work.
https://gdl.space/qodasotozi.cs
The walk and idle animation works, but the burrow and unburrow does not. The Debug logs output burrow and unburrow but no play of the animation.
Alr tried that
It makes the islands not in the middle and right on the edges which is the opposite of what I want
@kind karma Nvm I think I got it switched up
Too many inverses lol
I thought you were already having that problem. I'm unsure what the problem is at this point then
I'd start by showing the falloff and other textures as a debug view
The math seems ok to me but there might be something I'm missing
you should be using a Blend Tree im pretty sure
Two:some seeds don't generate land
By the way, Mathf.PerlinNoise mirrors itself when going from negative to positive or vice versa
So I wouldn't allow negative values, it will look weird/mirrored around zero
Unrelated to your problems but I think you should know
I didn't know that, thanks
It'll be good when the cursed biome gets introduced
Or dimension?
I might have to remove the threshold and retry side because it didn't fix the problem, just extra lines of code
Does anyone know why i get an error here? float distFromPlayer = Vector3.Distance(point - cam.transform.position);
ther error says
There is no argument given that corresponds to the required parameter 'b' of 'Vector3.Distance(Vector3, Vector3)'
takes 2 vectors
you gave just assuming 1
Try regenerating project files
Also check for the required package in the package manager.
right click the assembly csharp project in the solution explorer on the right in this last screenshot then select Reload With Dependencies
because it was already configured and just needed to properly reload the project. creating a completely new one allowed it to just load that new project . . .
thanks for helping
hi guys, I am learning Unity and try to follow a YT guide. The code on line 29 causes the error. I followed the YT clip exactly so I'm very confused. Please let me know if you need more info. I'm making a match 3 game
start by configuring your !IDE π
If your IDE is not autocompleting code
or underlining errors, please configure it.
Select one:
β’
Visual Studio (Installed via Unity Hub)
β’
Visual Studio (Installed manually)
β’
VS Code
β’
JetBrains Rider
β’ :question: Other/None
Thank you. I wonder why my code has no auto complete like the YT clip
I am trying to change the state of something following a space bar press
if (player.digButtonPressed && !previousDigButtonState)
{
// Toggle the burrowing state when the button is pressed
isBurrowing = true;
}
/*if (!isUnderground)
{
Debug.Log("burrow");
isBurrowing = true;
handleBurrowAnimationState(lastNonZeroMoveDirection);
isUnderground = true;
}
else
{
Debug.Log("unburrow");
isBurrowing = true;
handleUnburrowAnimation(lastNonZeroMoveDirection);
isUnderground = false;
}*/
// Store the current button state for the next frame
previousDigButtonState = player.digButtonPressed;
Debug.Log(isBurrowing);
// Play the current animation state
animator.Play(currentState);
I have this in my update but I think the isBurrowing only becomes true for one frame. How do I make this persistent until the next space bar press?
where is it being set to false? because nothing you've shown here assigns it to false
i assign to false as a class variable
private bool isBurrowing = false; // To track if a burrow/unburrow animation is playing
if that is the only location it is being set to false, then it is impossible for it to only be true for a single frame because once it is assigned to true, it remains that value until assigned to false again
show the full code because there is clearly context missing
Yes you are right sorry I was assigning it in another script.
if it was private how were you doing that?
the variable isBurrowing is public and changed in another script.
so then this line is not accurate
In this function (the setting to true/false is now commented out)
public void UseDigMechanism(){
digButtonPressed = gameInput.IsJumpPressed();
// If the player is digging, set isUnderground to true
if (digButtonPressed){
if (!isUnderground)
{
//isBurrowing = true;
//isUnburrowing = false;
// Trigger the burrowing animation here
isUnderground = true;
}
else
{
//isBurrowing = false;
//isUnburrowing = true;
// Trigger the unburrow animation here
isUnderground = false;
}
}
}```
unless that method is in the same class you showed before, or an inheriting class, then those isBurrowing variables are completely separate variables
It isnt in the same class no.
then it is not the same variable and assigning to that does not assign to the other
I am not sure why it changes then when I comment out those lines.
well until you show the full code like i asked, i have no way of knowing wtf you are doing
Okay here is the full animation script
https://gdl.space/unohucuyuc.cs
so that isBurrowing variable is private. so nothing outside of this class can affect it
I am trying to get the animations to show when pressing space bar
the function in line 60 is what I am struggling to get working
and at no point is it assigned false so it is always true after the first time it has been assigned true
that is an if statement, not a function
so it's clear you were pretty much just guessing at what the issue was before when you said it was because the isBurrowing variable is only true that frame. so what debugging have you actually done
so how can I progress towards getting the animation to play when space is pressed? I am getting that input correctly now.
Yeah I have debugged and shown that space "activates" the animation. It pops up for a split second. But then I guess goes straight back to the idle animation.
I guess this is due to what you say with isBurrowing only being true for a single frame?
have you actually printed out anything useful or used the debugger to step through the code to inspect the values of your variables? or are you just printing useless shit hoping you'll have an epiphany about the issue?
that is literally the exact opposite of what i have been telling you. you are the one who came to that conclusion. i have been telling you that is not what is happening
Are you always this harsh to people trying to figure out stuff? XD
TIL that not sugar coating information and not spoon feeding answers is being "harsh"
Well glad I could help you learn something
This is not even helpful
" have you actually printed out anything useful or used the debugger to step through the code to inspect the values of your variables? or are you just printing useless shit hoping you'll have an epiphany about the issue?"
if you don't plan on actually engaging with the question i am asking, then i don't plan on helping. good luck
yes because simple one word logs that don't provide any context whatsoever are useless
So what woudl your advice be?
just saying i told you yesterday before you ended
THE EXACT thing you need to debug.log
right here
Yeah, it was pretty late.
Is there a way to go back easily to previous messages from me on here?
discord has a search feature
just search them up i guess, not sure if theres an easier way
there's also a handy inbox you can refer to for messages that mention you
Oh yeah cheers
Pressing space changes this debug log
Debug.Log(isUnderground + " " + player.digButtonPressed);
between false false and true false.
so its not registering that the dig button has been pressed?
I think it is registering it only for a single frame
It is changing isUnderground between true and false.
But I have a ~10 frame animation that I want to play to transition between isUnderground being true and isUnderground being false.
I think if it only registers the button press for a single frame is does not play the full animation.
Or am I approaching this wrong?
well if you use a Trigger then it should complete the animation i think
I have not got transitions between my states though
as I have so many (NE,NW,SE SW etc)
which would be extremely easy using a Blend Tree, look up a tutorial / try it before working on any actual code that builds in your animations
its like 1 float and line of code to transition animations
Okay, I will take a look at that then and read about them
Cheers.
And so I would want to set up a blend tree to blend between the idle/walk/burrow/unburrow states for example?
And I would have 4, one for each direction.
well you would have for example
idle left, idle right, idle up, idle down that would be 1 tree or something
and you can do same for walk, burrow etc.
and you change between these using x, y floats, so -1, 1 would be up and left or whatever
Right, and I can send those floats to the tree to say which animation to play.
yes, its pretty simple and good
Okay, thanks for your help. I will take a look in the morning.
I've actually been learning Unity oriented C# properly! Does anyone see any issues with my code so far?
using UnityEngine;
using System.Collections;
public class CoroutinePathFollower : MonoBehaviour
{
public Transform[] destinations; // An array of target GameObjects to follow
public float speed = 5f; // Movement speed
public float startDelay = 1f; // Delay before starting the movement
Vector3 Init;
void Start()
{
Init = transform.position;
StartCoroutine(FollowPath());
}
IEnumerator FollowPath()
{
// Wait for the start delay
yield return new WaitForSeconds(startDelay);
// Iterate through each destination
foreach (Transform destination in destinations)
{
// Continue moving toward the current destination until close enough
while (Vector3.Distance(transform.position, destination.position) > 0.1f)
{
// Move towards the target position
transform.position = Vector3.MoveTowards(transform.position, destination.position, speed * Time.deltaTime);
// Wait until the next frame
yield return null;
}
}
this.gameObject.SetActive(false);
}
private void OnDisable()
{
// Reset state to allow reloading animation clip correctly
ResetPos();
// Without stopping the coroutine, foreach does not reset correctly. Unity or .NET bug?
StopCoroutine(FollowPath());
}
void ResetPos()
{
transform.position = Init;
}
}
- Your StopCoroutine() call is incorrect, and won't do anything. Which is also fine because it's completely unnecessary and can be deleted.
- some naming convention issues, like Init being capitalized unconventionally, as well as not having a very descriptive name.
Okay I need to ask. Unity Editor randomly locks up when I try and do things that trigger a code refresh. It reaches Inspector.InitOrRebuild and cycles there for hours or days straight
it never ends, it is wholly uninteractable and won't close or do anything responsive other than show the constantly increasing 'busy' clock. it's not using more memory nor more CPU
are you on an LTS version?
yes
I just updated the project too, and it still does it
this is a fresh project with no editor code
relatively fresh anyway
but no editor-side code at all that I've implemented
I mean... the stop coroutine call likely is incorrect, but it does solve the issue mentioned in the comment?
on 2022.3.45f1 right now
it's doing this like every 30-60 minutes at random
working on a new ECS project but it'll do stuff like this on any project I've ever done regardless of project and package files
not sure if the projects share any packages that would be abnormal to anyone
so what do I do?
having to force shutdown unity every hour or so ain't helping
So you have the vcs/plastic package installed?
that's my manifest
I'd rather not download a file on my phone. Share it correctly. !code
