Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by Vegit0n · Oct 24, 2017 at 04:40 PM · randomspriterenderertransfer

Im trying to move my pokemon game object to the enemy podium but it doesnt work

Hi, Im following this guy's tutorials: https://www.youtube.com/watch?v=l6XiJaKSZ8U

In his tutorials he makes the game 2d, but i make the whole game 3d. So far, everything works except putting the right pokemon on the battle podium.

This is my whole code for GameManager:

public class GameManager : MonoBehaviour {

 public GameObject playerCamera;
 public GameObject battleCamera;

 public GameObject player;

 public List<BaseZakMonsters> allZakMonsters = new List<BaseZakMonsters>();
 public List<ZakMonsterMoves> allMoves = new List<ZakMonsterMoves>();

 public Transform enemyPodium;
 public Transform friendlyPodium;
 public GameObject emptyMonster;

 void Start ()
 {
     playerCamera.SetActive(true);
     battleCamera.SetActive(false);
 }
 

 void Update () {
     
 }

 public void EnterBattle(Rarity rarity)
 {
     playerCamera.SetActive(false);
     battleCamera.SetActive(true);

     BaseZakMonsters battleZakMonsters = GetRandomZakMonsterFromList(GetZakMonsterByRarity(rarity));

     Debug.Log(battleZakMonsters.name);

     player.GetComponent<Player>().canMove = false;

     GameObject dMonster = Instantiate(emptyMonster, enemyPodium.transform.position, Quaternion.identity) as GameObject;

     dMonster.transform.parent = enemyPodium;

     BaseZakMonsters tempMonster = dMonster.AddComponent<BaseZakMonsters>() as BaseZakMonsters;
     tempMonster = battleZakMonsters;

     dMonster.GetComponent<BaseZakMonsters>().ZakMonster = battleZakMonsters.ZakMonster; 
 }

 public List<BaseZakMonsters> GetZakMonsterByRarity(Rarity rarity)
 {
     List<BaseZakMonsters> returnZakMonsters = new List<BaseZakMonsters>();
     foreach (BaseZakMonsters ZakMonsters in allZakMonsters)
     {
         if (ZakMonsters.rarity == rarity)
             returnZakMonsters.Add(ZakMonsters);
     }

     return returnZakMonsters;
 }

 public BaseZakMonsters GetRandomZakMonsterFromList(List<BaseZakMonsters> monsterList)
 {
     BaseZakMonsters monster = new BaseZakMonsters();
     int monsterIndex = Random.Range(0, monsterList.Count - 1);
     monster = monsterList[monsterIndex];
     return monster;
 }

}

[System.Serializable] public class ZakMonsterMoves { string Name; public MoveType category; public Stat moveStat; public ZakMonsterType moveType; public int PP; public float Power; public float accuracy; }

[System.Serializable] public class Stat { public float minimum; public float maximum; }

public enum MoveType { Physical, Special, Status }

This part for entering battle:

public void EnterBattle(Rarity rarity) { playerCamera.SetActive(false); battleCamera.SetActive(true);

     BaseZakMonsters battleZakMonsters = GetRandomZakMonsterFromList(GetZakMonsterByRarity(rarity));

     Debug.Log(battleZakMonsters.name);

     player.GetComponent<Player>().canMove = false;

     GameObject dMonster = Instantiate(emptyMonster, enemyPodium.transform.position, Quaternion.identity) as GameObject;

     dMonster.transform.parent = enemyPodium;

     BaseZakMonsters tempMonster = dMonster.AddComponent<BaseZakMonsters>() as BaseZakMonsters;
     tempMonster = battleZakMonsters;

     dMonster.GetComponent<BaseZakMonsters>().ZakMonster = battleZakMonsters.ZakMonster; 
 }

and this is the line i did different:

dMonster.GetComponent().ZakMonster = battleZakMonsters.ZakMonster;

The guy from the tutorial uses a sprite renderer because its 2d and the line he used looks like this:

dPoke.GetComponent().sprite = battlePokemon.image;

am i doing something wrong here? the only thing i did different is using a GameObject instead of a sprite. Is it even possible to do this with a GameObject? or is it only possible with a sprite?

ZakMonsters is the name i use for Pokemon.

Please help!

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

122 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Display pictures in assets folder in random order 0 Answers

Coin Flip not working 0 Answers

Random Number every 5 seconds 2 Answers

Help with Randomized Sprite on GUI button click 0 Answers

Randomly generate blocks on a flat map 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges