+ 1
Why is that when i try to assign a variable i always get an error saying that it is read-only?
Read-Only! Please explain.
4 Respostas
+ 8
int i = 5; will not give an error.
Can you give an example?
+ 8
Use get component to grab the collider as an object.
mainPlayer.GetComponent(collider type);
Though you're likely looking to add the component, so you can use:
mainPlayer.AddComponent(playerCollider);
This will add the playerCollider component to the GuiTexture.
+ 2
Thank you very much! It solved my problem.
+ 1
I'm not sure if you've ever worked with unity but if you do here is an example.....
GuiTexture mainPlayer;
Collider playerCollider;
mainPlayer.collider = playerCollider;
I cant assign the collider to it and it says it is read only.
Please let me know!