Closed stanleyjoy closed 10 years ago
Update on the issue. Even declaration of a GUIStyle will be added to scene.xml which will result in the error as said above.
Stan
It is probably just a missing override in FFWD. I will take a look at it.
Thomas Gravgaard Senior Software Developer Press Play ApS thomas@pressplay.dk +45 26 74 26 74
wondering how you guys did the UI for Tentacles??? Stan
We did it purely in XNA using SpriteBatches and some custom code that was built upon a sample from the XNA site. Nothing in Unity at all.
And for our current product we are using NGUI. An extension for Unity. The version we are using plays fine with FFWD with some small customizations in the scripts.
So you guys use this, was using EZGUI for a while. will check the demo. Stan
I tried to bring 2 buttons using NGUI into XNA. The buttons had no events or custom scripts attached. So they do nothing other than provide click and normal state yet the XNA throws errors in the scene.XML "There was an error while deserializing intermediate XML. Cannot find type "UISlicedSprite""
Thinking of doing the UI in XNA now. how did you change scenes in a game from XNA's C# do they respond to Application.LoadLevel(); if they were written in XNA.
The error you get is because you don't have the NGUI scripts added in XNA. Remember to do a Script export and add the scripts manually in XNA.
Thomas Gravgaard Senior Software Developer Press Play ApS thomas@pressplay.dk +45 26 74 26 74
ok will check that out!!
I thought a full export will export all the assets?? Stan
//Update Got a bunch of assembly reference issues after exporting the scripts anything I did wrong?? -I pushed the NGUI folder to the scripts folder in my Unity Project. -Then did a full export and export all scripts. -Added the exported folder to XNA project, i.e., NGUI to template.scripts and NGUI Atlas to template.content and template.XML.content. -Build the product throws around 124 errors related to assembly reference.
Stan
It will. But it will not include the scripts in the XNA project, it will only convert them and copy them to XNA.
Thomas Gravgaard Senior Software Developer Press Play ApS thomas@pressplay.dk +45 26 74 26 74
Got a bunch of assembly reference issues after exporting the scripts anything I did wrong?? -I pushed the NGUI folder to the scripts folder in my Unity Project. -Then did a full export and export all scripts. -Added the exported folder to XNA project, i.e., NGUI to template.scripts and NGUI Atlas to template.content and template.XML.content. -Build the product throws around 124 errors related to assembly reference.
I am trying to use XNA's spritebatch to draw my UI. The issue I am facing is that I am not able to draw the texture as PressPlay.FFWD is also using the same texture2D "Error 1 'Texture2D' is an ambiguous reference between 'Microsoft.Xna.Framework.Graphics.Texture2D' and 'PressPlay.FFWD.Texture2D' "
Just use the full namespace for the class when you create it like this:
new Microsoft.Xna.Framework.Graphics.Texture2D(...);
Ya trying that but have to find a work around. Otherwise I will need to put the full namespace for a lot of things. Can you just give me a brief overview of how FFWD hierarchy works. Like game1.cs works first then what comes next????
Any thoughts on getting NGUI working for me!!! :D Stan
Game1.cs load the FFWD Application up as a DrawableGameComponent. That will start the engine running. Then it will kick FFWD into gear by loading in a scene - just like Unity does by opening the base scene. After that all the Components on the GameObjects in the scene will take over and do their thing and things will progress like they do in Unity.
If you want to create your own GUI system that is not part of FFWD at all, the easiest way to do it is to make a DrawableGameComponent that can handle it and draw after the FFWD.Application has drawn, then it will draw on top of what your FFWD app has drawn. Then you can use standard XNA and not worry about the FFWD types at all. You can still interrogate FFWD to get some data about your game objects, but if you take that approach you should think about having game data kept in some way that is easier to get to than through FFWD (singleton classes or a data repository).
Regarding NGUI, the key to getting it working is to make sure that the Unity scripts have the right FFWD attributes applied. The attribute system in Unity (https://github.com/fehaar/FFWD/wiki/Scripting) was actually refined to get NGUI to work, as NGUI hides away a lot of properties for prying eyes.
When you do work with it, use the following operating mode: 1) Get the NGUI scripts into XNA and see them compile. 2) Make a simple Unity scene with a simple NGUI setup on it and export it. 3) Check the generated XML to see that NGUI components have the right data exported. Add FFWD attributes to the Unity scripts until they do. 4) Test the scene and see if it is working. If it fails, find out what data is missing. Repeat from 3.
As I said. We have gotten NGUI to work in XNA, so it is possible and FFWD should support most of what NGUI does. Of course there will probably be cases where that is not true. In that case report the specific issues and I will see what I can do to help.
I hope it gives you some ideas to get further. I am sorry that the built in GUI system is not up to snuff in FFWD yet, as this is a bit of a daunting task. At the moment I am extremely busy, so I haven't had much time to look at FFWD - but I will soon get back to it, and will see if I can make a test scene with the GUI parts and brush it up a bit so it is useful.
Ok my head of programming is asking me to try and push via NGUI. As any changes in terms of UI can be done in Unity rather than XNA. Hope you can guide me through. In step 3 you said check the generated XML. Are you talking about the XML that is created for the scene. Stan
Hello anyone there???
Sorry Stan, I have missed out on the earlier comment. Yes. It is the scene XML I am talking about.
Ok will check it out
Thomas, you really need to incorporate the entire Unity GUI to work with FFWD and XNA. Rather than using plugins from Unity. This way atleast everyone knows where to look if they are blocked or cut-off. Stan
True. But no-one I know use the GUI system for real production. And at the moment I don't even have time to work on the real missing pieces of FFWD. So it is a trade off.
You are right that no-one uses Unity3Ds GUI as its one draw call per button or text. However with FFWD and XNA we are able to make the UI with apparently no draw calls or the stats might be wrong. Stan
Have you tried to use plugins from Unity3D to XNA
The GUI takes draw calls in XNA. But only up to two depending on what you draw. It is probably not counted the way it is now. It should be possible to draw everything made with GUI (when it gets done) in one draw call.
What plugins are you referring to?
lets say if I wanted to use iTween
Ah. Yes. iTween is in use in Tentacles running on FFWD. So it works. I can't remember how much we had to change to get it working. but not a lot, as I recall. So I think it should be pretty easy to get running. As I said earlier in the thread, we have the NGUI package running on FFWD as well as some other pakcages, so it is entirely possible. The amount of work nessecary will vary from package to pakcage.
Since we strayed away from the main topic. Did you check GUIStyle Overload Issue??? Stan
Not yet.
Thomas Gravgaard Senior Software Developer Press Play ApS thomas@pressplay.dk +45 26 74 26 74
Does FFWD export only from a folder called scripts for scripts or does it take the C# scripts found anywhere in the project???
Waiting for the new patch.... Stan
Waiting for patch, too. I will test NGUI on FFWD, ;)
I've found some good reasons to start paying with FFWD again...should I use the old version of ngui or the latest?
I haven't tested it with any version later than a year ago. That is not the same as saying that it won't work though.
I wrote a script which makes use of Unity GUI.Button along with GUIStyle to provide mouse over and mouse click textures. I used the script below to make it happen
if (GUI.Button(new Rect(100, 400, 75, 75), "", CWBtn)) { model.gameObject.transform.localEulerAngles += new Vector3(0,RotationSpeed * Time.deltaTime,0); }
It worked in the Unity Editor as expected. However when I exported to XNA. I was greeted with this error "The best overloaded method match for 'PressPlay.FFWD.GUI.Button(PressPlay.FFWD.Rect, PressPlay.FFWD.Texture, PressPlay.FFWD.GUIStyle)' has some invalid arguments"
When I do what XNA wants me to do i.e. change the string to a texture2D. I am greeted by another error "XML element "fontSize" not found." When I checked this it is pointing me to the scene.xml
Is this an error on my part?? Stan