unity3d-open-tools / opengui Goto Github PK
View Code? Open in Web Editor NEWOpen source GUI framework for Unity
Open source GUI framework for Unity
For automatically adjusting a widget's transform to match an in-scene GameObject
This might pose a challenge, since the OnGUI loop doesn't update 100% reliably in editor mode.
To properly arrange widgets in windows, we'd need to have a new container widget type with its own local anchor and stretch bounds. Additional widgets would be needed for resizing and moving the windows around.
Hi there,
i am working on a project witch complete dynamic content and would like to use your GUI Framework on this; but though it's completely generated, I cannot do any of the GUI statically.
Could you please provide me a short introduction how I can get OpenGUI to display with pure programming?
regards,
Haimi
Just curious, but it would appear I cannot rotate anything on the z-axis. Is rotation even supported currently? It would be great to have for the OGTexture, as I would like to rotate a texture for a loading screen. Actually, I just tried with a button and rotation doesn't work on it either. So, I highly recommend allowing rotation of OG UI widgets and stuff based on the standard transform.rotation. This would be great to have and allow you to compete with the new GUI system in 4.6 of unity3d. I can tell I would like this one much better just because of the drag and drop events for widgets that you have implemented. Heck, I would just be happy with rotation on the z axis. I could care less about rotation for the x and y, but those would be cool too for button flips and stuff.
As the picture shows:
I tried to fix that, however it seems like Unity has poor kerning support.
Need to rewrite the inspector class using SerializedObject or implement a workaround
This only happens for some widgets at a time, so it's related to the order in which they are resolved
Implementing a "target screen size" parameter for OGRoot.
On paper, it should just work by passing the width and height as arguments to GL.LoadPixelMatrix ( w, h ), but when the screen is scaled below the provided size, the clipping plane seems to scale independently, resulting in portions of the UI not rendering
It's commented out for now
Title says it all: for some reason, the pivot property doesn't do anything on an OGScrollView. It's only the scrollview; the other widgets' pivot is working just fine.
We need a memory efficient way of clipping glyphs and sprites.
Implementation will be purely visual
Typogenic is a free plugin for rendering TrueType text, and I think we could avoid a lot of pain by making this plugin a dependency.
When I insert the second number when resizing an OGLabel, Unity crashes and gives an "error in gc": too many sections in heap. This occurs in both transform.scale and stretch. For example, when I want to scale the label to an X of 200, it crashes when I try to type the first 0.
I haven't had this problem before updating to the latest release with the ScrollView pivot fix and implementing the factor parameter for anchor, so that may have something to do with it.
Should be formatted like {0.0,0.0,0.0}.
So I need to create a connect button for each server in a serverbrowser is the situation. I did try to use the c# example of setting up the gameobject with the button but it failed. Don't think OGButton was a valid type for the new gameObject. So I figure it is because of the compilationorder. I did however create a gameobject and add the OGButton to it and it looks just fine in editor but it throws this on creation...
NullReferenceException: Object reference not set to an instance of an object
OGWidget.RecalcPosition () (at Assets/Plugins/OpenGUI/Scripts/OGWidget.js:166)
OGWidget.Recalculate () (at Assets/Plugins/OpenGUI/Scripts/OGWidget.js:265)
OGWidget.Start () (at Assets/Plugins/OpenGUI/Scripts/OGWidget.js:306)
Also I need to select it in the Hierarchy for it to draw and be visable.
Is there any way around this?
Code I use to set it up
GameObject btn = new GameObject ("ServerEntry");
btn.transform.name = data.gameName;
btn.transform.parent = transform;
btn.transform.localPosition = new Vector3( 20, 34, 0);
btn.transform.localScale = new Vector3( 300, 20, 0);
btn.AddComponent<OGButton>();
btn.GetComponent<OGButton> ().text = data.gameName;
Note that it creates it just fine and all looks ok valuewise. It seems to just fail on first draw.
I did try moving the button creation script around in compilationorder but it ends up the same. Luckily it is a single script that grabs a hostdata array from main game script so it can move around any way.
Must be fixed in OGDrawHelper::DrawLabel
So I started making a frontend for OGConsole using opengui and while I am far from done I hit this little snag.
OGConsole needs a flag in the inputfield to indicate if it changed so it can trigger an update of suggested autocompleted commands. Unless I am blind there is none right now in the normal OGTextField. I figure it could be a good thing to add though.
-edit-
It also expects to get a onChange flagged when OGScrollView is changed.
For now I'm commenting it out just to see what else fails and needs to be sorted. Figure I might aswell let you know and take notes here. Of course with the intent to share the working implementation after its done.
This is a bit of a stretch, but it would be very cool: Make OpenGUI just as capable of in-line GUI programming as it is in GameObject-based form.
That is, we'd create methods like OG:Button ( String, Rect, ... ) : bool
and call them from OGPage:DrawPage ()
, which would essentially be OpenGUI's version of OnGUI ()
. This needs a bit of restructuring, and there are some issues with material passes that need to be addressed, but overall, this would allow for more code-centric implementations while still maintaining the convenience of previewing your GUI outside play mode. It would also mean less widget management, which would ultimately result in a lighter CPU load.
OGTween needs OnStart, OnUpdate and OnComplete message sending
I would like to see a container that holds drag-droppable items (displayed as textures or text). If an item in the container is dragged onto a GameObject that accepts drops, a new GameObject is instantiated from the prefab linked to the item.
Dragging a widget or changing its position now creates the "hall of mirrors" effect:
This issue can be resolved by creating a camera object before creating the Root. The issue appears again if you delete the camera.
I thought this could be caused by the lack of a Camera component on Root, but when I try to add it it says it does have one, even though it is not visible in the inspector.
We can fix this by setting the OGWidget::isDrawn flag, but this should be part of a larger "clipping" solution also affecting OGScrollView and OGTextField
Find another way to separate the passes in the OGRoot draw loop
I just made a small script you stick on an empty gameobject and it will in runtime make sure any childs will have the current page of the OGRoot instance as parent.
Nothing complicated but could be very useful for others so I will share it here. But maybe there could be a portion of the wiki or somewhere where we could collect a few helpful OpenGUI scripts
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class keepOnPage : MonoBehaviour
{
// Make sure all tracked objects have a unique name
private OGRoot UIRoot;
public List<GameObject> keepList = new List<GameObject> ();
void Start ()
{
UIRoot = GameObject.Find ("GUIRoot").GetComponent<OGRoot> ();
}
void FixedUpdate ()
{
foreach (Transform child in transform) {
if( !keepList.Exists ( item => item.name == child.name ) ){
keepList.Add (child.transform.gameObject);
}
}
setParents (UIRoot.currentPage.transform);
}
void setParents (Transform parent)
{
foreach (GameObject keep in keepList) {
keep.transform.parent = parent;
}
}
}
I suspect this is due to you working on something that is missing on my side or something similar but here is the error
NullReferenceException: Object reference not set to an instance of an object
UnityEngine.GUILayoutUtility.BeginLayoutGroup (UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options, System.Type LayoutType) (at C:/BuildAgent/work/d3d49558e4d408f4/artifacts/EditorGenerated/GUILayoutUtility.cs:197)
UnityEditor.EditorGUILayout.BeginHorizontal (UnityEngine.GUIContent content, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at C:/BuildAgent/work/d3d49558e4d408f4/artifacts/EditorGenerated/EditorGUI.cs:5030)
UnityEditor.EditorGUILayout.BeginHorizontal (UnityEngine.GUILayoutOption[] options) (at C:/BuildAgent/work/d3d49558e4d408f4/artifacts/EditorGenerated/EditorGUI.cs:5026)
OGPage.UpdateStyles () (at Assets/Plugins/OpenGUI/Scripts/OGPage.js:29)
OGRoot.GoToPage (System.String pageName) (at Assets/Plugins/OpenGUI/Scripts/OGRoot.js:74)
PageChanger.setPage (System.String page) (at Assets/Scripts/PageChanger.cs:89)
PageChanger.Start () (at Assets/Scripts/PageChanger.cs:23)
PageChanger.cs is a script I use to monitor the state of the game and if needed change the page on the OGRoot object. Basically a workaround since I got everything else written in C#.
So on start it called SetPage("StartMenu"). It all worked fine in b9.
the line...
EditorGUILayout.BeginHorizontal();
is in MonoDevelop highlighted as a type and not an object so is it just a typeO?
This would be individual to every widget, but maybe it'll be too heavy?
Hi again. Just installed and ran the latest Unity and in an empty new project it throws these errors when importing the latest opengui-v0.9-beta-15.
Assets/Plugins/OpenGUI/Scripts/OGButton.js(10,29): BCE0018: The name 'Action' does not denote a valid type ('not found'). Did you mean 'System.Action'?
Assets/Plugins/OpenGUI/Scripts/OGButton.js(11,41): BCE0018: The name 'Action' does not denote a valid type ('not found'). Did you mean 'System.Action'?
Assets/Plugins/OpenGUI/Scripts/OGDrawHelper.js(58,30): BCE0018: The name 'Bezier' does not denote a valid type ('not found').
Some widgets responses are delayed when using touch screens. EDIT: OGRoot doesn't register the TouchPhase.Ended event
In my OGSkin object that I set up from scratch I had 3 fonts setup. All working. Right now I made a project backup and updated the OpenGUI files to the b9 ones.
After that I have no fonts picked in my OGSkin. I can't even pick or drag and drop the ones I used before. Any ideas?
I Don't want to start from scratch again if avoidable.
Also a unrelated issue with OGTickBox.isSelectable. Does it work? I'd figure I'd use it as markup for not ready/ready flags but then it shouldn't be clickable. Right now you can still click with the mousepointer and tick/untick it.
Or is it just me assuming it should work that way but being wrong?
Give OGPage its own draw loop and make it more accessible to draw widgets with code, learn from the OnGUI functions
There are minor differences between OpenGUI's glyph rendering and that of Unity's own built-in framework. This is causing text field selection and cursor position to be slightly off.
The 'disabled' style should be implemented via the 'isDisabled' flag
Allow for multiple pages to be displayed simultaneously at runtime
The unlit vertex shader used for rendering needs to be configured to allow for better alpha blending between different materials.
Make a new OGDrawHelper method for this
So I gone and done something stupid with my project so now I would love if I could parse text for colourcodes and present the text accordingly. As far as i know it isn't possible but I would also guess it wouldn't be easy to implement. Any chance at all this could get implemented?
At the very least I would suggest being able to have linebreaks in textfield and label.
Is there any way to manipulate the color value of a style or directly to the object? I need a simple colour field to show the colour of the rgb values the players choose. Could do it differently but I figure I'd ask.
I know I had another question but I forgot it..
Anyway. I am now reinstalling windows, updating unity and so far my OGSkin haven't bugged out. Here's what I'm using it for https://www.youtube.com/watch?v=Xuc7cGjrkjU
Not much GUI right now but I have a whole IRC connection to build UI for. That's kinda what made me think of colours. Would love to have them but at the same time it might just be easier to make it in Unitys default UI.
Update the editor menu to reflect recent changes
Right now it doesn't for OGTickBox
Glyphs will occasionally draw oddly in the pixel matrix. Theories are:
OGTween needs a color parameter
When the textfield goes to active it loses the textalignment and uses default placement instead.
Might be that the style "active" isn't exposed at all?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.