Question by
officalbaranarslan · Dec 09, 2021 at 08:26 AM ·
c#unity 2d
Bullet prefab is only showing in the left side of the player,Wierd Problem In Unity
when i instantiate bullet with mouse its only showing in the left side of the player as you can see in the photo below. How can i solve that please help me
void Update()
{
Vector3 gunpose = Camera.main.ScreenToWorldPoint(Input.mousePosition);
if (gunpose.x<transform.position.x)
{
transform.eulerAngles = new Vector3(transform.rotation.x, 180f, transform.rotation.z);
}
else
{
transform.eulerAngles = new Vector3(transform.rotation.x, 0f, transform.rotation.z);
}
if (Input.GetMouseButtonDown(0))
{
shooting();
}
}
void shooting()
{
GameObject shoot = Instantiate(bullet, start.transform.position, start.transform.rotation);
}
,The bullet prefab is only showing at the left side of the player as you can see in the photo below how can i solve that.
void Update()
{
Vector3 gunpose = Camera.main.ScreenToWorldPoint(Input.mousePosition);
if (gunpose.x<transform.position.x)
{
transform.eulerAngles = new Vector3(transform.rotation.x, 180f, transform.rotation.z);
}
else
{
transform.eulerAngles = new Vector3(transform.rotation.x, 0f, transform.rotation.z);
}
if (Input.GetMouseButtonDown(0))
{
shooting();
}
}
void shooting()
{
GameObject shoot = Instantiate(bullet, start.transform.position, start.transform.rotation);
}
Comment
Your answer
Follow this Question
Related Questions
Unable to save the captured photo in hololens app. 0 Answers
Changing order in layers at runtime with a coroutine 0 Answers
Help me with joystick setting 1 Answer
I need help with AI,Force not working 0 Answers
Highscore not working 0 Answers