Skip to content
This repository has been archived by the owner on Jun 14, 2021. It is now read-only.

OmniGUI for Unity3d #7

Open
PassivePicasso opened this issue Dec 8, 2017 · 32 comments
Open

OmniGUI for Unity3d #7

PassivePicasso opened this issue Dec 8, 2017 · 32 comments

Comments

@PassivePicasso
Copy link

I would like to make a renderer for Unity3d. There are various things I would need to do to make sure it's possible such as ensuring it can run in the unity environment.
However, I'd like to know where I could start if I wanted to implement the rendering/hosting portion?

@SuperJMN
Copy link
Collaborator

SuperJMN commented Dec 8, 2017

Hi! I think it's perfectly doable. As long as you can add references to .NET Standard, you can create a drawing backend to make it work with Unity3D. Did you take a look to the IDrawingContext interface? If you make an implementation of those methods, then you've got it :)

I can try to offer you help as long as you set up a OmniGUI.Unity3D in, for example, your own fork of OmniGUI :)

Thanks for your interest!

@SuperJMN
Copy link
Collaborator

SuperJMN commented Dec 8, 2017

BTW, the rendering unit in OmniGUI is the mentioned IDrawingContext. It's also necessary to provide a custom implementation of ITextEngine that provides text measuring (for now :)).

Feel free to ask me anything.

@PassivePicasso
Copy link
Author

So, I'm trying to get started on this, I've made a fork and loaded up the project in Visual Studio but most of the projects don't load.
I'm not sure what this is supposed to look like, but even OmniXAML doesn't load.
What version of .net standard does it require?

@PassivePicasso
Copy link
Author

Unity hasn't setup any support for .NET standard yet, but they are aiming to in the 2018.1 beta, which is the next major release.
Still, I'd like to get the kinks worked out in loading and working on the project.

To clarify my last comment, I'm using Visual Studio 2017 15.5.1 currently and have .NET 4.6 4.6.1 and 4.6.2 installed.
I installed the .NET Core 2.0 SDK
but most of the projects fail to load
image

@SuperJMN
Copy link
Collaborator

SuperJMN commented Dec 9, 2017

Oops, it seems that the submodules aren't downloaded. Can you verify that the \OmniXAML and \Zafiro subdirs are empty? If so, execute this command inside the root folder:

git submodule update --init

Tell me if it works!

BTW, it seems that you are using a VS 2017 Preview, right? :) I have verified it works the latest stable version.

As soon as you have the submodules issue fixed, try to load again and tell me your findings. If it still doesn't work we could arrange a TeamViewer session to make it work :)

(Regarding the submodules, you can check this question in StackOverflow for more information regarding this problem https://stackoverflow.com/questions/11358082/empty-git-submodule-folder-when-repo-cloned)

@PassivePicasso
Copy link
Author

Okay, I think I got this, executing the git submodule upate init, didn't quite do the trick.
I followed the SO answer and used a recursive clone which had much better results.
I need to install some libs for some of the projects to load so I'm doing that now and we'll see how that goes.

@PassivePicasso
Copy link
Author

should I be able to have all projects loaded and be able to compile? I'm having some issues with getting the project to compile without making any modifications

@SuperJMN
Copy link
Collaborator

SuperJMN commented Dec 12, 2017

Hey! No, you can unload all the projects inside the Platforms and Tests Apps solution folders. Unload them and they should compile :) If it doesn't, tell me the error/s that it shows.

Good luck!

@PassivePicasso
Copy link
Author

image

@PassivePicasso
Copy link
Author

PassivePicasso commented Dec 12, 2017

I checked and the OmniGui.dll is definitely not there.
I did unload all the TestApps and Platforms

@PassivePicasso
Copy link
Author

image

@SuperJMN
Copy link
Collaborator

OK, I have experienced the same issue before.

  • First, unload the projects under Platforms and Test Apps

Now, try to compile individually.

  • First: Zafiro.Core inside the OmniXAML folder.
  • Next: the rest of projects in the OmniXAML folder.
  • Next. The projects in the Zafiro folder.
  • Last: The rest of the projects.

It seems that VS sometimes has problems with using submodules.

If it still doesn't work check that the lightweight solution loading is disabled. I also had problems with that :)

@PassivePicasso
Copy link
Author

PassivePicasso commented Dec 12, 2017

Cannot find project info for 'E:\Projects\Progamming\UnityLibraries\OmniGUI\OmniXAML\Zafiro\Zafiro.Core\Zafiro.Core.csproj'.
This can indicate a missing project reference.
OmniGui
C:\Program Files\dotnet\sdk\2.1.2\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.targets

now I only have this error.

@PassivePicasso
Copy link
Author

I can't seem to find lightweight solution loading from all my search/google, I can only assume its not set, but I don't see the options where they should be.,

@SuperJMN
Copy link
Collaborator

Strange! have you tried to restart Visual Studio?

@SuperJMN
Copy link
Collaborator

SuperJMN commented Dec 12, 2017

Info about lightweight solution loading: https://dotnetvibes.com/2017/02/13/lightweight-solution-load-in-visual-studio-2017/

@PassivePicasso
Copy link
Author

PassivePicasso commented Dec 12, 2017

Lightweight solution load was removed in 15.5
"Visual Studio team had decided to discontinue Lightweight Solution Load (LSL) support in the 15.5 release. "
dotnet/fsharp#2320

@PassivePicasso
Copy link
Author

I restarted, but I still have the same problem

@SuperJMN
Copy link
Collaborator

OK, do you have the project in GitHub? Just point me to the code and I will see what's going on!

@PassivePicasso
Copy link
Author

I do, but I haven't pushed or made any changes, so its no different than what you have.

@SuperJMN
Copy link
Collaborator

SuperJMN commented Dec 12, 2017 via email

@PassivePicasso
Copy link
Author

executing dotnet restore seemed to help, but now I can't reproduce it.
What framework should I be targetting, it looks like you're targeting net standard 1.2 right now

@SuperJMN
Copy link
Collaborator

SuperJMN commented Dec 12, 2017 via email

@PassivePicasso
Copy link
Author

unfortunately no, I still have that weird project info error.
What environment do you develop in?

@SuperJMN
Copy link
Collaborator

Windows 10 Pro x64, Fall Creators Update.

@PassivePicasso
Copy link
Author

how about IDE?

@SuperJMN
Copy link
Collaborator

This => :)
image

@PassivePicasso
Copy link
Author

You have any other ideas on this? I do have to wait for the next beta of Unity to develop this extension, but I'd really like to be able to pick it up and go once I have all the parts.

@PassivePicasso
Copy link
Author

So I got this to build by removing the Zafiro.Core project from the OmniXaml submodule and pointing OmniXAML at the Zafiro/Zafiro.Core project instead.
Obviously this is a limited solution.
It seems like you shouldn't include Zafiro.Core in the OmniGUI project since it has a dependency on OmniXaml which depends on Zafiro.Core anyways, I'll reload the whole thing and turn it around so that I remove Zafiro.Core from OmniGUI and point it at the OmniXaml project, since structurally it seems makes more sense.

@SuperJMN
Copy link
Collaborator

Hey @PassivePicasso ! Sorry, I completely forgot this topic! well, it's a bit complex the relationship with Zafiro.Core, since OmniXAML uses it, and OmniGUI uses it, separately. I shouldn't reference OmniXAML's Zafiro.Core directly because it's an internal reference that OmniGUI shouldn't take. OmniGUI should use it's own submodules. It's like your collaborating with your coworker in the workplace and you take his car instead of your car :) Maybe, you can do it, but you shouldn't rely on it :)

However, it seems that it's the only way you found to make it work, right?

@PassivePicasso
Copy link
Author

the 2018.1 beta is out, and I am having trouble getting this moving. Unity3d is rejecting the OmniXaml DLL saying it could cause crashes during runtime.
I'm concerned that this is because of how I compiled the DLLs.
Would it be possible for you to put up a release for me to test against unity to see if its because of my modifications?

I'm also having a little trouble working out how to put this together.
It's clear that you need to implement the IDrawingContext and ITextEngine, but I don't understand the entry point.
At some point I need to provide a space to OmniGui to render the content in, I'm guessing I need to implement an Editor in Unity to do this?

@PassivePicasso
Copy link
Author

Also, yes its the only way I got it to work.

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