0

I am new to Unity3D, I developed a simple Unity3D application for rotating a cube and build it for android, now I want to send values for rotation from my android app to unity 3D, is it possible? can I pass values through Intent?

  • 2
    Your question is not very clear - your android app IS Unity 3D, so I don't know what you're trying to do. – Spikeh Jan 11 '14 at 10:46
  • Nobody have understood you. I understand what you want to accomplish but i do not know answer to that question, and I would like to know that too. Maybe I will use that in future. For those who do not understand question. Basically he wants to star unity app using android custom intent or build in intent like take a picture open url and so on, and pass some parameters to unity in this intent, like starting position, level or anything like that. – Michał Leszczyński Jul 18 '16 at 18:29
  • I can only suggest one thing, you can build unity app to Android project, than open that project in Android studio. probably you will be able to define some entry points to android app in manifest there for your intent, but i do not know if it would be possible to pass any values to unity. this answer may help you: http://stackoverflow.com/questions/36098400/read-android-intent-extra-data-on-unity-app-launch – Michał Leszczyński Jul 18 '16 at 18:36

3 Answers3

1

you can use UnityPlayer.UnitySendMessage to send data from android java to unity3d side.

UnityPlayer.UnitySendMessage("Gameobject name","methodName","parameter");

for people who stumble on this question.

Lassi Kinnunen
  • 448
  • 4
  • 10
-1

Yes, for sure you can possible value at runtime, modifying [object].transform.localRotation

Anyway if you want to a rotation, like you can rotate an object with your finger, i can recommend you a script which is a Unity3D Framework

http://interactivelab.github.io/TouchScript/

Laykker
  • 322
  • 1
  • 3
  • 12
-1

Like @Laykker mentioned, it is possible to pass in values during runtime.

A simple example would be:

//Your Cube Object
public GameObject cubeObject;

//Rotates cube in the x-axis by 20f when clicked
void OnClick () {
   Quaternion rotation = cubeObject.transform.localRotation;
   rotation.x += 20f;
   cubeObject.transform.localrotation = rotation;
}
KennethLJJ
  • 157
  • 3
  • 12