+ 1
I understand coding but i dont know how to get some forms or other objects to display on the screen and it ruins my code.
4 odpowiedzi
+ 3
What kind of objects? UI in Unity?
+ 2
I'm not sure what you mean by win forms.
In Unity, if you click on an object you will see some things appear in the inspector. Those are the objects components. It will have a Transform, and depending the object maybe a RigidBody, or Collider etc..
To access one of these components via script you need a reference to the object.
Ex/
public GameObject player;
Then I'd need to attach the script to a gameObject, and I can drag and drop the player object into the player spot from the inspector for this script.
Then I can go:
Transform playerTrans = player.getComponent<Transform>();
So getComponent<>() allows me to use the component of the object. Add component allows you to add a new component to the object.
If you want to create an object entirely via script you can use the new keyword and call the Constructor of whatever object you want to create:
GameObject scripted = new GameObject();
0
at first in unity i needed to use the add and get components so they could be usable. The thing is i dont know which to use in win forms? like programming things dynamicallay as in with pure code.
0
Thank you very much you helped me!