Jump to content

Video Material in Another World


photo

Recommended Posts

So in another thread several people helped teach me what I need to do to add C++ code to allow a GUIObject to have a VideoSprite material on it.  I have another world in the same project that needs video screens.  So I copied the code from the cpp file that it originally worked in and made a new cpp file named the same as the NEW world.  Adjusted things as needed, but this new file does not seem to be getting engaged.

Do I need to somewhere add it to the solution?  Compile after that?  How does Unigine know this new script is there?

Is there only one cpp file for a project?  Maybe I need to address the original screens differently, by addressing the world they are in?

Please any direction that will help a newbie, non developer would be much appreciated.  Thanks!

Link to comment

Hi Trey!

There seems to be some misunderstanding regarding the programming language that you use, or maybe I just got you wrong. To make things clear: if you're talking about this topic, it was not C++, all the code was actually written in UnigineScript. Writing code in UnigineScript does not require you to add files with source code to a solution, compile it,  or anything like that.

You can use multiple worlds and world scripts. When you create a new world (*.world file) in the UnigineEditor, a new world script (*.cpp or *.usc file) is automatically created in the same folder ,  so you can just copy the code from your first world script (*.cpp or *.usc file) and paste it to the second world script file. In this case everything should work fine, of course if the second world (*.world) contains all necessary nodes, that are used in your code.

Things get a bit different, when you make a copy of a *.world file (either in the UnigineEditor, or otherwise) and then create a new world script (*.cpp or *.usc file) for it manually, with the same name as your NEW world.

I assume that this was your case, please correct me if I'm wrong.

In this case, indeed, if you make any changes to your code in the world script file for your NEW world, they will be ignored, as your NEW world stores a link to the first script file (you made a copy, remember?). You can check which world script file is loaded for your NEW world in the Console (see the image attached).

In order to fix the problem in this case, you'll have to perform the following steps:

1. Open the UnigineEditor (to generate meta file for your NEW world script)

2. Open a *.meta file,  generated for your NEW world script in a text editor (has the same name with .meta added to it) and  copy the contents of the guid tag, looks like this:

<guid>ab709182a95cc7264b078c04aaf643360917d5dc</guid>

3.Open your NEW *.world file in a text editor and paste this guid value to the script_name tag like this:

<script_name>guid://ab709182a95cc7264b078c04aaf643360917d5dc</script_name>

4. Save your NEW *.world file. Now everything should work, as your NEW world is now linked to your NEW world script.

Hope this helps!

Thank you!

console.jpg

  • Like 1
Link to comment

@fox that was perfectly explained!  I truly appreciate it.  Your directions worked perfectly and now my video screen works in the new world.  I will have to keep an eye out, but I thought I had used the editor to MAKE the NEW world.  I may have copied it but I don't think so.  I did COPY the cpp file from the original world and rename it....maybe that was something that made things wonky.  Either way I now know how to link them together if it doesn't work from the get go.   Thanks again!

Link to comment
×
×
  • Create New...