Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - col000r

Pages: [1] 2
1
TNet 3 Support / Trying to save and load DataNodes to Assets/Resources/
« on: August 02, 2016, 09:45:07 AM »
Hey, I'm trying to save some information from an Editor-script to a Resources folder and then load it back in at runtime, but I'm getting the following error:

  1. Unknown prefix: 85 at position 1
  2. UnityEngine.Debug:LogError(Object)
  3. TNet.Tools:LogError(String, String, Boolean) (at Assets/TNet/Common/TNTools.cs:1001)
  4. TNet.Serialization:ReadObject(BinaryReader, Object, Int32, Type, Boolean) (at Assets/TNet/Common/TNSerializer.cs:2724)
  5. TNet.Serialization:ReadObject(BinaryReader) (at Assets/TNet/Common/TNSerializer.cs:2360)
  6. TNet.Serialization:ReadObject(BinaryReader) (at Assets/TNet/Common/TNSerializer.cs:2351)
  7. TNet.DataNode:Read(Byte[], SaveType) (at Assets/TNet/Common/DataNode.cs:585)
  8. TNet.DataNode:Read(Byte[]) (at Assets/TNet/Common/DataNode.cs:540)
  9. TNet.DataNode:Read(String, Boolean) (at Assets/TNet/Common/DataNode.cs:509)

What I'm doing to save it in the Editorscript is this:
  1. vNode.Write( Application.dataPath + "/_INFO/Resources/" + UnityEngine.SceneManagement.SceneManager.GetActiveScene().name + ".txt", TNet.DataNode.SaveType.Text );

and then I try to load it at runtime like this:
  1. if( !System.IO.File.Exists( Application.dataPath + "/_INFO/Resources/" + v.vesselUID + ".txt" ) ) return false;
  2. vesselNode = DataNode.Read( Application.dataPath + "/_INFO/Resources/" + v.vesselUID + ".txt" );

Why isn't this working? What am I doing wrong? The content of the DataNode is just some ints, Vector3s and strings, nothing special

2
TNet 3 Support / Add DataNode to DataNode?
« on: June 15, 2016, 10:35:06 AM »
Is there a way to add DataNodes to other DataNodes as values?
If I use SetHierarchy to create the whole DataNode I can then iterate through the entire thing and get DataNodes for all my branches and iterate through those, BUT if I create individual DataNodes and then add those to the main DataNode (node.AddChild( "blah", otherNode ) this doesn't work. What am I doing wrong?

3
NGUI 3 Support / Error with s_GetSizeOfMainGameView.Invoke in 5.4.0b9
« on: March 11, 2016, 08:27:09 AM »
Getting this error in the latest beta (5.4.0b9):

  1. NullReferenceException: Object reference not set to an instance of an object
  2. NGUITools.get_screenSize () (at Assets/NGUI/Scripts/Internal/NGUITools.cs:1871)
  3. UIPanel.GetViewSize () (at Assets/NGUI/Scripts/UI/UIPanel.cs:1871)
  4. UIPanel.UpdateTransformMatrix () (at Assets/NGUI/Scripts/UI/UIPanel.cs:1068)
  5. UIPanel.UpdateSelf () (at Assets/NGUI/Scripts/UI/UIPanel.cs:1265)
  6. UIPanel.LateUpdate () (at Assets/NGUI/Scripts/UI/UIPanel.cs:1228)

and that points me to:

  1. mGameSize = (Vector2)s_GetSizeOfMainGameView.Invoke(null, null);

I see you're using reflection there to call some unity code. Did they change or rename that function?
Can you fix this please?

4
NGUI 3 Support / NGUI Lags behind Vive Controller
« on: January 26, 2016, 06:06:22 AM »
Hi, I'm trying to put some GUI onto an HTC Vive Controller and for some reason it lags behind when I move the controller.
I also put a little sphere mesh on it and that moves with it perfectly.

Have a look: I took a video

How can I fix this?


5
If I send something with Target.AllSaved, will every single packet get saved and sent to someone who joins later, or will he only get the newest one?

6
TNet 3 Support / Losing Packets
« on: September 14, 2015, 07:25:13 AM »
Hi, it appears that I'm somehow losing packets. (For example: I switch from day to night and one of the connected machines stays in day mode)
Now I thought that this can't happen with TCP, isn't TCP guaranteeing that every packet arrives?  (unless of course there's no connection)

How is TNet handling this? What happens when a packet can't be delivered? Will it re-try? When will a client disconnect?

7
NGUI 3 Support / How to Trigger a MouseClick from Script
« on: May 05, 2015, 03:55:06 AM »
I'm trying to make the mouse click and I need this to work no matter where the cursor is. And I want it to run its course through NGUI's event system just like a real mouseclick (ideally with all the OnPress, etc. being called as well.  (Basically what I'm trying to do is using the y-axis of a 3DConnexion SpaceMouse as a click, so the client can press on the big nob to click)

How can I do this? Is there a simple way to hook into this?

Because if I want to send OnPress, OnClick and everything, then I have to duplicate the entire logic behind that.

8
NGUI 3 Support / How to do a Virtual Mousecursor for a VR GUI?
« on: February 26, 2015, 11:32:10 AM »
I'm trying to create a virtual mousecursor that lives on a flat plane inside my VR application and can interact with my GUI. (Think: Monitor inside the 3D world)
What's the best way to approach this? So far I have an invisible widget that defines the space that the screen-coordinates are mapped to and a sprite that moves around inside that space according to Input.mousePosition - works well, BUT:

How can I make the virtual cursor hover and drag and click in there while keeping the real mouse-cursor from interacting with my GUI?

9
NGUI 3 Support / Please make inheriting from NGUI classes easier!
« on: November 14, 2014, 02:35:50 AM »
Hi,

Would it be possible to mark as many methods as possible as protected virtual?

Every once in a while I need functionality that is just a little bit different from what one of the built-in scripts provides and so I'm trying to inherit from that class, but every time I do that I have to change something inside the original class too, which means I'll have to do those exact same changes every time I update NGUI from then on.

10
NGUI 3 Support / How do I move, reparent and show/hide widgets properly?
« on: September 30, 2014, 03:43:22 AM »
I have a scrollview with thousands of items. To make this work at a reasonable framerate, I only add 50 or so cells and repurpose, refill and move them around the scrollview as items move in and out of view. All in all I only need about twice as many cells as can be in view at once to scroll through thousands of items with great framerate.

But as I keep scrolling and showing and hiding and moving, things go weird. I'm fading visibilities in and out all over the place (due to mouseover, different parts of a cell have different opacities depending on their type, fade out/fade in when I switch categories, etc.) All cells that are not currently needed are moved to a secondary off-screen widget on a different panel and are hidden.

My problem: widgets tend to get stuck at wrong opacity. The inspector displays the correct opacity, but it's displaying something else. If I disable and enable the gameObject in the inspector, everything snaps back to the way it should look.

What can I do in code to make sure a widget that might have been hidden, moved to a different parent and had its opacity changed will refresh and display its current condition properly?

So far I'm calling ParentHasChanged on the widget and panel.Refresh on the panel.

11
NGUI 3 Support / Get the screen size in local ngui space?
« on: September 10, 2014, 04:54:11 AM »
Is there an easy way to get the screen space in local dimensions?

What I'm trying to say is this: I have a widget and I want it to fill 80% of the width and 80% of the height of the screen, yet I can't simply use Screen.width/height. Is there a simple way to get the width/height I'd have to enter on a specific widget to make it fill the entire screen?

12
NGUI 3 Support / Disable individual anchors in code
« on: August 15, 2014, 07:42:15 AM »
I love the anchoring system, but it is also slowly driving me insane... :)

Please tell me: What is the correct way to deal with Anchors in code?

If I do something like this:

  1. widget.leftAnchor.target = widget.rightAnchor.target = contentArea.cachedTransform;
  2. widget.leftAnchor.relative = 0f;
  3. widget.rightAnchor.relative = 1f;
  4. widget.leftAnchor.absolute = 48;
  5. widget.rightAnchor.absolute = -48;
  6. widget.topAnchor.target = widget.bottomAnchor.target = null;

Do I need to do anything else after that? Call ResetAnchors() or anything? It seems every time I work with anchors in code things start getting weird...

PS: The evil, tricky part about the above code is that works correctly ONLY IF that GameObject is NOT active in the inspector. Took me a while to figure that one out... :)

13
TNet 3 Support / Catch all messages on a specific port
« on: June 09, 2014, 07:09:24 AM »
I'm using my own UDP solution to connect an external control system to my game and it all works really well. (it's very simple, the control system sends a constant stream of values and I translate them back into usable signals to move or rotate transforms via System.Net.Sockets.UdpClient)

Now I'm using TNet to make this multiplayer. The idea is that it's a normal networking situation, all handled via TNet, only one specific player will get the UDP signals from the control system and will then delegate the actual scene-changes to the rest of the players - again via TNet. (let's say the control system connects to 192.168.0.235:8000 and TNet connects to 192.168.0.235:5127)

But for some reason the two don't work at the same time?

If I disable the TNet part the control system works, if I enable TNet all the TNet-stuff works, but the control system doesn't receive any signals.
How can I fix this? Is TNet catching all signals?


Okay. User error. Got it to work! *doh*

But now I'm wondering: Would it be possible to rewrite my solution using TNet?
Is there a way to use TNet to simply listen to a specific UDP port and look-at/use all incoming messages? (A typical message would look something like this: "pos|0|1|2#rot|0|180|0")

Thank you very much for your help!

14
NGUI 3 Support / Color problem - widgets aren't colored correctly
« on: February 28, 2014, 09:52:44 AM »
There seems to be a problem with the coloring in the shaders.

All my sprites are based on pure white, so I can give them a color later on. (I've been doing this for a long time with my own shaders)
But while NGUI previews the color correctly in the inspector it displays it wrong in the game-view. Yes, the UI-panel is at full opacity.

Look at the following example:


On the top-left you see the original sprite, on the bottom-right you see that the preview of the sprite is correct, but in the game-view the color is wrong.

You can try this yourself: Set the Camera background to 128/128/128 (50% grey), take a white sprite and move the color from white to black. You'll notice that when you reach 50% grey here, it's about twice as bright as it should be. Only when you go down to 54/54/54 you'll reach the same color as the background.

Please fix! :)

15
NGUI 3 Support / 3D GUI: Anchors don't work for corners
« on: February 26, 2014, 10:19:20 AM »
I'm trying to anchor an element to the top-right of the screen in my 3D GUI. Why doesn't this work? Is this not supposed to work?

Steps to reproduce:
  • Make a new 3D GUI
  • Add a Label
  • Set the Label's pivot to top right
  • Set the Anchors to Unified and set Top and Right to 0 on the Target's Top and Right
  • Notice how the label is out of view, whatever you do
  • Now set Anchor to none and add an Anchor component, set it to TopRight and see how that does work

Pages: [1] 2