lördag 8 februari 2014

Struggling with unity, GameObjects, instantiate and hierarchies.

Today I've just struggled with understanding unitys hierarchy and tried to make neurons to be created in the right game object.

It wont work...

this is the part of the code that wont work:

GameObject temp = (GameObject)Instantiate(microObjects[chosenMicroObject], hit.transform.gameObject.transform.position, Quaternion.identity);

temp.transform.position = new Vector3(0,0,0);
temp.transform.parent = neuralNet.transform;

the game object wont change position or get neuralNet as parent.

there is an error: 

InvalidCastException: Cannot cast from source type to destination type.

Anyway, time to give up for today.

I've also 'wasted' a lot of time on irc talking about psychological phenomena and suffering. Which I find interesting but I don't know if I should let it take time from this game. I don't know.


Inga kommentarer:

Skicka en kommentar