- Home /
Question by
JeffreyRocks · Oct 03, 2021 at 03:32 PM ·
vector3variablegizmos
variable outputs something wrong
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class squirelscript : MonoBehaviour
{
public GameObject toppoint;
public GameObject rightbottompoint;
Vector3 middlebottompoint;
// Start is called before the first frame update
void Start()
{
Vector3 middlebottompoint = new Vector3(toppoint.transform.position.x, rightbottompoint.transform.position.y);
}
void OnDrawGizmos()
{
Debug.Log(middlebottompoint);
// the above logs (0,0,0)
Debug.Log(new Vector3(toppoint.transform.position.x, rightbottompoint.transform.position.y));
// the above logis middlebottompoint written out but it logs (0,-4.4,0)
// THESE 2 logs are supposed to be the same why are they not?
}
}
Comment
OnDrawGizmos
is called in the editor, at edit time. Start
is only called before the first call Update on this object.
Answer by TalkingBlah · Oct 03, 2021 at 05:19 PM
Try adding an iimplicut 0f as the value of middle point when u assign it with values of a and y from other point
Your answer

Follow this Question
Related Questions
Remaping values? 1 Answer
Rotating a wire cube gizmo? 1 Answer
How could I convert the y axis in a Vector 3 into a float? 1 Answer
How to carry over variable (transform.position) and use it as Vector3 for instanitating a prefab 2 Answers
How could I make a border around my grid world? (PIC INCLUDED) 1 Answer