#πŸ’»β”ƒcode-beginner

1 messages Β· Page 481 of 1

snow warren
#

Ok so i am encountering an error

#
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?

grave forge
#

why these errors pop up when i open pro builder

rich adder
snow warren
#

thats why i resorted here

rich adder
#

thats what debugging is for πŸ™‚

#

sounds like you have circular logic or initializing the same object over and over somehwere

rich adder
# snow warren yea

well we can't debug values for you , start debugging , print name of object being processed, etc

snow warren
#

i disabled the initialize again from here

#
                    {
                        Initialize(Object.transform.GetChild(i).gameObject);
                    }```
#

i removed it

#

but still it is showing the same error

rich adder
# snow warren 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
snow warren
#

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

rich adder
#

you have no i++ btw

snow warren
rich adder
#

for (int i = 0; i < count;)

#

where is your increment

snow warren
#

i am really dumb

rich adder
#

it happens πŸ˜›
Let the VS/VSC write th loop for you

timber tide
#

I'm surprised that doesnt throw an error without another ;

snow warren
#

the for loop doesnt end

#

unless you break it

#

just like a while

rich adder
timber tide
#

but if you want to skip the first you do need the first ;

rich adder
#

ye

#

for (; i < count; i++)

snow warren
#

is there a way to duplicate an object with code

#

like duplicate a gameobject

#

without using instantiate

rich adder
#

Instantiate literally clones πŸ˜›

snow warren
#

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

rich adder
#

yea look in the Instantiate

snow warren
#

and then assigning parent

snow warren
#

ok let me

#

worked

#

but still some errors for me

deep yew
snow warren
slender nymph
eternal falconBOT
snow warren
deep yew
#
   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

languid spire
eternal falconBOT
deep yew
#

Problems: Doesn't turn left when pressed A, D does inf turns, S in inverted

languid spire
deep yew
languid spire
golden ermine
#

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?

fickle plume
#

@golden ermine Don't cross-post

golden ermine
fickle plume
golden ermine
snow warren
#

I have a question

#

lets suppose i have an image that acts as a viewport

#

and i have some other images inside it

fickle plume
#

@snow warren Post code

snow warren
#

and now i want a component that expands the viewport depending on how many other images are inside it

snow warren
#

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?

fickle plume
snow warren
#

arent components also C#?

fickle plume
#

Ask there

snow warren
#

ok

queen adder
#
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.

outer wigeon
#

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?

queen adder
outer wigeon
queen adder
weak cedar
#

System.Text.Json is an option too

queen adder
queen adder
outer wigeon
#

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

queen adder
#

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.

outer wigeon
#

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

queen adder
#

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))
        );
    }
}
outer wigeon
#

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

queen adder
#

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.

slender nymph
outer wigeon
#

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.

rapid harbor
#

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.

eager thunder
#

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);

wet raptor
#

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.
rapid harbor
wet raptor
#

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

rapid harbor
#

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

wet raptor
#

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?
rapid harbor
#

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

wet raptor
#

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.

rapid harbor
eager thunder
#

is there something simulur to addforce?

weak cedar
#

set rb's velocity by urself

rapid harbor
weak cedar
eager thunder
#

im not using rigidbody for the character

weak cedar
#

Why are you trying to find smt similar to addforce?

#

To move the character or something complexer?

eager thunder
#

i just want to add a forward movement with a jump

weak cedar
#

Using a rigidbody seems perfectly fine for your case

copper hornet
#

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?

slender nymph
#

wdym when you "try to do it manually using code"? how are you doing that?

livid ravine
#

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

copper hornet
slender nymph
#

well GameObject.FindGameObjectWithTag searches the scene. prefabs are not in the scene

copper hornet
#

then I did bullet = (GameObject)Resources.Load("Assets\Prefabs\BulletBasic");

#

(I made a prefabs folder)

slender nymph
#

that's using Resources.Load incorrectly

#

either way though, the SerializeField option is the superior option and you should use that when possible

copper hornet
#

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

slender nymph
#

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

copper hornet
#

ah okay

#

I assumed that SerializeField was using Find under the hood

slender nymph
#

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

copper hornet
#

i'll just use SerializeField then, thanks

marble hemlock
#

YIPEE IVE DISCOVERED ANOTHER BUG I DONT KNOW HOW TO FIX :D

marble hemlock
#

every time i make progress something random appears

rancid mortar
#

What happend

marble hemlock
# rancid mortar What bug

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

rancid mortar
#

So I can help

weak cedar
#

isBeingHeld = false at default

rancid mortar
#

When I get home I can help or maybe even give

#

Script

rancid mortar
#

I assume u set parent so when setting it just set bool to true

marble hemlock
#

would it be an else thing?

rancid mortar
#

And when picking up

#

Check if bool is false

#

Or true

weak cedar
#

if it is dont pick up

slender nymph
weak cedar
#

if it's false, pick it up and set isBeingHeld to true

rancid mortar
slender nymph
#

there is no need for an extra bool for this. use the data you already have

marble hemlock
#

i will attempt and report πŸ‘

slender nymph
#

it's literally not

rancid mortar
slender nymph
#

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)

weak cedar
#

I mean are they going to pick up only a single thing throughout the game?

marble hemlock
#

i did have a random "SomethingIsEquipped" bool that i didnt use

marble hemlock
#

i mean it just gets turned on and off

rancid mortar
#

But name it better

marble hemlock
#

my own script is confusing me i need to put more comments down 😭

rancid mortar
marble hemlock
#

one of the times i dont go for a tutorial and somehow i counter myself notlikethis

rancid mortar
#

U can send me ur script in dms and I can do it for u

marble hemlock
#

i gots to learn it

rancid mortar
#

Or I can give mine script

rancid mortar
marble hemlock
#

GOT IT UnityChanThumbsUp

#

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 πŸ€·β€β™‚οΈ

alpine wraith
#

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?

snow warren
#

I am having some trouble

swift elbow
snow warren
#

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

snow warren
#

it should be outside with the simple Cube

#

but it shows all components as child object

#

any way to fix this issue?

timber tide
#

always start from the root then compare downwards

#

for each child to that object

snow warren
timber tide
#

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

snow warren
#

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

snow warren
#

seeing i am not generating a list

#

i just getting values and adding them to scene

#

so its a bit fast

#

and less complex

timber tide
#

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

snow warren
#

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

south sky
#

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

snow warren
#

aside from the 2d template you are provided with

south sky
snow warren
#

2D mobile is better

hallow sun
strong wren
#

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

  1. Unfreeze my game
  2. 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

deft grail
#

check the input field first, THEN do the multiplayer stuff

weak cedar
#

If two objects have oncollisionenter, which one gets called first?

deft grail
snow warren
#

finally made it

#

how does it look?

wet raptor
#

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.
deft grail
wet raptor
#

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");
            }```
deft grail
#

Debug.Log(isUnderground + " " + player.digButtonPressed);

tawdry trench
#

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;
    }
}
deft grail
strong wren
tawdry trench
strong wren
deft grail
deft grail
modest dust
tawdry trench
modest dust
#

You can see them by googling "unity editor logs" and clicking on the first link which would open up the docs

strong wren
#

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

fading mountain
#

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?

modest dust
#

Keep it simple

timber tide
#

end screen talks to the UI Manager to update text

modest dust
#

If you already have a singleton then make a use of it

fading mountain
#

I understand how to implement this but I'm not sure how to it in a clean, scalable way

timber tide
#

if what you're doing works then just do it honestly

#

I usually like to have a singleton class for the canvas

fading mountain
#

if you have a singleton class for the canvas would the canvas have to be in every scene?

timber tide
#

it's an overlay for all scenes, yes

#

it's used for fade transitions and all that jazz

fading mountain
#

that's an great way to do it yeah

queen adder
#

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

deft grail
queen adder
#

not sure how

deft grail
robust cape
#

can someone pls teach me how to correctly set up cinemachine for a 3d camera follow thingy (like minecrafts f5 non facing yourself pov)

queen adder
#

what would i put as the x y and z

#

i cant put in the player transform again

deft grail
queen adder
#

oohh right yeah oops

vestal adder
#

!code

eternal falconBOT
vestal adder
#

hi i am not sure why my roll script is not working

deft grail
vestal adder
#

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

deft grail
vestal adder
#

i use ienumerator so i can change exactly how long it lasts for

#

this script did work before implementing the new input system

deft grail
#

your using a timer

#

you can do the exact same thing in Update

vestal adder
#

oh really

#

i thought "while" statements only work in ienumerators

deft grail
vestal adder
#

how do i do that

deft grail
vestal adder
#

that makes sense

deft grail
#

and wrap this all under the isRolling bool of course

vestal adder
queen adder
#

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);
    }
}
eternal needle
real falcon
#

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

merry oxide
#

can you send the testraycast method?

real falcon
#

yet the magenta line doesn't even appear (even before the red line was there)

merry oxide
#

you could maybe be using hit.point?

real falcon
#

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

merry oxide
#

oh maybe I'm misreading your code sorry

real falcon
#

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

merry oxide
#

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

real falcon
#

is there any way I can make the inspector show world position

real falcon
#

no default option for that???

#

insane

merry oxide
#

nah, you can change the local space/world space gizmo for moving objects in the scene view though

real falcon
#

but oh well, I still don't understand why the raycast isn't working or even showing the debug line

merry oxide
#

idk what version you're using so it may have changed what it looks like

merry oxide
real falcon
#

the magenta one in CanSeeLOS

#

it draws between targetLoc and origin

merry oxide
#

Oh

#

debug.drawray

#

wait no that's debug.drawline

real falcon
#

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

merry oxide
real falcon
#

but when it doens't they don't

#

I'm saying when I disable the red ray

merry oxide
#

ahh gotcha

#

I figured you tried that

real falcon
#

I added that one because i was going insane

merry oxide
#

LOL

real falcon
#

and then it WORKED

#

which doesn't make any sense

merry oxide
#

ok so

#

actually it does

#

wait wtf

#

nvm

real falcon
#

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

merry oxide
#

still no magenta line?

#

perhaps it's getting rendered over by another gizmo? like the navmesh

real falcon
#

no because sometimes I see it

#

the enemies coming from the other side show it just fine

merry oxide
#

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

real falcon
#

right here you can see this time the magenta appeared on SOME of the enemies

merry oxide
#

you should probably debug the parameters in the method too

real falcon
#

yeah there seems to be some kind of issue

#

the coordinates in the debug though dont seem to match what I see

merry oxide
#

because they are pointing to 0,0,0

real falcon
#

not according to the debug line

merry oxide
#

is first notice inside of that method?

#

I'm saying debug.log inside that method, to make sure that those values are matching

real falcon
#

it's one line before the call

merry oxide
#

yeah put it inside the method too

#

if you want

#

that's what I would do

real falcon
merry oxide
#

AHA

real falcon
#

I have NEVER seen a value change from being passed into a method

merry oxide
#

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

real falcon
#

no it still sets it to nearly zero

merry oxide
#

now that is weird

#

maybe put the debug.log at the top of the method

real falcon
#

im gonna try it on a line of its own directly after

merry oxide
#

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

real falcon
#

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

merry oxide
#

I assume agent is a navmeshagent, but yeah that should be fine

real falcon
#

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 -=

slender nymph
#

note that direction is (endPosition - startPosition), so your direction goes from origin to targetLoc. however your DrawRay starts at targetLoc

teal viper
real falcon
#

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

merry oxide
#

but that could be intentional

real falcon
#

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

real falcon
#

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

sick ocean
#

There is no shortcut for UnityEngine

deft grail
eternal falconBOT
deft grail
#

need to configure it

real falcon
#

ugh... getting more stupid nonsense..

fickle plume
#

@real falcon If you don't have anything constructive to say, don't post it here.

real falcon
#

nvm I figured it out, this time it WAS because the parameters were reversed

autumn wolf
#

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

fickle plume
#

Pick any of them as starting point and rotate towards another by 30 degrees?

autumn wolf
#

yeh I don't know how to do that in code

fickle plume
kindred comet
#

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

teal viper
# kindred comet

You can't deserialize a custom format and you can't deserialize a dictionary with JsonUtility by default.

fickle plume
#

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)

teal viper
kindred comet
#

Ok

#

I'm confused tho

#

If I do this it works

#

What's the difference

teal viper
#

You shouldn't be writing json by hand anyway

solar arrow
#

!code

eternal falconBOT
drowsy oriole
#

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

crystal chasm
#

Just instantiate the object, and then use yourInstantiatedGameObject.transform.parent = yourparentGameObject.transform;

#

.tranform.parent =

drowsy oriole
#

ok

eternal needle
crystal chasm
#

You'll have to use = parentObject.transform

vestal adder
#

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

fallen lava
#

I cant load my game pls help

#

Im using SCEMA-Runemark Studio

drowsy oriole
snow warren
rancid mortar
drowsy oriole
rancid mortar
# drowsy oriole 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

drowsy oriole
#

ok

#

oh

#

ok

#

gotcha

rancid mortar
pearl nexus
#

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}");
        }
    }
}

eternal needle
pearl nexus
#

I fixed it

drowsy flare
#

Any ideas why unity doesn't seem to respect my pivot point when displaying a sprite in a UI image?

snow warren
#

how to delete a gameobject through C#?

#

whenever i use Destroy(Object)

#

it tries to destroy only the rect transform

languid spire
#

Object.gameObject ?

wintry quarry
fallen lava
#

Im using SCEMA-Runemark Studio and i cannot load scene pls help

#

😭😭😭

teal viper
teal viper
#

Just read the errors

fallen lava
#

the "MainMenu" is ticked and still not loaded

#

and loading the "MainGame" got the same problem

teal viper
fallen lava
teal viper
snow warren
teal viper
#

If they do loaf it, they should probably know that.

teal viper
#

I'd assume that they're relying on a feature of that assed they are using without actually understand it

fallen lava
#

wdym? ;-; (i didnt write that code)

snow warren
#

lol

teal viper
teal viper
#

You'll need to read it's manual and learn how to work with it.

fallen lava
teal viper
#

No one here knows about that asset, so we can't help you.

#

You'll need to ask the devs or in their community

eternal needle
#

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

teal viper
# fallen lava

Also, the error talks about a different scene. You got me confused there.

fallen lava
#

wait i js realized that i cant load the scenes that i got online as assets

fallen lava
teal viper
sick ocean
#

vc anyone ?

vernal ore
#

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?

languid spire
vernal ore
#

Since I set the blocking mask to Nothing, it shouldn't be blocked by anything (it should fail)

languid spire
#

Nothing means, nothing, so nothing is blocking

vernal ore
#

Then why do i only trigger the OnPointerDown once, when I have two overlapping images?

languid spire
#

because the top image picks up the hit

vernal ore
#

So the top image blocked...

languid spire
#

no, that is not blocking

vernal ore
#

what's blocking?

languid spire
#

blocking is when you have 2 overlapping images and you set the top image not to block so the underlying image gets the hit

vernal ore
#

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

graceful quest
#

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.

steep rose
#

You can make a dictionary or an array and just find all of them on runtime if you want

marble hemlock
#

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

gusty topaz
#

ps there a way to make a 3d model solid exactly to fit it

amber spruce
#

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)

verbal dome
graceful quest
#

Yes I had thought via script, dynamically.
I was hoping for something from editor, though.
@steep rose @marble hemlock

steep rose
#

Doesnt seem like it unless you wish to manually place them there

verbal dome
#

Are you asking about colliders? @gusty topaz

gusty topaz
#

yes

verbal dome
#

There is MeshCollider

gusty topaz
#

i tried that but it didnt work

steep rose
#

Or if 2d then polygoncollider

steep rose
marble hemlock
gusty topaz
#

its

steep rose
#

If it is invisible, then it's doing its job

gusty topaz
#

it has 2 parts and its a prefab

verbal dome
#

That doesnt answer the question "in what way it doesnt work"

steep rose
#

Show us more details

marble hemlock
#

I feel like we're talking about different things mb

graceful quest
steep rose
marble hemlock
#

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.

steep rose
#

Okay so do that?

marble hemlock
#

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

steep rose
#

Why wouldn't you look for a specific script type?

#

Seems to be a good option

marble hemlock
#

That would be a lot of scripts to check for ;-;

steep rose
#

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

teal viper
#

Then you just need to check for the base class

steep rose
#

Or this ⬆️

teal viper
#

Or an interface

marble hemlock
#

Back to learning classes again notlikethis

amber spruce
#

how do i add force in the direction the character is already moving

steep rose
#

Using its velocity

short hazel
#

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

lapis frigate
#

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

steep rose
#

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

lapis frigate
#

I couldn't find any tutorials for that

burnt vapor
#

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

queen adder
spark knoll
#

Hey,
is someone available who can take a look on my animator and codes??

steep rose
#

Also !ask

eternal falconBOT
spark knoll
# steep rose Also !ask

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

steep rose
#

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

eternal falconBOT
#

:teacher: Unity Learn β†—

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

spark knoll
wet raptor
#

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.

rocky canyon
#
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

steep rose
#

Have you used the animator before?

wet raptor
rocky canyon
#

huh? lol

#

really?

wet raptor
#

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.
rocky canyon
#

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?

wet raptor
#

It shows unburrow as the first log and then burrow on the second. It's flipped

rocky canyon
#

ohh its flipped

wet raptor
#

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.

rocky canyon
#

well thats an easy fix

#

just flip the logic

wet raptor
#

yeah, I get that I can do that. But I dont really understand why.

rocky canyon
#

does it match the state u assume in the logic

wet raptor
#

I am not sure, how do I find that out?

rocky canyon
#

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

wet raptor
#

I guess this is not ideal set up.

rocky canyon
#

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

wet raptor
#

I just have isIdle_NE in there. So that might be an issue?

#

Maybe I need to set that up as a parameter.

rocky canyon
#

can u share ur entire code first?

#

!code

eternal falconBOT
rocky canyon
#

i'd like to see what these booleans actually are

#

i think im assuming some things that arent true lol

wet raptor
#

From the animator script?

rocky canyon
#

the script ur working w/

#

this one..

#

i just wanna see the references..

#

what player is.. what isUnderground is etc

wet raptor
#

Is that the way to put text here?

rocky canyon
#

well that'll work.. but for future reference.. use one of the paste-bin websites..

wet raptor
#

I did...

#

The gdl one

rocky canyon
#

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

wet raptor
#

Ahhhh

rocky canyon
#

yup, just like that

#

πŸ‘

#

soo player is just another script.. w/ its own booleans

wet raptor
#

yes

rocky canyon
#

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

wet raptor
#

Thanks for this

#

Banging my head against the wall

rocky canyon
#

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

wet raptor
#

thats it yeah

rocky canyon
#

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

wet raptor
#

And yet pushing space first time gives this

rocky canyon
#

ya i see what u mean.. that first log should be burrow

wet raptor
#

Yes

rocky canyon
#

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

wet raptor
#

Yes

#

it is

rocky canyon
#

.. well what tf

#

lol

wet raptor
#

Glad that I am not missing some noob thing then

rocky canyon
#

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

wet raptor
#

I have gameinput that is being read by the player script

rocky canyon
#

ya, but i looked at ur player script.. ur not changing the bool except in that if/else Button check conditional

wet raptor
#

yeah

rocky canyon
#

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

wet raptor
#

yeah

#

okay

rocky canyon
#

soo this line doesnt even do anything lol

#

b/c u dont ever use the isUnderground from the PlayerAnimator

#

just player.isUnderground

wet raptor
#

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?

rocky canyon
#

yea it has to be something like that

#

the top two logs should match

#

unless something changed it between the 2

wet raptor
#

Yeah, I cannot figure this out :/

rocky canyon
#

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)

#

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

wet raptor
#

Okay cheers

rocky canyon
#

good luck

ebon ore
#

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

wintry quarry
ebon ore
#

if i log the arrays from grid's script then it actually shows correct values

wintry quarry
#

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.

ebon ore
#

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?

wintry quarry
#

Or you're doing so at different times

#

When the array contains different values

ebon ore
#

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")

wintry quarry
#

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

ebon ore
#

how can i check if im referencing the correct instance?

rich adder
#

do you have a class called Grid btw ? be careful with that, unity has its own Grid component

wintry quarry
rich adder
#

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

elder glade
#

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.

rich adder
#

logic looks wonky

elder glade
rich adder
#

I only see 1 , this is a 50/50 chance question UnityChanLOL

#
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} ");}}
elder glade
rich adder
steep rose
#

!learn

elder glade
#

Should I start the Program now?

eternal falconBOT
#

:teacher: Unity Learn β†—

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

elder glade
elder glade
rich adder
fluid kiln
#

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

amber spruce
short hazel
#

Yes

#

Weird coincidence, you replied the second I logged on, I was away for a few hours

amber spruce
#

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

willow scroll
amber spruce
queen adder
languid spire
fluid kiln
languid spire
torpid snow
#

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 πŸ˜„

languid spire
rich adder
#

but having a null object is not very useful is it..

wintry quarry
rocky canyon
#

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

torpid snow
rich adder
#

you public exposed in inspector ? rather than just assigned in code ?

#

data type float makes no difference

torpid snow
#

I have no clue which way is generally better, tryna iron this stuff out early

willow scroll
rich adder
#

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

torpid snow
#

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?

rich adder
#

also keep in mind Inspector values always takes precedence

rich adder
#

but yeah generally its great for tweaking values and whatnot in inspector ofc

#

you dont have to keep compiling every change

willow scroll
torpid snow
#

Alrighty i get the jist. Big thanks to the coding dudes πŸ˜„

outer wigeon
#

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"
}
weak cedar
#

You could always use scriptable objects

thorny basalt
#

Make sure to use [SerealizeReference] if you are using Unity JsonUtil

outer wigeon
#

Those both sound like they are worth looking into

thorny basalt
#

Scriptable objects are just another way of storing the data

outer wigeon
#

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

weak cedar
eternal needle
# outer wigeon I asked around a bit yesterday about Newtonsoft vs. Json Utilities. I wanted a s...

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

outer wigeon
# eternal needle What issues were you having with Newtonsoft? Havent used JsonUtility myself but ...

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)

eternal needle
outer wigeon
eternal needle
outer wigeon
kind karma
#

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

verbal dome
#

Psst. If you ask people to debug a large chunk of code, maybe stick around for a while.

quick kelp
#

i just noticed what was wrong thats why i deleted

mortal spade
#

i wanna propel my player backwards but every method i use doesnt work; any tips?

quick kelp
#

2d or 3d

slender nymph
mortal spade
#

3d

mortal spade
quick kelp
#

_cc.Move(transform.forward * _moveSpeed * Time.deltaTime);
heres the method i use to move

slender nymph
eternal falconBOT
quick kelp
#

but these are tank controls so idk if it might help as an example

mortal spade
verbal dome
slender nymph
slender nymph
mortal spade
slender nymph
verbal dome
mortal spade
slender nymph
#

well that's incorrect anyway

mortal spade
#

hence why i asked 😭

slender nymph
#

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

mortal spade
slender nymph
#

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

mortal spade
#

oookay

quick kelp
slender nymph
#

have you confirmed that OnTriggerStay is being called?

quick kelp
#

let me check with a debug

wintry quarry
#

While you're at it check the tags of the thing you're colliding with

slender nymph
#

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

kind karma
#

And there are some seeds that don't generate any land, idk how to fix that

quick kelp
#

ok so ontriggerstay is not being triggered

#

and both triggers are properly set up

wintry quarry
slender nymph
verbal dome
#

Other than just the result

kind karma
verbal dome
kind karma
verbal dome
#

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

kind karma
#

It's more of an inconvenience

kind karma
#

Wait I can just ss.....

verbal dome
# kind karma

I was expecting min falloff to be less than max falloff

#

What if you swap those?

wet raptor
#

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.

kind karma
verbal dome
#

@kind karma Nvm I think I got it switched up
Too many inverses lol

verbal dome
#

I'd start by showing the falloff and other textures as a debug view

kind karma
#

It's 2 problems

#

One: falloff

verbal dome
#

The math seems ok to me but there might be something I'm missing

deft grail
kind karma
#

Two:some seeds don't generate land

verbal dome
#

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

kind karma
#

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

tawdry trench
#

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)'

deft grail
#

you gave just assuming 1

tawdry trench
#

oh shit yeah i just reliased sa i sent it lol

#

ty

sick ocean
#

not working

teal viper
#

Also check for the required package in the package manager.

slender nymph
# sick ocean

right click the assembly csharp project in the solution explorer on the right in this last screenshot then select Reload With Dependencies

sick ocean
#

I created a new project and the problem was solved

#

i dont know how

slender nymph
#

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 . . .

sick ocean
#

thanks for helping

devout onyx
#

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

slender nymph
#

start by configuring your !IDE πŸ‘‡

eternal falconBOT
devout onyx
wet raptor
#

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?

slender nymph
#

where is it being set to false? because nothing you've shown here assigns it to false

wet raptor
#

i assign to false as a class variable
private bool isBurrowing = false; // To track if a burrow/unburrow animation is playing

slender nymph
#

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

wet raptor
#

Yes you are right sorry I was assigning it in another script.

slender nymph
#

if it was private how were you doing that?

wet raptor
#

the variable isBurrowing is public and changed in another script.

slender nymph
wet raptor
#

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;
            }
        }
        

        
    }```
slender nymph
#

unless that method is in the same class you showed before, or an inheriting class, then those isBurrowing variables are completely separate variables

wet raptor
#

It isnt in the same class no.

slender nymph
#

then it is not the same variable and assigning to that does not assign to the other

wet raptor
#

I am not sure why it changes then when I comment out those lines.

slender nymph
#

well until you show the full code like i asked, i have no way of knowing wtf you are doing

wet raptor
slender nymph
#

so that isBurrowing variable is private. so nothing outside of this class can affect it

wet raptor
#

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

slender nymph
#

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

wet raptor
#

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?

slender nymph
#

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?

slender nymph
wet raptor
#

Are you always this harsh to people trying to figure out stuff? XD

slender nymph
#

TIL that not sugar coating information and not spoon feeding answers is being "harsh"

wet raptor
#

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?"

slender nymph
#

if you don't plan on actually engaging with the question i am asking, then i don't plan on helping. good luck

slender nymph
wet raptor
#

So what woudl your advice be?

deft grail
#

just saying i told you yesterday before you ended
THE EXACT thing you need to debug.log

wet raptor
#

Yeah, it was pretty late.

Is there a way to go back easily to previous messages from me on here?

slender nymph
#

discord has a search feature

deft grail
#

just search them up i guess, not sure if theres an easier way

slender nymph
#

there's also a handy inbox you can refer to for messages that mention you

wet raptor
#

Oh yeah cheers

wet raptor
# deft grail right here

Pressing space changes this debug log
Debug.Log(isUnderground + " " + player.digButtonPressed);
between false false and true false.

deft grail
#

so its not registering that the dig button has been pressed?

wet raptor
#

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?

deft grail
wet raptor
#

I have not got transitions between my states though

#

as I have so many (NE,NW,SE SW etc)

deft grail
#

its like 1 float and line of code to transition animations

wet raptor
#

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.

deft grail
wet raptor
#

Right, and I can send those floats to the tree to say which animation to play.

deft grail
wet raptor
#

Okay, thanks for your help. I will take a look in the morning.

vagrant harness
#

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;
    }
}
wintry quarry
little dust
#

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

little dust
#

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

vagrant harness
little dust
#

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

teal viper
little dust
#

that's my manifest

teal viper
#

I'd rather not download a file on my phone. Share it correctly. !code