Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Excal on May 07, 2014, 07:44:29 PM

Title: Getting the player object that clicked something?
Post by: Excal on May 07, 2014, 07:44:29 PM
I have a game with several Player gameobjects. Each of these players has a Player.cs script that generates a UI prefab at runtime on a layer called UI. I want to use NGUI's event system to handle clicks since each player has a UI but will also be clicking objects in the game world.

Each game object in the game world has a Unit.cs script attached. This script has a OnSelect() function. I want to show each player what game object they have currently selected. How would I reference the Player that clicked the object, so only the player who selected the object can get information for it in his UI?
Title: Re: Getting the player object that clicked something?
Post by: ArenMook on May 08, 2014, 02:43:56 AM
That really doesn't sound like a UI question to me. It sounds like a "how do I lock my interaction to a specific player?", which is game logic. I don't even fully understand the question as each player would have their own UI on their own computer, so why is any of this of interest? Reference the player where?