- Home /
Question by
khalidsoliman · Jun 16, 2017 at 12:05 PM ·
positionif-statementscheck
i want to check play position in the game so i can take an action
if ( player.transform.position = new Vector3 (Random.Range(1f, 10f ), Random.Range(1f, 10f), Random.Range(1f, 10f))) { // Action } Error "cannot implicitly convert type unityengine.vector3' to bool "
Comment
Answer by KacperPlus · Jun 16, 2017 at 01:29 PM
To compare two values you have to use ==, not =, so
if (a == b) {
//Do something
}
Your answer
Follow this Question
Related Questions
How to get an Objects position per axis? 1 Answer
check if method is finished, bools not working 1 Answer
Looping through array to find a specific class? 0 Answers
Check Material C# 1 Answer
C# the position of the object 1 Answer