الشهر: أكتوبر 2015

Creating dynamically unity controller and adding to it states with motions

.A programmer with good potentials

zero2herosite

Today i will show you how to add controller Dynamically Using C# Script


Create new  unity project
then add to it C# script  Assets > Create > C# Script
Add Script

Name it as you like for me “Controller Script”

add your Script to any game object you have Double click on it to open . It will be opened in MonoDevelop

place the following code on “void start” function as we need it be be called once

var controller = UnityEditor.Animations.AnimatorController.CreateAnimatorControllerAtPath ("Assets/Mycontroller.controller");

This will Create to use a blank controller  in Assets folder


Now for adding AnimatorState with a motion

Create New folder Name it Resources inside assets folder. add to it all you .animation file you want to add to your controller,so that you could load it in  run time.

In your Script create two motion object (For Example) to store the loaded animations in it. As the Following Code:

Motion…

View original post 145 more words