Question by
unity_Q012VN7L4GLnJw · Dec 31, 2018 at 06:22 PM ·
c#unity 2d
best way to see the distance range,best way to show distance range
i want to resize the sprite size by the given distance size like this
float range =5;
private void OnMouseDown()
{
//my problem is that i want to change this sprite
//as same distance range in the update method
GetComponent<SpriteRenderer>().transform.localScale=range;
}
void update(){
if (Vector2.Distance(monster.transform.position, transform.position) < range){
//do something
//on the first position enter the range
}
},i want to resize the sprite size by the given distance size like this
float range =5;
private void OnMouseDown()
{
//my problem is that i want to change this sprite
//as same distance range in the update method
GetComponent<SpriteRenderer>().transform.localScale=range;
}
void update(){
if (Vector2.Distance(monster.transform.position, transform.position) < range){
//do something
//on the first position enter the range
}
}
Comment
Your answer
Follow this Question
Related Questions
switch between 5 Ui icons by pressing a button 0 Answers
Shooting an instantiated missile the way a object is facing. 0 Answers
How do I make a scrollbar for the camera? 0 Answers
How to add more UI elements to Dropdown OptionData except default string and sprite values in Unity? 0 Answers
Find nearest enemy object in radius 2 Answers