By registering with us, you'll be able to discuss, share and private message with other members of our community.
Sign up now!Ok thanks i dont understand but i try my best to grasp itMeans "is not" and "not equal to"
Example:
!object.isValid() ; is not valid
Example:
tree != null ; tree is not null
Ok.Ok thanks i dont understand but i try my best to grasp it
Yes thanks alot! I have another doubt could you clear it for me?Ok.
Let's say you want to check if there's a nearby tree to chop.
GameObject tree = GameObjects.newQuery().names("Tree").results().nearest();
This will look for a tree that is closest to the player.
After that, you want to do:
if(tree != null)
Why?
To check if there's an actual tree around the player. If there is no tree, and you try to interact with it, it will return null, resulting in an error. That's why you do the != check.
Does that clear up some stuff for you?![]()
Ok.
Let's say you want to check if there's a nearby tree to chop.
GameObject tree = GameObjects.newQuery().names("Tree").results().nearest();
This will look for a tree that is closest to the player.
After that, you want to do:
if(tree != null)
Why?
To check if there's an actual tree around the player. If there is no tree, and you try to interact with it, it will return null, resulting in an error. That's why you do the != check.
Does that clear up some stuff for you?![]()
We use essential cookies to make this site work, and optional cookies to enhance your experience.