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.


Messages - bariscigal

Pages: [1]
1
NGUI 3 Support / Re: Never use Instantiate(). Use NGUITools.AddChild.
« on: January 23, 2015, 04:30:05 AM »
Hello is there a reason this line doesn't change the layer and its children tree recursively?

go.layer = parent.layer;

I will change it to

  1. foreach (Transform trans in go.GetComponentsInChildren<Transform>(true))
  2.                         {
  3.                                 //go.layer = parent.layer;
  4.                                 trans.gameObject.layer = parent.layer;
  5.                         }

but couldn't be sure why you have left it out

2
NGUI 3 Support / Re: Scrolling Credits Scene
« on: September 23, 2014, 02:40:36 PM »
Created a quick solution for this type of credits and wanted to share.
Create a scroll view and create a long text of uilabel as a child.
And attach this to your scrollview object.

  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class creditsScroller : MonoBehaviour {
  5.         UIScrollView scrollView;
  6.         UIPanel _myPanel;
  7.         public float textMaxOffset = 3500f;//roughly a 100 line of text
  8.         public float scrollSpeed = -1f;//negative speed for text scrolling from down to up
  9.  
  10.         void Start () {
  11.                 scrollView = GetComponent<UIScrollView>();
  12.                 _myPanel = GetComponent<UIPanel>();
  13.         }
  14.  
  15.         void Update () {
  16.                 scrollView.Scroll(Time.deltaTime * scrollSpeed);
  17.                 if(_myPanel.clipOffset.y < -(textMaxOffset)){
  18.                         scrollView.Scroll(0);
  19.                         scrollView.ResetPosition();
  20.                 }
  21.         }
  22. }

This will roll the credits until the text finishes and will start over.

3
TNet 3 Support / createChannel and joinChannel difference
« on: August 11, 2014, 02:44:27 PM »
Hi again,

Can i learn what is the difference between :
TNManager.CreateChannel() and the JoinChannel counterpart.

They seem to be doing the same thing.
What i am after is create a channel by the server instance starter but not join yet.
When some player joins to server join  the channel in sync.
And if the channel is not created a message would help me if no channel is active yet.

Also is there a way to assign a channel id while creating one?


4
TNet 3 Support / How can i "not" load a level after a channel connect
« on: August 07, 2014, 04:47:45 AM »
Hi
This can be something i am missing in the documents. But i couldn't find a way to control the scene load time. When a succesfull channel connect Tnet automatically loads the scene with the channel name. How can i stop this happening and load with an rfc call or a yield ed time?
 I am trying to synchronize my closed 1vs1 game loading.
Thanks

5
TNet 3 Support / Re: Timed Out error, every time - please help
« on: August 07, 2014, 04:40:26 AM »
Good Ol Sockets new version just works now for me. (1.3)
Mine was a  problem with the ports as i recall because i had the same timeout problem. GoS was causing random port assignment not the the one you determine .

Now it works for me. You can contact the GoS developer so he can send you the new update before it gets online it is the way i solved the problem.

6
TNet 3 Support / Re: LAN Server Creation Problem IOS mainly
« on: August 04, 2014, 03:07:55 AM »
This solved the problem

  1. UdpProtocol.useMulticasting = false;

Any ideas why Multicasting is causing Udp to give those errors?

Now it works with GoS and Ios Pro Sockets.

PS:
I also needed to add this
  1. // Start resolving IPs
  2.                 Debug.Log(Tools.localAddress);

because of the 255.255.255.255 ip resolving problem. Added to Start()

7
TNet 3 Support / Re: LAN Server Creation Problem IOS mainly
« on: August 03, 2014, 01:37:53 PM »
For the coroutine it is just there to keep sending the servers info (name and local ip of the broadcaster) in a 1.5s of wait time between broadcast signals.
I think i would have done that with invoke repeating but i don't know a way to stop that function working when broadcast needs to be finished.

Thank you i will look in to this problem more.
I will let others know when i found a way to this weird problem. I checked the things you have mentioned before posting.

8
TNet 3 Support / LAN Server Creation Problem IOS mainly
« on: August 02, 2014, 09:50:45 AM »
Hello i am only having this problem on IOS platform.

I am a starter on Tnet but trying to achieve a design of a closed game environment for 1 vs 1 game with inter-platform (android-ios) gameplay.

I can start the server without any problems on Mac and Android with this line of code :

  1. if(!TNServerInstance.isActive){
  2.   TNServerInstance.Start(5127,5113,5128,"server.dat",TNServerInstance.Type.Lan);
  3.   //Start sending server info through udp to listeners
  4.   //StartCoroutine("LanSendServerInfoUDP");
  5. }
  6.  

I have IOS pro and Unity pro. And for my android basic license i am using Good Ol' Sockets.

On ios when i start the server with an ngui button event server is not starting and this error is getting logged to console

Quote
- Completed reload, in  0.263 seconds
Non platform assembly: /private/var/mobile/Applications/4121A2A5-128A-41FF-AD43-12AE0DEBC5E6/networkTest.app/Data/Managed/System.Core.dll (this message is harmless)
_wapi_setsockopt: Need to translate 45 [Operation not supported] into winsock error
SocketException: System call failed
  at System.Net.Sockets.Socket.SetSocketOption (SocketOptionLevel optionLevel, SocketOptionName optionName, System.Object optionValue) [0x00000] in <filename unknown>:0

  at TNet.UdpProtocol.Start (Int32 port) [0x00062] in /Users/bariscigal/networkTest/Assets/TNet/Common/TNUdpProtocol.cs:114
  at TNet.UdpLobbyServer.Start (Int32 listenPort) [0x00011] in /Users/bariscigal/networkTest/Assets/TNet/Server/TNUdpLobbyServer.cs:49
  at TNServerInstance.StartLocal (Int32 tcpPort, Int32 udpPort, System.String fileName, Int32 lobbyPort, Type type) [0x00041] in /Users/bariscigal/networkTest/Assets/TNet/Client/TNServerInstance.cs:177
  at TNServerInstance.Start (Int32 tcpPort, Int32 udpPort, Int32 lobbyPort, System.String fileName, Type type) [0x00000] in /Users/bariscigal/networkTest/Assets/TNet/Client/TNServerInstance.cs:147
  at serverStartup.StartServer () [0x0000a] in /Users/bariscigal/networkTest/Assets/serverStartup.cs:45
  at EventDelegate.Execute () [0x0001c] in /Users/bariscigal/networkTest/Assets/NGUI/Scripts/Internal/EventDelegate.cs:450
  at EventDelegate.Execute (System.Collections.Generic.List`1 list) [0x0001b] in /Users/bariscigal/networkTest/Assets/NGUI/Scripts/Internal/EventDelegate.cs:592
  at UIButton.OnClick () [0x00021] in /Users/bariscigal/networkTest/Assets/NGUI/Scripts/Interaction/UIButton.cs:201
UnityEngine.GameObject:SendMessage(String, Object, SendMessageOptions)
UICamera:Notify(GameObject, String, Object) (at /Users/bariscigal/networkTest/Assets/NGUI/Scripts/UI/UICamera.cs:832)
UICamera:ProcessTouch(Boolean, Boolean) (at /Users/bariscigal/networkTest/Assets/NGUI/Scripts/UI/UICamera.cs:1508)
UICamera:ProcessTouches() (at /Users/bariscigal/networkTest/Assets/NGUI/Scripts/UI/UICamera.cs:1193)
UICamera:Update() (at /Users/bariscigal/networkTest/Assets/NGUI/Scripts/UI/UICamera.cs:970)
 
(Filename: /Users/bariscigal/networkTest/Assets/TNet/Common/TNUdpProtocol.cs Line: 114)

I am not using any lobby client nor predefined script of tnet. Instead i am trying to learn how to control the tnet to my needs.

As i see the problem arise from winsock but here is my UDP message sending and listening code also:

  1. void Start () {
  2.  
  3.                 // Start resolving IPs
  4.                 Tools.ResolveIPs();
  5.                 // We don't want mobile devices to dim their screen and go to sleep while the app is running
  6.                 Screen.sleepTimeout = SleepTimeout.NeverSleep;
  7.                        
  8.                 // Make it possible to use UDP using a small random range of port
  9.                 TNManager.StartUDP(Random.Range(10000,10030));
  10.  
  11.                 //if the random port gets locked by other users port than randomize once more
  12.                 while(TNManager.canUseUDP){
  13.                         TNManager.StartUDP(Random.Range(10000,10030));
  14.                 }
  15.  
  16.                 //UdpProtocol.defaultNetworkInterface = Tools.localAddress;
  17.                 tnobj = GetComponent<TNObject>();
  18.                 ServerName = SystemInfo.deviceName;
  19.                 directConnectionIp = Tools.localAddress;
  20.                 ServerIpStr = directConnectionIp.ToString();
  21.         }
  22. .
  23. .
  24. .
  25. public IEnumerator LanSendServerInfoUDP()
  26.         {
  27.                 while(true){
  28.                         //start broadcasting the server info from udp through lan broadcast
  29.                         yield return new WaitForSeconds(1.5f);
  30.                         message = ServerName + '@' + ServerIpStr;
  31.  
  32.                         for(int i = 10000;i<= 10030;i++){
  33.                                 tnobj.BroadcastToLAN(i,"ReceiveServerInfo",message);
  34.                         }
  35.  
  36.                         yield return null;
  37.                 }
  38.         }
  39. .
  40. .
  41. .
  42. [RFC]
  43.         public void ReceiveServerInfo(string broadcastServerInfo){
  44.                 string[] responseMessage = broadcastServerInfo.Split(new char[] { '@' }, System.StringSplitOptions.RemoveEmptyEntries);
  45.                 IpToConnect = responseMessage[1] ;
  46.                 stringToEditRcv = "message received  " + responseMessage[1] ;
  47.         }
  48.  
  49.  


I would be glad if someone can help me point what i am doing wrong.

9
Other Packages / Re: SGSK - Turning Torque axis problem
« on: March 13, 2014, 10:02:48 AM »
Thank you for reply. it turns out a problem caused by me.


10
Other Packages / SGSK - Turning Torque axis problem
« on: March 11, 2014, 04:30:15 PM »
Hi,
I have been using this kit for a long time now. It is pretty in the core of my game now. First i must thank you :) .
I made huge tweaks to the system but the physics and camera chase scripts are pretty untouched.
 
I have asked a similar question before but i noticed a big thing today.

Problem is the torque for turning are applied based on the view angle.

The steering and maneuver systems are mainly untouched. I have changed turn and move inputs mainly.

There is no problem when main cam is following(chasing) the target from back of the player. But when camera is in front of the player in a 45 degree angle when i set the input for like roll (turn.z) it starts to turn in the forward vector of the "camera.forward"not the "gameobject.rigidbody.forward" vector.

I was having this problem since the start but haven't thought about it as a big issue because the torque error is minimal in normal mode.

Any ideas why this is happening?

11
It can be my mistake but if i am not wrong there are some *.asset files in the package i have downloaded.
Take a look at the screen grab in the attachment.


Now i am not sure how the matrices got lost. But it happened right after importing the asset> and opening the demo scene.

I have lost tags, input setups and collision matrix(in physics).

Not a big deal but it took me a day to re-apply all those tags and layers.

12
It is a bitter lesson for me to learn something : always integrate an asset "after" testing with an empty scene and an empty project.

The thing is :
I had my 10+ tags, 10+ layer configs and a  spiderweb of layer collision matrix and also special input mappings for my game. And just because i have imported this asset without hesitation means i have lost all of them now.

I know people are having hard time figuring out unity's project settings needed for the assets but i think you shouldn't have been added these in the asset. Maybe a seperate download of these settings would be better is it not?

And i know i should have backed them up with my asset exports :(

Another question: What is the maximum terrain resolution i can use with terrain generation script?

13
Ok nevermind i think i solved it:

  1. if (GameObject.FindGameObjectsWithTag(targettag).Length > 0)
  2.             {
  3.                enemyObjs = GameObject.FindGameObjectsWithTag(targettag);
  4.                                 for (int i = 0; i < enemyObjs.Length; i++)
  5.                         {
  6.                                         GameObject enemyHUDs = NGUITools.AddChild(hareketliHUD, targetA);
  7.                                         enemyHUDs.name = "target." + enemyObjs[i].name;
  8.                                        
  9.                                         UIFollowTarget enemyFollower = enemyHUDs.GetComponent<UIFollowTarget>();
  10.                                         UISprite enemySprite = enemyHUDs.GetComponent<UISprite>();
  11.                                        
  12.                                         enemySprite.MakePixelPerfect();
  13.                                         enemyFollower.gameCamera = currentCamera;
  14.                                         enemyFollower.uiCamera = NGUICam;
  15.                                         enemyFollower.target = enemyObjs[i].transform;
  16.                                         }



This will create the needed target HUDs for each enemy object in the scene.

I would be glad if you can check and let me know if there is a better way for this?

14
Sorry i wasn't clear. I have made my ui with unity ui system. So 40 drawcalls is normal. Now i am trying to migrate my HUD to NGUI.

So i will create widget, and parent it to the same panel.
Should i use add widget or add child on the runtime?

I only need sprites and labels for runtime generated enemy HUDs.
 

15
Hello,
Sorry for a beginner question :

I am working on a dog-fight game. I am displaying some labels and textures on each enemy.

I don't want to manage every enemy in the scene one-by-one so i have created a script which reads all enemies based on tags and creates those information texts and textures on them at the start of the level.

 What i have right now works great but it has over 40 drawcalls with 4 enemies in the scene. Now i am trying to migrate to NGUI system.
But i am having problems creating the :

- needed labels for each enemy (distance, attack mode)
- different textures based on targeting hud objects based on the distance(can see->can fire->can lock missile) on each plane
- different textures based on friendly or enemy

on NGUI system.
I am not in search of a ready script but a pointer in the right direction.
How should i implement the needed steps?

any help would be appreciated.

(BTW i have ngui and Hud text addon)

 

Pages: [1]