Search Unity

Question hitpose.position does not have a value in else block of an if-else statement.

Discussion in 'AR' started by abhishekm942, May 18, 2021.

  1. abhishekm942

    abhishekm942

    Joined:
    Oct 18, 2019
    Posts:
    10
    upload_2021-5-19_1-0-19.png

    This is a snippet of the part of my code that runs in the update method. The code spawns a prefab on the first tap and then the model moves to the tap position on subsequent taps. The prefab does spawn on the first tap but on the 2nd tap it does not move to the touchposition for some reason. Code to move the spawned object is inside the SimulateMovement method. Tried debugging with debug.log and learned that the HitPose.position is null in the else block but works fine in the if block.