I am very new to Unity and scripting, and I havent been able to figure this problem out on my own.
I have a player character, that is created in its own scene, and then preserved when changing scenes. When i decide to apply this piece of script into triggering object(Object that is supposed to move player a bit)
I cannot select the playerobject to the script because it doesnt exist in that scene yet.
Now how should/could I properly circumvent this problem, or am I just being a bit silly again?
I may ha been a bit unclear. I have this object called TriggerButton, which contains the script. Triggerbutton is sitting nicely in its own scene, and waiting for player to come and collide with it. if(collisionInfo.gameObject.tag == "Player") <-This line is already in use and working. What is not working, is that playerObject (tag: Player) does not change its position at collision with TriggerButton, even though other events (playing sound, changing variables) which I left out of this code work perfectly.
Here is the full script: Since I cannot paste long scripts into comments, I made this new "answer" so I could paste the entire script I am using. I did also make some changes to it, but they dont seem to help.
As an aside, the Unity Documentation has a Component.CompareTag method.
I'm not sure why, but it seems that the preferred approach would be:
The problem with your script is that the playerObject is never defined, which (I now see) is what you were asking.
When this object is created, it will find the playerObject (by tag) and set the variable in this script to point to it, and then changing its transform should be reflected on the real playerObject.