Author Topic: Getting the player object that clicked something?  (Read 1118 times)


  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 21
    • View Profile
Getting the player object that clicked something?
« 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?


  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,154
  • Toronto, Canada
    • View Profile
Re: Getting the player object that clicked something?
« Reply #1 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?