Reference Non-Prefab Object in Script
I'm trying to create a simple snake game, where the Player controller creates a prefab body object every time it hits an orb (inspired by the roll a ball tutorial). The created objects should mimic the movements of the player, but with a delay. To achieve this, the objects are equipped with a buffer to store the movement history of the player(wich i want to gather in the script via p.transform.position in a FixedUpdate) Now my problem: I'm trying to reference my player object with
public GameObject p;
but unity prevents me from dragging my player into the script component. I suspect that GameObjects are for prefabs and that I need to use some other type of Variable Type, but I don't know which one. What do I need to do ?
Your answer
Follow this Question
Related Questions
How to access y rotation of an object as a variable or value 1 Answer
How do i move a cube like an actual cube?,How Can i Move a Cube? 0 Answers
How do you change your z axis in a movement script. 1 Answer
moving an object continuously between waypoints 0 Answers
C# finding the axis of a characterobject 0 Answers