Q. How to convert a relative path to an absolute path on the build PC and add it to the Visual Studio project include path


Because of the task below, I am writing a test code that calls the Unity GameObject class method from the Cesium3DTilesSelection::Tile class method.

I don’t know how it works by converting the relative path to the absolute path on the build PC and adding it to the Visual Studio project include. (just like CesiumForUnityNative-Runtime project)

If anyone knows, please help!

I’m not sure if I completely understand the question, but it sounds like you’re trying to call into Unity from cesium-native code. That won’t work because the dependency doesn’t go in that direction. You probably need to do something along the lines of adding an interface to cesium-native that can be implemented in cesium-unity. That way cesium-native can call your Unity-dependent functionality without depending directly on Unity itself.

Thank you for answer.

You are correct. I am trying to calling Unity methods from cesium-native code.

Of course, I know that modifying it like this is not appropriate when considering contribution to cesium-native, but it is to test what I think.

I’m curious about the following:

When I open the CesiumForUnityNative-Runtime project properties window, there are include paths as shown below. The relative path has been added as an absolute path, and I am curious about where this processing takes place. I’ve been looking into how it works, but haven’t figured it out myself yet.


I guess CMake is adding the absolute paths? I’m not sure.

If you’re just hacking something to test, you can probably just open the cesium-native CMakeLists.txt for the library you want to call into Unity, and add the absolute path to the generated Unity header files to target_include_directories. I’ve never tried this, but I can’t think of a reason it wouldn’t work.

1 Like

Thank you for replying :slight_smile:

I will try following your tip.

If I suceed I will share result here.

if there is someone who want to change something related this topic.

see CMakeLists.txt and change path.