This script works well while in Unity Editor
GameObject obj = new GameObject("MyObject");
MyScript s = obj.AddComponent();
But when calling it in a Android APK it return a Null Pointer Reference error when calling MethodThatInstantiateSomething, at the line where Instantiate() is called.
A little useless intro:
Today i had this problem: i wanted to visaully see how an AI was playing while I was moving my player object on game screen. The best solution i thought of is using an editor script to make a scene cam follow my AI object. A made a little google search, wich didn’t give me any kind of answer. Then i decided to write this script by myself.
Where this post should really start
Hi all! I just made this neat C# editor script for Unity3D, wich adds a function to “chase” objects whitin your editor’s scene views. It can be used to follow an object while you play, showing in separate windows and/or with a separate angles what is happening around. Or it could be used to let your testers play the game on one monitor, while you look over all your methodically placed debug lines and texts on a second one. Just use your imagination.
It will update ALL your scene views, for example if you want to simultaneously look at an object front, lateral and top views you can create more scene views within your editor and let the script do its magic.
How to use:
You can open a Chase Cam toolbox by clicking Window>Chase Cam in your editor menu. As you can see in the screen, there are two toggles an object selection box, I think their usage is intuitive. If not, see script’s header for more detailed instructions or just play around with the buttons. Please note the script will not run if the game isn’t running.
The script is release under
GNU GPL v2 license Modified BSD License (switched after this discussion on reddit), feel free to modify/improve it and if you want drop a comment here or mail me showing me your modifications I will be happy.
Unity3D Scene Chase Cam (865)