hi,
I created a script playerScript ( Attached to each player ) with “notHuman” property
but I need to know how to set the notHuman property to True just for the robot
playerScript.cs
public bool notHuman;
function Start () {
//find all players //set notHuman to True just for the robot?
}
and
from the Arrays script,i need to know how to access ( get/set ) each player notHuman property individually
Arrays.cs
using UnityEngine;
using System.Collections;
public class Arrays : MonoBehaviour
{
public GameObject[ ] players;
for(int i = 0; i < players.Length; i++)
{
Debug.Log("Player Number “+i+” is named "+players*.name);* //which player has the notHuman property with a positive value?
try checking if the player is human in the loop function e.g.
for(int i = 0; i < players.Length; i++) {
if (players[i].name == "Robot") {
players[i].notHuman = true; //set the value of the player to not human.
}
Debug.Log("Player Number "+i+" is named "+players[i].name);
}
is this what you wanted? you question is very vague, try rewording it if this is the wrong answer
I’m getting errors with players*.GetComponent(playerScript)[/B]* this is what a i trying to do: the scene has 3 cubes ( tagged: player ) representing the players and with playerScript script attached and the canera with cameraPick script attached i need to mark “as selected” the cube that is clicked and only the selected cube should begin to rotate but in the cameraPick script there are 3 errors related to playerScript being a type but used as variable playerScript.cs ``` *using UnityEngine;
using System.Collections;
Your checking if your ray hits anything and not what player object it hits. You’re also setting selected to true and then checking if it’s true - so it always will be. Check out the Raycast overloads and use one of the ones that gives you back a RaycastHit object. This will be the object you clicked on.