using System.Collections.Generic;
using UnityEngine;
public class yon : MonoBehaviour
{
float inputVertical;
float inputHorizontal;
bool facingRight = true;
public Transform AttackArea;
private Vector3 scaleChange, positionChange;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
void FixedUpdate()
{
inputHorizontal = Input.GetAxisRaw("Horizontal");
inputHorizontal = Input.GetAxisRaw("Vertical");
if (inputHorizontal > 0 && !facingRight)
{
flip();
}
if (inputHorizontal < 0 && facingRight)
{
flip();
}
}
void flip()
{
Vector3 currentScale = gameObject.transform.localScale;
currentScale.x *= -1;
gameObject.transform.localScale = currentScale;
facingRight = !facingRight;
}
}```
#Trying to flip AttackArea after moving to left and right after walking to right
1 messages · Page 1 of 1 (latest)
ohhh
@full cairn
i see, I guess you know what to do from there
thx
there's an empty field where it shouldnt be empty
I put AttackArea there but it still doesnt work
I dont get any errors but
Doesnt flip the AttackArea
you should put the player thing
okay
It gets activated when I click mouse button
oh okay.. put the yon in the player then
updates dont get called in inactive objects
I tried yon in player
I'm not trying to flip the player
then activated attackarea and
tried
add a child to that player, then put yon there
then make attackarea child of that object
player - ON
YON - ON
AttackArea - OFF```
Should look like this in the inspector
okay did it
works now?
which one should I put into the transform of script

