Group Group Group Group Group Group Group Group Group

AR Foundation in Unity: Getting Started (AR Doodle)

I am having issues on this tutorial: AR Foundation in Unity: Getting Started | raywenderlich.com

(This issue is occurring even in the AR Doodle - Final project that is in the downloaded material)*

Everything was going fine until I reached the “Adding the AR Raycasting Logic” bullet in the course contents. I can’t seem to get my doodle lines to populate on my Samsung Galaxy S7 Tablet when I Build & run the app. I tried pay testing the scene in Unity, and did notice some “line clones” populating every time I clicked my mouse.

So, I think the app is placing the lines, they just aren’t becoming visible. Once again, this even occurred in the final project from the downloaded materials as well.

Any help would be appreciated. Thank you.

1 Like

I’m also seeing this issue (no lines rendering in final project). Question: How are you play testing the scene in Unity? I’m not very familiar with Android + Unity

Attaching the debugger, it looks like the raycast is not returning any hits, and so no points are added to the line to visualize. Not sure why this is the case though

Hi Benjii519,

I basically changed my AR cameras to the Main Camera in the scene and clicked the play button. While the scene is in play mode, you’ll notice that when you click on the screen (in the game window) that some clones will populate in the Hierarchy. This tells me that something is being populated but for some reason isn’t showing up visually on the screen.

Hi gutiebn,

Just wondered if you ever found a solution to getting the AR Doodle lines to display? I’ve just started the tutorial and have the same problem, both in following the tutorial and building the Final project version (on an Android 10 phone).

No worries if not, I’ll keep trying to figure it out. I’m a beginner at Unity, so I need to get up to speed on basic Android debugging first with adb. I did also find when googling on the topic this paid Unity plugin, which looks like it would be very good when I get a bit more comfortable with the basics and move on to bigger projects:
https://forum.unity.com/threads/ar-foundation-editor-remote-test-and-debug-your-ar-project-in-the-editor.898433/

Removing the TrackableTypeMask argument when calling rayCastManager.Raycast in the GetARRaycastLogic method of DoodlePen.cs does solve this issue and makes the lines visible in AR.

So line 94 of DoodlePen.cs in the AR Doodle - Final project should read:

bool hasHit = raycastManager.Raycast(Input.mousePosition, hits);

I haven’t found a definitive answer as to why defaulting to all TrackableTypes works here, but this slightly old GitHub discussion for Unity 2019 ARFoundation samples may give a hint, where Tim from Unity says: “ARCore doesn’t really support a PlaneWithinInfinity type of query.”

So I’m wondering if its an ARKit vs ARCore thing, and the original code only works with ARKit? Anyway, changing that single line of code as above does get it working.

Tested on Unity 2020.3.5 with both Android 10 and 11 devices.