#FirepointIssue

1 messages · Page 1 of 1 (latest)

abstract widget
#

It does not work 😂

#

sprite just moves to coordinates instead

#

oh wait, thats old vide

worldly storm
#

What is Firepoint set to in the inspector?

abstract widget
#

Its a child object of player

worldly storm
#

No, what is firepoint property of PlayerController set to?

#

Ah, it's not serialized

#

firepoint = GetComponent<Transform>();

#

this

abstract widget
#

private Transform firepoint; and firepoint = GetComponent<Transform>(); in Update

worldly storm
#

What do you think that line does?

abstract widget
#

Finds ...... fire point object?

#

I used firepoint = GameObject.Find("FirePoint").transform; but its just freezes character in one place

worldly storm
#

freezes?🤨

abstract widget
#

the player just cant move at all if i use firepoint = GameObject.Find("FirePoint").transform;

abstract widget
worldly storm
worldly storm
abstract widget
#

ill send the video

#

i am pressing arrows, or a or d, but player does not move.

#

i will try serialized field now

#

it does not work

#

sad TT

worldly storm
#

Share your current code.

abstract widget
#

ok

#

here is my player controller

worldly storm
abstract widget
#

nope

#

no errors in unity console either

worldly storm
#

So if you comment out firepoint = GameObject.Find("FirePoint").transform;, does it fix your movement?

abstract widget
#

yes

#

but if i put firepoint = GetComponent<Transform>(); instead character goes to (-3.0.15f.0)

worldly storm
#

What if you comment out firepoint and all the code that uses it?

abstract widget
#

Then i can move and shoot snowballs to the right

#

but firepoint location does not flip with the character and snowball hits character when sprite is facing left

#

and here is my snowball scripthttps://hastepaste.com/view/TwcX

worldly storm
#

That doesn't make sense.

#

Take a screenshot of your player controller inspector

abstract widget
#

ok

#

Sorry can’t take a screenshot since I am accessing desktop remotely, here’s a picture instead

worldly storm
#

I don't see the firepoint variable in the inspector. Did you comment it out?

abstract widget
#

currently yes

worldly storm
#

Okay.

#

Uncomment it. Get back to the state where your character didn't move.

abstract widget
#

ok

worldly storm
#

Then add debugs in your movement logic.

abstract widget
#

Ok

worldly storm
#
if (WallJumpCoolDown > 0.2f)
        {
            player.velocity = new Vector2(horizontalInput * speed, player.velocity.y);
            Debug.Log($"setting velocity to {player.velocity}");

            if (isWall() && !isGrounded())
            {
                player.gravityScale = 2;
                player.velocity = Vector2.zero;
                Debug.Log($"resetting the velocity");
                CreateDirt();
                anim.SetTrigger("WallSlide");

            }
            else
                player.gravityScale = 3;

            if (Input.GetButtonDown("Jump"))
            {
                Jump();
                CreateSnow();
                jumpSE.Play();
            }
        }
abstract widget
#

ok i put that in

worldly storm
#

What do you see in your console when trying to move?

#

Take a screenshot of the console

abstract widget
#

hmmm, nothing but error pops up now NullReferenceException: Object reference not set to an instance of an object
PlayerController.Awake () (at Assets/Scripts/PlayerController.cs:37)

worldly storm
#

Share the updated script

abstract widget
#

ok

#

Btw this happens if I put get component <transformer> instead

#

updated code with debug

worldly storm
#

ufff

#

okay

#

The name here is wrong:
firepoint = GameObject.Find("FirePoint").transform;

It should be "Firepoint".

abstract widget
#

o,like in ispector?

#

lets see

#

OMG ITS WORKING NOW

#

I FEEL SO STUPID

#

THANK YOU SO MUCH

worldly storm
#

You were probably getting errors before(when your character didn't move). Always check your console for errors. Hiding the regular message logs can help you see the errors.

abstract widget
#

I see.

#

So happy now