#it seem as my script is running properly

1 messages · Page 1 of 1 (latest)

upper siren
#

@sonic solar is there something preventing the animation to change and the gameObject to move?

sonic solar
#

why am i tagged in this tho

upper siren
#

sorry

upper siren
sonic solar
#

anyway Ill help this time but, refrain from doing it agian

#

you would have to start debugging the issue, its important to learn how to debug

#

I would start by checking if the logs are printing, if they are I would check the Animator for the object in question while selected in PlayMode

#

If you're seeing the animator is in the correct state, then move on finding out why the animations you put aren't moving

upper siren
#

first im sorry I thought in this case it was ok
" @ or reply to people not in the conversation. Use common sense here, please."

sonic solar
#

lol not sure we were in any active convo prior buts its fine this time

upper siren
#

and I printed the some logs and saw that the 'transform.position' ia reseting every 'Update' so it always stay put

sonic solar
#

thats not the log I was talking about

#

anim.GetBool

upper siren
#

that as well, changed to true

sonic solar
#

are u sure you referenced the correct animator? also which part would be the moving code?

upper siren
#

double checked and the animation is ok (the default was the running animation apperantly and i forgett to animate the legs so thought it didnt update correctly)

#

but the position of the object didnt change

#

i printed the targetPosition and the transform.position and they werent close so it should have moved it ):

sonic solar
#

you'd have to send the full script

#

!code

obtuse cobaltBOT
sonic solar
#

use links

upper siren
#

thanks for your patient haha
i have 9 years of experience as full-stack (JS/TS) but im new at C# and unity

sonic solar
#

minX, minxY etc.

upper siren
#

its within the border of the view

sonic solar
#

put Debug.Log after
targetPosition = new Vector2(randonX, randonY);

#

Debug.Log(targetPosition)

#

btw this is the same function as print

upper siren
#

cool

sonic solar
#

only difference print doesn't work outside Monobehavior classes

upper siren
sonic solar
upper siren
#

its as it tries to move but on the next frame it start from the same position

#

there for not moving at all

#

but on the view i dont see any movment from the position

sonic solar
#

screenshot it in playmode

#

whole scene no crop

upper siren
#

what do you mean?

sonic solar
#

the screenshot you sent earlier is a prefab

upper siren
sonic solar
#

you would not see any values change if you havent selected the spawned instance in the scene / hierarchy

upper siren
#

its the active one

sonic solar
#

where is speed

#

how do you not have a compiler error/underlined red in editor

upper siren
sonic solar
#

oh why is it not in the script you sent

upper siren
#

it inherited it

sonic solar
#

ohh this is an inherted class just noticed

upper siren
#

and you can see from the logs it does advances a littttle towards the target but on the next frame when i print the position it the same as it was at the begining

sonic solar
sonic solar
upper siren
#

same

upper siren
sonic solar
#

are they any other scripts?

#

I dont see anything in code itself making it do that

upper siren
#

only those 2 for this charecter

#

1 and parent

sonic solar
#

wait wdym 2?

upper siren
#

only 1 script and the inheriting one

#

Enemy -> EnemySummouner

sonic solar
#

wait how many script does enemy have

upper siren
#

only 1

sonic solar
#

only thing I can think it can be maybe is somehow your Time was Timescale 0 or something

upper siren
#

but we can see it did go farward every Update, but for some reason strarted from the original position on the next frame

#

there might be any colision?

sonic solar
#

just tested it

#

script is fine

#

Might be the rigidbody

#

although transform.position should override it

#

yeah no I put a rigidbody and its fine

#

something on your end isn't correct

upper siren
#

no collision ):

    Debug.Log("Collision Detected with: " + collision.gameObject.name);
}
#

darn this is hard haha

sonic solar
#

try putting this script on new plain box

upper siren
#

did i do it right?

sonic solar
#

is it working

upper siren
#

yes!!!!!

sonic solar
#

yeah not sure whats good with ur other gameobject lol

#

double check differences

upper siren
#

had to comment out the animation

#

but still the first one didnt move

sonic solar
#

yeah something is up with that one but Im not seeing anything obvious from here

upper siren
#

ill try to recreate the prefab

sonic solar
#

you didnt mark the summoner as static by any chance?

upper siren
#

and test it every step

#

i dont think so, where is this?

sonic solar
#

thought you had this checked

upper siren
#

omg it is

sonic solar
#

aghhh

upper siren
#

nono

#

its not marked

sonic solar
#

oh ok

upper siren
#

i thought its a scroll option haha

sonic solar
#

yeah looks fine

upper siren
#

was happy for a sec hahaha

#

ok ill have to retry it all

#

ill let you know (;

#

thanks a lot for all the help!

sonic solar
#

no prob! goodluck 🫡

upper siren
#

it has something to do with my animation controller

sonic solar
#

what exactly ?

#

unless you unimated the transforms o

#

but I did asked if it still was broken when you disabled animator

upper siren
#

maybe, im testing it now

#

i thought i tested it but i guess i was wrong

#

i think i have a clue!

#

i might animated the container of all the parts instead of the body

#

not sure how to check it though

sonic solar
#

open the animation clip

upper siren
#

ok its working with the animation now