SeaPeaMe Posted April 28, 2020 Share Posted April 28, 2020 Hello everyone! I am having difficulties regarding exposing things in the editor. When I make a public variable it is supposed to show up in the editor, but it never does. And it doesn't work no matter the type of variable. Here's the code: using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using Unigine; [Component(PropertyGuid = "9d726b584d9b76d7b9aca64ab1aee121ec3c880c")] public class TowerSpawnUI : Component { public Mesh CubeMesh; private void Init() { Gui GUI = Gui.Get(); WidgetButton Btn = new WidgetButton(GUI, "Click Me!"); Btn.AddCallback(Gui.CALLBACK_INDEX.CLICKED, new Widget.Callback0Delegate(BtnClicked)); GUI.AddChild(Btn); } void BtnClicked() { new Mesh(CubeMesh); } } Here's what shows up in the editor: Link to comment
karpych11 Posted April 28, 2020 Share Posted April 28, 2020 Hello, Not all types of variables can be displayed in the editor. You can find all available options in C# Component Samples in the script csharp_component_samples/Components/components/ComponentParameters.cs. In your case with a mesh, you can use the asset link: [ParameterAsset (Filter = ".mesh")] public AssetLink CubeMeshLink; and then create a mesh: Mesh mesh = new Mesh (CubeMeshLink.Path); Link to comment
SeaPeaMe Posted April 28, 2020 Author Share Posted April 28, 2020 Thank 7 minutes ago, karpych11 said: Hello, Not all types of variables can be displayed in the editor. You can find all available options in C# Component Samples in the script csharp_component_samples/Components/components/ComponentParameters.cs. In your case with a mesh, you can use the asset link: [ParameterAsset (Filter = ".mesh")] public AssetLink CubeMeshLink; and then create a mesh: Mesh mesh = new Mesh (CubeMeshLink.Path); Thank you for replying! But, sadly, this isn't working for some reason. Even with simple things such as Integers and Floats (Which I know already have an inspector thing built in). Here's, again, what the code looks like and the Editor using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using Unigine; [Component(PropertyGuid = "9d726b584d9b76d7b9aca64ab1aee121ec3c880c")] public class TowerSpawnUI : Component { [ParameterAsset(Filter = ".mesh")] public AssetLink CubeMesh; public int Test; private void Init() { Gui GUI = Gui.Get(); WidgetButton Btn = new WidgetButton(GUI, "PooPoo"); Btn.AddCallback(Gui.CALLBACK_INDEX.CLICKED, new Widget.Callback0Delegate(BtnClicked)); GUI.AddChild(Btn); } void BtnClicked() { Mesh mesh = new Mesh(CubeMesh.Path); } } Link to comment
silent Posted April 28, 2020 Share Posted April 28, 2020 Could you please show us your data folder contents in Asset Browser? If everything is OK you will see only the single .cs file: If you have some additional .prop files it would mean that something bad is happens. Engine log file can be also useful to see (you can get it from <Project_Dir>/bin/log.html). That's how your component is looking in my case - new component was created via Editor (and I didn't replaced the auto-generated GUID when copied your code): How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
SeaPeaMe Posted April 28, 2020 Author Share Posted April 28, 2020 (edited) Sure, here's what it looks like in my editor (Though, from looking at your screenshot, the only thing I think could make a difference is the CS Template) I also had a look through my log, And when looking through the log, there was 3 missing GUIDs, however, the code was still running fine and all the GUI stuff loaded at Runtime. Here's the log file just in case you want to have a read:log.html Edited April 28, 2020 by SeaPeaMe Link to comment
silent Posted April 28, 2020 Share Posted April 28, 2020 I can see the issue (it's really stupid, btw). Could you please open generated .csproj file in the root directory of your project and replace all the: <AssemblyName>Physics Sandbox</AssemblyName> with <AssemblyName>Physics_Sandbox</AssemblyName> Here how it looks like on my PC: After that simply reimport .cs component and everything should work fine. We will fix this bug in the upcoming SDK update. Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
SeaPeaMe Posted April 28, 2020 Author Share Posted April 28, 2020 I have replaced those things in the "Physics Sandbox.csproj" file, and it still isn't working! If you want I can email you the project so you can have a deeper look into it. Link to comment
silent Posted April 28, 2020 Share Posted April 28, 2020 Have you tried to manually reimport .cs file: If so, you can send us a project (data directory and .csproj file) to support@unigine.com or upload to our FTP (in my signature). Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
SeaPeaMe Posted April 28, 2020 Author Share Posted April 28, 2020 I have reimported it manually, and I'll resort to emailing. Thank you for all your help! Link to comment
Recommended Posts