Quantcast
Channel: Questions in topic: "exception"
Viewing all articles
Browse latest Browse all 470

Function gets null but send is not null

$
0
0
Hi! I just trying to send object in a fucntion but it's get null, while value "focus" gets that meaning. What's wrong? //some code if (Input.GetMouseButtonDown(0)) { Ray ray = cam.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit, 100)) { Interactable interactable = hit.collider.GetComponent(); if (interactable != null) { SetFocus(interactable); } } } //some code void SetFocus (Interactable newFocus) { focus = newFocus; motor.FollowTarget(newFocus); } So, when I call motor.FollowTarget(newFocus) it's get null exseption, but focus gets value of newFocus (that is GameObject)

Viewing all articles
Browse latest Browse all 470

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>