I would love to start being able to create my own custom actions, and I was wondering if you could explain it to someone who knows C# coding a bit but is far from proficient at it. I've look at the Actions and tried to figure out by myself but I was hoping you could provide a very basic example explaining how each part works. Here's an example bit of code I would like to make into an action:
GetComponent<MeshRenderer>().material.renderQueue +=1 // Higher the value the later it will be rendered. (C Mono only)
I use this in my 2D game to set which objects gets rendered in what order. It works great and I would love to create an action out of this. If I understand how it works, maybe I could start creating some iTween actions as well. In the action above I would like to be able to specify a gameobject (or use the owner of the script) and then set it layer order.
Another example I'd like to put in as an action, I could be wrong but don't think it's available, is this:
for (int i = 0; i < int_variable; i++)
{
Do Action "int_variable" times;
}
This would be cleaner than doing a float/int compare action. If you could explain a couple of examples of how to turn two pieces of code like this into actions, I could start producing actions of my own that I would share with the community.
And lastly, what about an iTween action so maybe I could start on some that I would like to use? Maybe this one to get me started:
iTween.ValueTo(GameObject target, Hashtable args)
// Example below
iTween.ValueTo(gameObject,{"from":score,"to":score+bonus,"time":.6,"onUpdate":"UpdateScoreDisplay"}) // complete Hashtable args available here: http://itween.pixelplacement.com/documentation.php#ValueTo
Teach a man how to fish!
Thank you in case you have the time to help!
Tobbe
(Don't know why the text in the CODE tags appear so small...)