Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example create_terrain() call fails on action() #6

Closed
wjones127 opened this issue Apr 26, 2022 · 3 comments
Closed

Example create_terrain() call fails on action() #6

wjones127 opened this issue Apr 26, 2022 · 3 comments

Comments

@wjones127
Copy link
Contributor

I attempted to create a terrain with the example, but it reported there was an exception. Is there a way to see that exception?

library(unifir)

raster <- tempfile(fileext = ".tiff")
r <- terra::rast(matrix(rnorm(1000^2, mean = 100, sd = 20), 1000),
                 extent = terra::ext(0, 1000, 0, 1000)
)
terra::writeRaster(r, raster)


script <- make_script(project = "projects/example_script") |>
  add_light(light_type = "Directional", light_name = "Sun",
            x_rotation = 35, y_rotation = 20) |>
  add_default_player() |>
  create_terrain(
    method_name = "MakeTerrain",
    heightmap_path = raster,
    x_pos = 0,
    z_pos = 0,
    width = 1000,
    height = terra::minmax(r)[[2]],
    length = 1000,
    heightmap_resolution = 1000
  ) |>
  save_scene(scene_name = "my_scene") |>
  set_active_scene(scene_name = "my_scene")

action(script)
# Aborting batchmode due to failure:
# executeMethod method MakeTerrain.MainFunc threw exception.
#> Error in action(script): 1
@mikemahoney218
Copy link
Member

Thanks! Fixed in bfbb306 -- I had been testing with local files and mistakenly assumed that I could swap the local path for a tempfile (for CRAN) with no problems.

Unfortunately, that's actually the entire error message provided by Unity when called on the command line. There might be a space for a vignette on how to debug these scripts (which is a bit more about the Unity engine and C# than anything to do with R) but Unity's CLI is notoriously unfriendly, so I don't believe there's any way to surface these issues within R itself.

@wjones127
Copy link
Contributor Author

Can confirm that this example now works in that fix branch.

Unity's CLI is notoriously unfriendly, so I don't believe there's any way to surface these issues within R itself.

That's a shame 😢

Copy link

github-actions bot commented Feb 2, 2024

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.

@github-actions github-actions bot locked and limited conversation to collaborators Feb 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants